rnd-20070318-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 18 Mar 2007 10:02:00 +0000 (11:02 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:57 +0000 (10:54 +0200)
12 files changed:
src/conf_g2m.c
src/conf_g2s.c
src/conf_mus.c
src/conf_mus.h
src/conf_snd.c
src/conf_snd.h
src/conftime.h
src/init.c
src/libgame/setup.c
src/screens.c
src/tools.c
src/tools.h

index f1ba07544a15d19a00e057f05a003c76e2664a3a..754145b8a348df73fdd351ecb50c641aef7d9fd1 100644 (file)
@@ -30,10 +30,18 @@ gamemode_to_music[] =
     -1,
     MUS_BACKGROUND
   },
     -1,
     MUS_BACKGROUND
   },
+  {
+    GFX_SPECIAL_ARG_TITLE_INITIAL,
+    MUS_BACKGROUND_TITLE_INITIAL
+  },
   {
     GFX_SPECIAL_ARG_TITLE,
     MUS_BACKGROUND_TITLE
   },
   {
     GFX_SPECIAL_ARG_TITLE,
     MUS_BACKGROUND_TITLE
   },
+  {
+    GFX_SPECIAL_ARG_MESSAGE_INITIAL,
+    MUS_BACKGROUND_MESSAGE_INITIAL
+  },
   {
     GFX_SPECIAL_ARG_MESSAGE,
     MUS_BACKGROUND_MESSAGE
   {
     GFX_SPECIAL_ARG_MESSAGE,
     MUS_BACKGROUND_MESSAGE
@@ -62,86 +70,6 @@ gamemode_to_music[] =
     GFX_SPECIAL_ARG_SETUP,
     MUS_BACKGROUND_SETUP
   },
     GFX_SPECIAL_ARG_SETUP,
     MUS_BACKGROUND_SETUP
   },
-  {
-    -1,
-    MUS_TITLESCREEN_INITIAL_1
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_INITIAL_2
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_INITIAL_3
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_INITIAL_4
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_INITIAL_5
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_1
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_2
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_3
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_4
-  },
-  {
-    -1,
-    MUS_TITLESCREEN_5
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_INITIAL_1
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_INITIAL_2
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_INITIAL_3
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_INITIAL_4
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_INITIAL_5
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_1
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_2
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_3
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_4
-  },
-  {
-    -1,
-    MUS_TITLEMESSAGE_5
-  },
   {
     -1,
     -1
   {
     -1,
     -1
index f38fe7fef3ea61ee08e02eec43c8e43feac1eb71..6f9ba392690ae308da1d91e684ea58beadf84a0f 100644 (file)
@@ -26,10 +26,18 @@ static struct
 }
 gamemode_to_sound[] =
 {
 }
 gamemode_to_sound[] =
 {
+  {
+    GFX_SPECIAL_ARG_TITLE_INITIAL,
+    SND_BACKGROUND_TITLE_INITIAL
+  },
   {
     GFX_SPECIAL_ARG_TITLE,
     SND_BACKGROUND_TITLE
   },
   {
     GFX_SPECIAL_ARG_TITLE,
     SND_BACKGROUND_TITLE
   },
+  {
+    GFX_SPECIAL_ARG_MESSAGE_INITIAL,
+    SND_BACKGROUND_MESSAGE_INITIAL
+  },
   {
     GFX_SPECIAL_ARG_MESSAGE,
     SND_BACKGROUND_MESSAGE
   {
     GFX_SPECIAL_ARG_MESSAGE,
     SND_BACKGROUND_MESSAGE
index c47a5c885cab9befba6b89f755a337805fc1ce55..ac4fa911345d8a8432672f2e4d87c4d0a7643e88 100644 (file)
@@ -29,7 +29,9 @@ struct ConfigTypeInfo music_config_suffix[] =
 struct ConfigInfo music_config[] =
 {
   { "background",                      UNDEFINED_FILENAME              },
 struct ConfigInfo music_config[] =
 {
   { "background",                      UNDEFINED_FILENAME              },
+  { "background.TITLE_INITIAL",                UNDEFINED_FILENAME              },
   { "background.TITLE",                        UNDEFINED_FILENAME              },
   { "background.TITLE",                        UNDEFINED_FILENAME              },
+  { "background.MESSAGE_INITIAL",      UNDEFINED_FILENAME              },
   { "background.MESSAGE",              UNDEFINED_FILENAME              },
   { "background.MAIN",                 UNDEFINED_FILENAME              },
   { "background.LEVELS",               UNDEFINED_FILENAME              },
   { "background.MESSAGE",              UNDEFINED_FILENAME              },
   { "background.MAIN",                 UNDEFINED_FILENAME              },
   { "background.LEVELS",               UNDEFINED_FILENAME              },
index ec9246399fcb8f78fc5009e86ca86153a58466a6..2ab1461e013cb843cd3167e39ea9c92a55f573cd 100644 (file)
 /* values for music configuration */
 
 #define MUS_BACKGROUND                                 0
 /* values for music configuration */
 
 #define MUS_BACKGROUND                                 0
-#define MUS_BACKGROUND_TITLE                           1
-#define MUS_BACKGROUND_MESSAGE                         2
-#define MUS_BACKGROUND_MAIN                            3
-#define MUS_BACKGROUND_LEVELS                          4
-#define MUS_BACKGROUND_SCORES                          5
-#define MUS_BACKGROUND_EDITOR                          6
-#define MUS_BACKGROUND_INFO                            7
-#define MUS_BACKGROUND_SETUP                           8
-#define MUS_TITLESCREEN_INITIAL_1                      9
-#define MUS_TITLESCREEN_INITIAL_2                      10
-#define MUS_TITLESCREEN_INITIAL_3                      11
-#define MUS_TITLESCREEN_INITIAL_4                      12
-#define MUS_TITLESCREEN_INITIAL_5                      13
-#define MUS_TITLESCREEN_1                              14
-#define MUS_TITLESCREEN_2                              15
-#define MUS_TITLESCREEN_3                              16
-#define MUS_TITLESCREEN_4                              17
-#define MUS_TITLESCREEN_5                              18
-#define MUS_TITLEMESSAGE_INITIAL_1                     19
-#define MUS_TITLEMESSAGE_INITIAL_2                     20
-#define MUS_TITLEMESSAGE_INITIAL_3                     21
-#define MUS_TITLEMESSAGE_INITIAL_4                     22
-#define MUS_TITLEMESSAGE_INITIAL_5                     23
-#define MUS_TITLEMESSAGE_1                             24
-#define MUS_TITLEMESSAGE_2                             25
-#define MUS_TITLEMESSAGE_3                             26
-#define MUS_TITLEMESSAGE_4                             27
-#define MUS_TITLEMESSAGE_5                             28
+#define MUS_BACKGROUND_TITLE_INITIAL                   1
+#define MUS_BACKGROUND_TITLE                           2
+#define MUS_BACKGROUND_MESSAGE_INITIAL                 3
+#define MUS_BACKGROUND_MESSAGE                         4
+#define MUS_BACKGROUND_MAIN                            5
+#define MUS_BACKGROUND_LEVELS                          6
+#define MUS_BACKGROUND_SCORES                          7
+#define MUS_BACKGROUND_EDITOR                          8
+#define MUS_BACKGROUND_INFO                            9
+#define MUS_BACKGROUND_SETUP                           10
+#define MUS_TITLESCREEN_INITIAL_1                      11
+#define MUS_TITLESCREEN_INITIAL_2                      12
+#define MUS_TITLESCREEN_INITIAL_3                      13
+#define MUS_TITLESCREEN_INITIAL_4                      14
+#define MUS_TITLESCREEN_INITIAL_5                      15
+#define MUS_TITLESCREEN_1                              16
+#define MUS_TITLESCREEN_2                              17
+#define MUS_TITLESCREEN_3                              18
+#define MUS_TITLESCREEN_4                              19
+#define MUS_TITLESCREEN_5                              20
+#define MUS_TITLEMESSAGE_INITIAL_1                     21
+#define MUS_TITLEMESSAGE_INITIAL_2                     22
+#define MUS_TITLEMESSAGE_INITIAL_3                     23
+#define MUS_TITLEMESSAGE_INITIAL_4                     24
+#define MUS_TITLEMESSAGE_INITIAL_5                     25
+#define MUS_TITLEMESSAGE_1                             26
+#define MUS_TITLEMESSAGE_2                             27
+#define MUS_TITLEMESSAGE_3                             28
+#define MUS_TITLEMESSAGE_4                             29
+#define MUS_TITLEMESSAGE_5                             30
 
 
-#define NUM_MUSIC_FILES                                        29
+#define NUM_MUSIC_FILES                                        31
 
 #endif /* CONF_MUS_H */
 
 #endif /* CONF_MUS_H */
index b3761601c574e600259165d34789f240243bfdbe..ea26f961361b437685ebf5509eb6e46f08704912 100644 (file)
@@ -256,7 +256,9 @@ struct ConfigInfo sound_config[] =
   { "menu.item.activating",            "empty.wav"                     },
   { "menu.item.selecting",             "base.wav"                      },
 
   { "menu.item.activating",            "empty.wav"                     },
   { "menu.item.selecting",             "base.wav"                      },
 
+  { "background.TITLE_INITIAL",                UNDEFINED_FILENAME              },
   { "background.TITLE",                        UNDEFINED_FILENAME              },
   { "background.TITLE",                        UNDEFINED_FILENAME              },
+  { "background.MESSAGE_INITIAL",      UNDEFINED_FILENAME              },
   { "background.MESSAGE",              UNDEFINED_FILENAME              },
   { "background.MAIN",                 UNDEFINED_FILENAME              },
   { "background.LEVELS",               UNDEFINED_FILENAME              },
   { "background.MESSAGE",              UNDEFINED_FILENAME              },
   { "background.MAIN",                 UNDEFINED_FILENAME              },
   { "background.LEVELS",               UNDEFINED_FILENAME              },
index 860ac5ca9cf8f0e4bc5d084caacee3afddc61513..f6059d73e4a1c4f8e7277adcb429074fad47078a 100644 (file)
 #define SND_DOOR_CLOSING                               193
 #define SND_MENU_ITEM_ACTIVATING                       194
 #define SND_MENU_ITEM_SELECTING                                195
 #define SND_DOOR_CLOSING                               193
 #define SND_MENU_ITEM_ACTIVATING                       194
 #define SND_MENU_ITEM_SELECTING                                195
-#define SND_BACKGROUND_TITLE                           196
-#define SND_BACKGROUND_MESSAGE                         197
-#define SND_BACKGROUND_MAIN                            198
-#define SND_BACKGROUND_LEVELS                          199
-#define SND_BACKGROUND_SCORES                          200
-#define SND_BACKGROUND_EDITOR                          201
-#define SND_BACKGROUND_INFO                            202
-#define SND_BACKGROUND_SETUP                           203
-#define SND_TITLESCREEN_INITIAL_1                      204
-#define SND_TITLESCREEN_INITIAL_2                      205
-#define SND_TITLESCREEN_INITIAL_3                      206
-#define SND_TITLESCREEN_INITIAL_4                      207
-#define SND_TITLESCREEN_INITIAL_5                      208
-#define SND_TITLESCREEN_1                              209
-#define SND_TITLESCREEN_2                              210
-#define SND_TITLESCREEN_3                              211
-#define SND_TITLESCREEN_4                              212
-#define SND_TITLESCREEN_5                              213
-#define SND_TITLEMESSAGE_INITIAL_1                     214
-#define SND_TITLEMESSAGE_INITIAL_2                     215
-#define SND_TITLEMESSAGE_INITIAL_3                     216
-#define SND_TITLEMESSAGE_INITIAL_4                     217
-#define SND_TITLEMESSAGE_INITIAL_5                     218
-#define SND_TITLEMESSAGE_1                             219
-#define SND_TITLEMESSAGE_2                             220
-#define SND_TITLEMESSAGE_3                             221
-#define SND_TITLEMESSAGE_4                             222
-#define SND_TITLEMESSAGE_5                             223
+#define SND_BACKGROUND_TITLE_INITIAL                   196
+#define SND_BACKGROUND_TITLE                           197
+#define SND_BACKGROUND_MESSAGE_INITIAL                 198
+#define SND_BACKGROUND_MESSAGE                         199
+#define SND_BACKGROUND_MAIN                            200
+#define SND_BACKGROUND_LEVELS                          201
+#define SND_BACKGROUND_SCORES                          202
+#define SND_BACKGROUND_EDITOR                          203
+#define SND_BACKGROUND_INFO                            204
+#define SND_BACKGROUND_SETUP                           205
+#define SND_TITLESCREEN_INITIAL_1                      206
+#define SND_TITLESCREEN_INITIAL_2                      207
+#define SND_TITLESCREEN_INITIAL_3                      208
+#define SND_TITLESCREEN_INITIAL_4                      209
+#define SND_TITLESCREEN_INITIAL_5                      210
+#define SND_TITLESCREEN_1                              211
+#define SND_TITLESCREEN_2                              212
+#define SND_TITLESCREEN_3                              213
+#define SND_TITLESCREEN_4                              214
+#define SND_TITLESCREEN_5                              215
+#define SND_TITLEMESSAGE_INITIAL_1                     216
+#define SND_TITLEMESSAGE_INITIAL_2                     217
+#define SND_TITLEMESSAGE_INITIAL_3                     218
+#define SND_TITLEMESSAGE_INITIAL_4                     219
+#define SND_TITLEMESSAGE_INITIAL_5                     220
+#define SND_TITLEMESSAGE_1                             221
+#define SND_TITLEMESSAGE_2                             222
+#define SND_TITLEMESSAGE_3                             223
+#define SND_TITLEMESSAGE_4                             224
+#define SND_TITLEMESSAGE_5                             225
 
 
-#define NUM_SOUND_FILES                                        224
+#define NUM_SOUND_FILES                                        226
 
 #endif /* CONF_SND_H */
 
 #endif /* CONF_SND_H */
index 5791a874f941ab510f20b79d4f8cf29eb9ae0a3f..cdb199ce4f9c06b844a59b837c53d550a64bd423 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-03-16 01:17"
+#define COMPILE_DATE_STRING "2007-03-17 21:32"
index c78a3420b3563908b39400bd958f299dbd429889..7ec7446a70f767802e4cfd2c7ee51ecc72948443 100644 (file)
@@ -1640,7 +1640,7 @@ static void set_sound_parameters(int sound, char **parameter_raw)
   sound_info[sound].volume = parameter[SND_ARG_VOLUME];
 
   /* sound priority to give certain sounds a higher or lower priority */
   sound_info[sound].volume = parameter[SND_ARG_VOLUME];
 
   /* sound priority to give certain sounds a higher or lower priority */
-  sound_info[sound].volume = parameter[SND_ARG_VOLUME];
+  sound_info[sound].priority = parameter[SND_ARG_PRIORITY];
 }
 
 static void InitSoundInfo()
 }
 
 static void InitSoundInfo()
index bc8a1a34740bb1b31ab92b928dfba63cffa8b8b4..373ffe33b22920782ac4b4e9ce4a2ceac1813c9c 100644 (file)
@@ -1773,8 +1773,7 @@ static boolean loadSetupFileData(void *setup_file_data, char *filename,
   void *insert_ptr = NULL;
   boolean read_continued_line = FALSE;
   FILE *file;
   void *insert_ptr = NULL;
   boolean read_continued_line = FALSE;
   FILE *file;
-  int line_nr = 0;
-  int token_count = 0;
+  int line_nr = 0, token_count = 0, include_count = 0;
 
 #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING
   token_value_separator_warning = FALSE;
 
 #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING
   token_value_separator_warning = FALSE;
@@ -1873,6 +1872,8 @@ static boolean loadSetupFileData(void *setup_file_data, char *filename,
          free(basepath);
          free(basename);
          free(filename_include);
          free(basepath);
          free(basename);
          free(filename_include);
+
+         include_count++;
        }
        else
        {
        }
        else
        {
@@ -1928,7 +1929,7 @@ static boolean loadSetupFileData(void *setup_file_data, char *filename,
     Error(ERR_INFO_LINE, "-");
 #endif
 
     Error(ERR_INFO_LINE, "-");
 #endif
 
-  if (token_count == 0)
+  if (token_count == 0 && include_count == 0)
     Error(ERR_WARN, "configuration file '%s' is empty", filename);
 
   if (top_recursion_level)
     Error(ERR_WARN, "configuration file '%s' is empty", filename);
 
   if (top_recursion_level)
index 5c194180bba5f7a2da759b2e5fa18cd2b54ce0fb..5ae63dadb26b462a20d6526db4e8dfe3f04dd793 100644 (file)
@@ -494,6 +494,13 @@ static struct TitleMessageInfo *getTitleMessageInfo(int nr, boolean initial)
   return (initial ? &titlemessage_initial[nr] : &titlemessage[nr]);
 }
 
   return (initial ? &titlemessage_initial[nr] : &titlemessage[nr]);
 }
 
+#if 0
+static int getTitleScreenGameMode(boolean initial)
+{
+  return (initial ? GAME_MODE_TITLE_INITIAL : GAME_MODE_TITLE);
+}
+#endif
+
 static int getTitleMessageGameMode(boolean initial)
 {
   return (initial ? GAME_MODE_MESSAGE_INITIAL : GAME_MODE_MESSAGE);
 static int getTitleMessageGameMode(boolean initial)
 {
   return (initial ? GAME_MODE_MESSAGE_INITIAL : GAME_MODE_MESSAGE);
@@ -509,6 +516,62 @@ static int getTitleMessageBackground(boolean initial)
   return (initial ? IMG_BACKGROUND_MESSAGE_INITIAL : IMG_BACKGROUND_MESSAGE);
 }
 
   return (initial ? IMG_BACKGROUND_MESSAGE_INITIAL : IMG_BACKGROUND_MESSAGE);
 }
 
+static int getTitleSound(int nr, boolean initial, boolean is_image)
+{
+  int mode = (is_image ?
+             (initial ? GAME_MODE_TITLE_INITIAL   : GAME_MODE_TITLE) :
+             (initial ? GAME_MODE_MESSAGE_INITIAL : GAME_MODE_MESSAGE));
+  int base = (is_image ?
+             (initial ? SND_TITLESCREEN_INITIAL_1  : SND_TITLESCREEN_1) :
+             (initial ? SND_TITLEMESSAGE_INITIAL_1 : SND_TITLEMESSAGE_1));
+
+  int sound_global = menu.sound[mode];
+  int sound_local = base + nr;
+
+#if 0
+  printf("::: %d, %d, %d: %d ['%s'], %d ['%s']\n",
+        nr, initial, is_image,
+        sound_global, getSoundListEntry(sound_global)->filename,
+        sound_local, getSoundListEntry(sound_local)->filename);
+#endif
+
+  if (!strEqual(getSoundListEntry(sound_local)->filename, UNDEFINED_FILENAME))
+    return sound_local;
+
+  if (!strEqual(getSoundListEntry(sound_global)->filename, UNDEFINED_FILENAME))
+    return sound_global;
+
+  return SND_UNDEFINED;
+}
+
+static int getTitleMusic(int nr, boolean initial, boolean is_image)
+{
+  int mode = (is_image ?
+             (initial ? GAME_MODE_TITLE_INITIAL   : GAME_MODE_TITLE) :
+             (initial ? GAME_MODE_MESSAGE_INITIAL : GAME_MODE_MESSAGE));
+  int base = (is_image ?
+             (initial ? MUS_TITLESCREEN_INITIAL_1  : MUS_TITLESCREEN_1) :
+             (initial ? MUS_TITLEMESSAGE_INITIAL_1 : MUS_TITLEMESSAGE_1));
+
+  int music_global = menu.music[mode];
+  int music_local = base + nr;
+
+#if 0
+  printf("::: %d, %d, %d: %d ['%s'], %d ['%s']\n",
+        nr, initial, is_image,
+        music_global, getMusicListEntry(music_global)->filename,
+        music_local, getMusicListEntry(music_local)->filename);
+#endif
+
+  if (!strEqual(getMusicListEntry(music_local)->filename, UNDEFINED_FILENAME))
+    return music_local;
+
+  if (!strEqual(getMusicListEntry(music_global)->filename, UNDEFINED_FILENAME))
+    return music_global;
+
+  return MUS_UNDEFINED;
+}
+
 static int compareTitleControlInfo(const void *object1, const void *object2)
 {
   const struct TitleControlInfo *tci1 = (struct TitleControlInfo *)object1;
 static int compareTitleControlInfo(const void *object1, const void *object2)
 {
   const struct TitleControlInfo *tci1 = (struct TitleControlInfo *)object1;
@@ -1307,6 +1370,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 {
   static unsigned long title_delay = 0;
   static int title_screen_nr = 0;
 {
   static unsigned long title_delay = 0;
   static int title_screen_nr = 0;
+  static int last_sound = -1, last_music = -1;
   boolean return_to_main_menu = FALSE;
   boolean use_fading_main_menu = TRUE;
 #if 1
   boolean return_to_main_menu = FALSE;
   boolean use_fading_main_menu = TRUE;
 #if 1
@@ -1315,15 +1379,21 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
   boolean use_cross_fading = !show_title_initial;              /* default */
 #endif
   struct TitleControlInfo *tci;
   boolean use_cross_fading = !show_title_initial;              /* default */
 #endif
   struct TitleControlInfo *tci;
+  int sound, music;
 
   if (button == MB_MENU_INITIALIZE)
   {
 
   if (button == MB_MENU_INITIALIZE)
   {
+#if 0
     int last_game_status = game_status;        /* save current game status */
     int last_game_status = game_status;        /* save current game status */
+#endif
 
     title_delay = 0;
     title_screen_nr = 0;
     tci = &title_controls[title_screen_nr];
 
 
     title_delay = 0;
     title_screen_nr = 0;
     tci = &title_controls[title_screen_nr];
 
+    last_sound = SND_UNDEFINED;
+    last_music = MUS_UNDEFINED;
+
 #if 0
     /* determine number of title screens to display (images and messages) */
     InitializeTitleControls();
 #if 0
     /* determine number of title screens to display (images and messages) */
     InitializeTitleControls();
@@ -1346,14 +1416,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       FadeOut(REDRAW_ALL);
     }
 
       FadeOut(REDRAW_ALL);
     }
 
-    /* force TITLE music on title info screen */
-    game_status = GAME_MODE_TITLE;
-
-    PlayMenuSound();
-    PlayMenuMusic();
-
-    game_status = last_game_status;    /* restore current game status */
-
     if (tci->is_image)
     {
       DrawTitleScreenImage(tci->local_nr, tci->initial);
     if (tci->is_image)
     {
       DrawTitleScreenImage(tci->local_nr, tci->initial);
@@ -1367,6 +1429,19 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       title.auto_delay_final = -1;
     }
 
       title.auto_delay_final = -1;
     }
 
+#if 1
+    sound = getTitleSound(tci->local_nr, tci->initial, tci->is_image);
+    music = getTitleMusic(tci->local_nr, tci->initial, tci->is_image);
+
+    if (sound != last_sound)
+      PlayMenuSoundExt(sound);
+    if (music != last_music)
+      PlayMenuMusicExt(music);
+
+    last_sound = sound;
+    last_music = music;
+#endif
+
     SetMouseCursor(CURSOR_NONE);
 
     FadeIn(REDRAW_ALL);
     SetMouseCursor(CURSOR_NONE);
 
     FadeIn(REDRAW_ALL);
@@ -1415,17 +1490,37 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
     if (title_screen_nr < num_title_screens)
     {
 
     if (title_screen_nr < num_title_screens)
     {
-      if (!use_cross_fading)
-       FadeOut(REDRAW_ALL);
+      sound = getTitleSound(tci->local_nr, tci->initial, tci->is_image);
+      music = getTitleMusic(tci->local_nr, tci->initial, tci->is_image);
+
+      if (sound == SND_UNDEFINED || sound != last_sound)
+       FadeSounds();
+      if (music == MUS_UNDEFINED || music != last_music)
+       FadeMusic();
 
       if (use_cross_fading)
        FadeCrossSaveBackbuffer();
 
       if (use_cross_fading)
        FadeCrossSaveBackbuffer();
+      else
+       FadeOut(REDRAW_ALL);
 
       if (tci->is_image)
        DrawTitleScreenImage(tci->local_nr, tci->initial);
       else
        DrawTitleScreenMessage(tci->local_nr, tci->initial);
 
 
       if (tci->is_image)
        DrawTitleScreenImage(tci->local_nr, tci->initial);
       else
        DrawTitleScreenMessage(tci->local_nr, tci->initial);
 
+#if 1
+      sound = getTitleSound(tci->local_nr, tci->initial, tci->is_image);
+      music = getTitleMusic(tci->local_nr, tci->initial, tci->is_image);
+
+      if (sound != last_sound)
+       PlayMenuSoundExt(sound);
+      if (music != last_music)
+       PlayMenuMusicExt(music);
+
+      last_sound = sound;
+      last_music = music;
+#endif
+
       if (use_cross_fading)
        FadeCross(REDRAW_ALL);
       else
       if (use_cross_fading)
        FadeCross(REDRAW_ALL);
       else
index 6529d447a61ecad013805180c6b6f7160d062450..1c261a00b951a036d28cedd0f28ba1c5466a6f2e 100644 (file)
@@ -6445,10 +6445,8 @@ void InitGraphicInfo_EM(void)
 #endif
 }
 
 #endif
 }
 
-void PlayMenuSound()
+void PlayMenuSoundExt(int sound)
 {
 {
-  int sound = menu.sound[game_status];
-
   if (sound == SND_UNDEFINED)
     return;
 
   if (sound == SND_UNDEFINED)
     return;
 
@@ -6462,6 +6460,11 @@ void PlayMenuSound()
     PlaySound(sound);
 }
 
     PlaySound(sound);
 }
 
+void PlayMenuSound()
+{
+  PlayMenuSoundExt(menu.sound[game_status]);
+}
+
 void PlayMenuSoundStereo(int sound, int stereo_position)
 {
   if (sound == SND_UNDEFINED)
 void PlayMenuSoundStereo(int sound, int stereo_position)
 {
   if (sound == SND_UNDEFINED)
@@ -6477,10 +6480,8 @@ void PlayMenuSoundStereo(int sound, int stereo_position)
     PlaySoundStereo(sound, stereo_position);
 }
 
     PlaySoundStereo(sound, stereo_position);
 }
 
-void PlayMenuSoundIfLoop()
+void PlayMenuSoundIfLoopExt(int sound)
 {
 {
-  int sound = menu.sound[game_status];
-
   if (sound == SND_UNDEFINED)
     return;
 
   if (sound == SND_UNDEFINED)
     return;
 
@@ -6492,10 +6493,13 @@ void PlayMenuSoundIfLoop()
     PlaySoundLoop(sound);
 }
 
     PlaySoundLoop(sound);
 }
 
-void PlayMenuMusic()
+void PlayMenuSoundIfLoop()
 {
 {
-  int music = menu.music[game_status];
+  PlayMenuSoundIfLoopExt(menu.sound[game_status]);
+}
 
 
+void PlayMenuMusicExt(int music)
+{
   if (music == MUS_UNDEFINED)
     return;
 
   if (music == MUS_UNDEFINED)
     return;
 
@@ -6505,6 +6509,11 @@ void PlayMenuMusic()
   PlayMusic(music);
 }
 
   PlayMusic(music);
 }
 
+void PlayMenuMusic()
+{
+  PlayMenuMusicExt(menu.music[game_status]);
+}
+
 void PlaySoundActivating()
 {
 #if 0
 void PlaySoundActivating()
 {
 #if 0
index 149d63dab023f65ecde45ae6471fbdbac7fe90f8..7cdd23a5eabdfdf6056ed98d54abac821a747299 100644 (file)
@@ -189,9 +189,12 @@ int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
 unsigned int InitRND(long);
 void InitGraphicInfo_EM(void);
 
 unsigned int InitRND(long);
 void InitGraphicInfo_EM(void);
 
+void PlayMenuSoundExt(int);
 void PlayMenuSound();
 void PlayMenuSoundStereo(int, int);
 void PlayMenuSound();
 void PlayMenuSoundStereo(int, int);
+void PlayMenuSoundIfLoopExt(int);
 void PlayMenuSoundIfLoop();
 void PlayMenuSoundIfLoop();
+void PlayMenuMusicExt(int);
 void PlayMenuMusic();
 void PlaySoundActivating();
 void PlaySoundSelecting();
 void PlayMenuMusic();
 void PlaySoundActivating();
 void PlaySoundSelecting();