added wrapper function for playing and fading menu sounds and music
authorHolger Schemel <info@artsoft.org>
Tue, 20 Dec 2016 00:04:00 +0000 (01:04 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 20 Dec 2016 00:04:00 +0000 (01:04 +0100)
src/screens.c
src/tools.c
src/tools.h

index a4dca87a5fb8ae6e5ada6a16496f7d94db3346a1..6e26fdf55e4f75e1c8b57b4349269ce1b691191c 100644 (file)
@@ -1408,7 +1408,7 @@ void DrawMainMenu()
   /* do not fade out here -- function may continue and fade on editor screen */
 
   UnmapAllGadgets();
   /* do not fade out here -- function may continue and fade on editor screen */
 
   UnmapAllGadgets();
-  FadeSoundsAndMusic();
+  FadeMenuSoundsAndMusic();
 
   ExpireSoundLoops(FALSE);
 
 
   ExpireSoundLoops(FALSE);
 
@@ -1504,8 +1504,7 @@ void DrawMainMenu()
     LoadTape(level_nr);
   DrawCompleteVideoDisplay();
 
     LoadTape(level_nr);
   DrawCompleteVideoDisplay();
 
-  PlayMenuSound();
-  PlayMenuMusic();
+  PlayMenuSoundsAndMusic();
 
   /* create gadgets for main menu screen */
   FreeScreenGadgets();
 
   /* create gadgets for main menu screen */
   FreeScreenGadgets();
@@ -1608,7 +1607,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
        return;
       }
 
        return;
       }
 
-      FadeSoundsAndMusic();
+      FadeMenuSoundsAndMusic();
     }
 
     FadeOut(REDRAW_ALL);
     }
 
     FadeOut(REDRAW_ALL);
@@ -1706,7 +1705,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
     }
     else
     {
     }
     else
     {
-      FadeSoundsAndMusic();
+      FadeMenuSoundsAndMusic();
 
       return_to_main_menu = TRUE;
     }
 
       return_to_main_menu = TRUE;
     }
@@ -2161,7 +2160,7 @@ static void DrawInfoScreen_Main()
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
-  FadeSoundsAndMusic();
+  FadeMenuSoundsAndMusic();
 
   FreeScreenGadgets();
   CreateScreenGadgets();
 
   FreeScreenGadgets();
   CreateScreenGadgets();
@@ -2200,8 +2199,7 @@ static void DrawInfoScreen_Main()
 
   MapScreenGadgets(max_info_info);
 
 
   MapScreenGadgets(max_info_info);
 
-  PlayMenuSound();
-  PlayMenuMusic();
+  PlayMenuSoundsAndMusic();
 
   DrawMaskedBorder(fade_mask);
 
 
   DrawMaskedBorder(fade_mask);
 
@@ -2753,7 +2751,7 @@ void HandleInfoScreen_Elements(int button)
 
     if (page >= num_pages)
     {
 
     if (page >= num_pages)
     {
-      FadeSoundsAndMusic();
+      FadeMenuSoundsAndMusic();
 
       info_mode = INFO_MODE_MAIN;
       DrawInfoScreen();
 
       info_mode = INFO_MODE_MAIN;
       DrawInfoScreen();
@@ -2812,7 +2810,7 @@ void HandleInfoScreen_Music(int button)
 
     if (list == NULL)
     {
 
     if (list == NULL)
     {
-      FadeSoundsAndMusic();
+      FadeMenuSoundsAndMusic();
 
       ClearField();
       DrawHeadline();
 
       ClearField();
       DrawHeadline();
@@ -2831,7 +2829,7 @@ void HandleInfoScreen_Music(int button)
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
-    FadeSoundsAndMusic();
+    FadeMenuSoundsAndMusic();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
@@ -2852,7 +2850,7 @@ void HandleInfoScreen_Music(int button)
 
     if (list == NULL)
     {
 
     if (list == NULL)
     {
-      FadeSoundsAndMusic();
+      FadeMenuSoundsAndMusic();
 
       info_mode = INFO_MODE_MAIN;
       DrawInfoScreen();
 
       info_mode = INFO_MODE_MAIN;
       DrawInfoScreen();
@@ -2860,7 +2858,7 @@ void HandleInfoScreen_Music(int button)
       return;
     }
 
       return;
     }
 
-    FadeSoundsAndMusic();
+    FadeMenuSoundsAndMusic();
 
     if (list != music_file_info)
       FadeSetNextScreen();
 
     if (list != music_file_info)
       FadeSetNextScreen();
@@ -3115,7 +3113,7 @@ void DrawInfoScreen_Credits()
 {
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_CREDITS);
 
 {
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_CREDITS);
 
-  FadeSoundsAndMusic();
+  FadeMenuSoundsAndMusic();
 
   FadeOut(REDRAW_FIELD);
 
 
   FadeOut(REDRAW_FIELD);
 
@@ -3156,7 +3154,7 @@ void HandleInfoScreen_Credits(int button)
 
     if (screen_nr >= num_screens)
     {
 
     if (screen_nr >= num_screens)
     {
-      FadeSoundsAndMusic();
+      FadeMenuSoundsAndMusic();
 
       info_mode = INFO_MODE_MAIN;
       DrawInfoScreen();
 
       info_mode = INFO_MODE_MAIN;
       DrawInfoScreen();
@@ -3235,7 +3233,7 @@ void HandleInfoScreen_Program(int button)
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
-    FadeSoundsAndMusic();
+    FadeMenuSoundsAndMusic();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
@@ -3410,7 +3408,7 @@ void HandleInfoScreen_Version(int button)
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
-    FadeSoundsAndMusic();
+    FadeMenuSoundsAndMusic();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
@@ -3498,7 +3496,7 @@ void HandleInfoScreen_LevelSet(int button)
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
-    FadeSoundsAndMusic();
+    FadeMenuSoundsAndMusic();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
 
     info_mode = INFO_MODE_MAIN;
     DrawInfoScreen();
@@ -3531,10 +3529,7 @@ static void DrawInfoScreen()
   if (info_mode != INFO_MODE_MAIN &&
       info_mode != INFO_MODE_TITLE &&
       info_mode != INFO_MODE_MUSIC)
   if (info_mode != INFO_MODE_MAIN &&
       info_mode != INFO_MODE_TITLE &&
       info_mode != INFO_MODE_MUSIC)
-  {
-    PlayMenuSound();
-    PlayMenuMusic();
-  }
+    PlayMenuSoundsAndMusic();
 }
 
 void HandleInfoScreen(int mx, int my, int dx, int dy, int button)
 }
 
 void HandleInfoScreen(int mx, int my, int dx, int dy, int button)
@@ -4064,12 +4059,11 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
 
 void DrawChooseLevelSet()
 {
 
 void DrawChooseLevelSet()
 {
-  FadeSoundsAndMusic();
+  FadeMenuSoundsAndMusic();
 
   DrawChooseTree(&leveldir_current);
 
 
   DrawChooseTree(&leveldir_current);
 
-  PlayMenuSound();
-  PlayMenuMusic();
+  PlayMenuSoundsAndMusic();
 }
 
 void HandleChooseLevelSet(int mx, int my, int dx, int dy, int button)
 }
 
 void HandleChooseLevelSet(int mx, int my, int dx, int dy, int button)
@@ -4081,7 +4075,7 @@ void DrawChooseLevelNr()
 {
   int i;
 
 {
   int i;
 
-  FadeSoundsAndMusic();
+  FadeMenuSoundsAndMusic();
 
   if (level_number != NULL)
   {
 
   if (level_number != NULL)
   {
@@ -4129,8 +4123,7 @@ void DrawChooseLevelNr()
 
   DrawChooseTree(&level_number_current);
 
 
   DrawChooseTree(&level_number_current);
 
-  PlayMenuSound();
-  PlayMenuMusic();
+  PlayMenuSoundsAndMusic();
 }
 
 void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button)
 }
 
 void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button)
@@ -4146,7 +4139,7 @@ void DrawHallOfFame(int highlight_position)
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
-  FadeSoundsAndMusic();
+  FadeMenuSoundsAndMusic();
 
   /* (this is needed when called from GameEnd() after winning a game) */
   KeyboardAutoRepeatOn();
 
   /* (this is needed when called from GameEnd() after winning a game) */
   KeyboardAutoRepeatOn();
@@ -4166,8 +4159,7 @@ void DrawHallOfFame(int highlight_position)
   /* needed if different viewport properties defined for scores */
   ChangeViewportPropertiesIfNeeded();
 
   /* needed if different viewport properties defined for scores */
   ChangeViewportPropertiesIfNeeded();
 
-  PlayMenuSound();
-  PlayMenuMusic();
+  PlayMenuSoundsAndMusic();
 
   OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
 
 
   OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
 
@@ -5781,7 +5773,7 @@ static void DrawSetupScreen_Generic()
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
     fade_mask = REDRAW_ALL;
 
   UnmapAllGadgets();
-  FadeSoundsAndMusic();
+  FadeMenuSoundsAndMusic();
 
   FreeScreenGadgets();
   CreateScreenGadgets();
 
   FreeScreenGadgets();
   CreateScreenGadgets();
@@ -6538,8 +6530,7 @@ void DrawSetupScreen()
   else
     DrawSetupScreen_Generic();
 
   else
     DrawSetupScreen_Generic();
 
-  PlayMenuSound();
-  PlayMenuMusic();
+  PlayMenuSoundsAndMusic();
 }
 
 void RedrawSetupScreenAfterFullscreenToggle()
 }
 
 void RedrawSetupScreenAfterFullscreenToggle()
index e99d26ce169ad18c33f601c674a684d6165ff0d6..9b573f66c2c2bbebb0880b9d882808ce1135d4e0 100644 (file)
@@ -8401,6 +8401,17 @@ void PlayMenuMusic()
   PlayMenuMusicExt(menu.music[game_status]);
 }
 
   PlayMenuMusicExt(menu.music[game_status]);
 }
 
+void PlayMenuSoundsAndMusic()
+{
+  PlayMenuSound();
+  PlayMenuMusic();
+}
+
+void FadeMenuSoundsAndMusic()
+{
+  FadeSoundsAndMusic();
+}
+
 void PlaySoundActivating()
 {
 #if 0
 void PlaySoundActivating()
 {
 #if 0
index c8d351df3298b947a8bf2978d5ace52220c91431..b267c8bfd1dce3911f5994766bbdd5a3c5c96ae9 100644 (file)
@@ -253,6 +253,8 @@ void PlayMenuSoundIfLoopExt(int);
 void PlayMenuSoundIfLoop();
 void PlayMenuMusicExt(int);
 void PlayMenuMusic();
 void PlayMenuSoundIfLoop();
 void PlayMenuMusicExt(int);
 void PlayMenuMusic();
+void PlayMenuSoundsAndMusic();
+void FadeMenuSoundsAndMusic();
 void PlaySoundActivating();
 void PlaySoundSelecting();
 
 void PlaySoundActivating();
 void PlaySoundSelecting();