rnd-20031116-2-src
authorHolger Schemel <info@artsoft.org>
Sun, 16 Nov 2003 18:14:18 +0000 (19:14 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:44:35 +0000 (10:44 +0200)
14 files changed:
src/Makefile
src/conf_g2m.c [new file with mode: 0644]
src/conf_g2s.c [new file with mode: 0644]
src/conf_mus.c
src/conf_mus.h
src/conf_snd.c
src/conf_snd.h
src/conftime.h
src/game.c
src/init.c
src/libgame/sound.c
src/main.c
src/main.h
src/screens.c

index dd6896bf53b9e7fee6491fe1431495fd3a87f080..2aa08a2e4ecfabea77daa109f4e6df4ccd58a40c 100644 (file)
@@ -176,7 +176,9 @@ CNFS =      conf_gfx.h      \
        conf_e2g.c      \
        conf_esg.c      \
        conf_e2s.c      \
-       conf_fnt.c
+       conf_fnt.c      \
+       conf_g2s.c      \
+       conf_g2m.c
 
 CNFS_CMD = ../Scripts/create_element_defs.pl
 
diff --git a/src/conf_g2m.c b/src/conf_g2m.c
new file mode 100644 (file)
index 0000000..1c18645
--- /dev/null
@@ -0,0 +1,63 @@
+/***********************************************************
+* Rocks'n'Diamonds -- McDuffin Strikes Back!               *
+*----------------------------------------------------------*
+* (c) 1995-2002 Artsoft Entertainment                      *
+*               Holger Schemel                             *
+*               Detmolder Strasse 189                      *
+*               33604 Bielefeld                            *
+*               Germany                                    *
+*               e-mail: info@artsoft.org                   *
+*----------------------------------------------------------*
+* conf_g2m.c                                               *
+***********************************************************/
+
+/* ----- this file was automatically generated -- do not edit by hand ----- */
+
+#ifndef CONF_G2M_C
+#define CONF_G2M_C
+
+/* values for gamemode/music mapping configuration */
+
+static struct
+{
+  int gamemode;
+
+  int music;
+}
+gamemode_to_music[] =
+{
+  {
+    -1,
+    MUS_BACKGROUND
+  },
+  {
+    GFX_SPECIAL_ARG_MAIN,
+    MUS_BACKGROUND_MAIN
+  },
+  {
+    GFX_SPECIAL_ARG_LEVELS,
+    MUS_BACKGROUND_LEVELS
+  },
+  {
+    GFX_SPECIAL_ARG_SCORES,
+    MUS_BACKGROUND_SCORES
+  },
+  {
+    GFX_SPECIAL_ARG_EDITOR,
+    MUS_BACKGROUND_EDITOR
+  },
+  {
+    GFX_SPECIAL_ARG_INFO,
+    MUS_BACKGROUND_INFO
+  },
+  {
+    GFX_SPECIAL_ARG_SETUP,
+    MUS_BACKGROUND_SETUP
+  },
+  {
+    -1,
+    -1
+  },
+};
+
+#endif /* CONF_G2M_C */
diff --git a/src/conf_g2s.c b/src/conf_g2s.c
new file mode 100644 (file)
index 0000000..7ebfff0
--- /dev/null
@@ -0,0 +1,59 @@
+/***********************************************************
+* Rocks'n'Diamonds -- McDuffin Strikes Back!               *
+*----------------------------------------------------------*
+* (c) 1995-2002 Artsoft Entertainment                      *
+*               Holger Schemel                             *
+*               Detmolder Strasse 189                      *
+*               33604 Bielefeld                            *
+*               Germany                                    *
+*               e-mail: info@artsoft.org                   *
+*----------------------------------------------------------*
+* conf_g2s.c                                               *
+***********************************************************/
+
+/* ----- this file was automatically generated -- do not edit by hand ----- */
+
+#ifndef CONF_G2S_C
+#define CONF_G2S_C
+
+/* values for gamemode/sound mapping configuration */
+
+static struct
+{
+  int gamemode;
+
+  int sound;
+}
+gamemode_to_sound[] =
+{
+  {
+    GFX_SPECIAL_ARG_MAIN,
+    SND_BACKGROUND_MAIN
+  },
+  {
+    GFX_SPECIAL_ARG_LEVELS,
+    SND_BACKGROUND_LEVELS
+  },
+  {
+    GFX_SPECIAL_ARG_SCORES,
+    SND_BACKGROUND_SCORES
+  },
+  {
+    GFX_SPECIAL_ARG_EDITOR,
+    SND_BACKGROUND_EDITOR
+  },
+  {
+    GFX_SPECIAL_ARG_INFO,
+    SND_BACKGROUND_INFO
+  },
+  {
+    GFX_SPECIAL_ARG_SETUP,
+    SND_BACKGROUND_SETUP
+  },
+  {
+    -1,
+    -1
+  },
+};
+
+#endif /* CONF_G2S_C */
index 6fe7f9da1502414f8c484584d7653bfb23626393..469c7ed90900c2b4eb8cc9077786426ee085d516 100644 (file)
@@ -35,7 +35,10 @@ struct ConfigInfo music_config[] =
   { "background.EDITOR",               UNDEFINED_FILENAME      },
   { "background.INFO",                 "rhythmloop.wav"        },
   { "background.SETUP",                        UNDEFINED_FILENAME      },
-  { "background.PLAYING",              UNDEFINED_FILENAME      },
+
+  /* there is no definition for "background.PLAYING", because this would
+     prevent selecting music from music directory that is not defined in
+     "musicinfo.conf", when no default music is defined here */
 
   { NULL,                              NULL                    }
 };
index ea12090f4dc9e433ae5f7a10a223369a4fadc802..e6ba90e908cc49d94e218817823a7906475a7d96 100644 (file)
@@ -25,8 +25,7 @@
 #define MUS_BACKGROUND_EDITOR                          4
 #define MUS_BACKGROUND_INFO                            5
 #define MUS_BACKGROUND_SETUP                           6
-#define MUS_BACKGROUND_PLAYING                         7
 
-#define NUM_MUSIC_FILES                                        8
+#define NUM_MUSIC_FILES                                        7
 
 #endif /* CONF_MUS_H */
index 2a2d65af68b5a616b0b1ffcae77c0c940a9fee1a..9d028a5adbfb0afa24e56d134582690e61fd5a24 100644 (file)
@@ -232,11 +232,13 @@ struct ConfigInfo sound_config[] =
   { "door.opening",                    "oeffnen.wav"           },
   { "door.closing",                    "oeffnen.wav"           },
 
+  { "background.MAIN",                 UNDEFINED_FILENAME      },
+  { "background.LEVELS",               UNDEFINED_FILENAME      },
   { "background.SCORES",               "halloffame.wav"        },
   { "background.SCORES.mode_loop",     "false"                 },
-
-  { "background.INFO",                 "rhythmloop.wav"        },
-  { "background.INFO.mode_loop",       "true"                  },
+  { "background.EDITOR",               UNDEFINED_FILENAME      },
+  { "background.INFO",                 UNDEFINED_FILENAME      },
+  { "background.SETUP",                        UNDEFINED_FILENAME      },
 
 #if 0
   { "[not used]",                      "antigrav.wav"          },
index 7cf2f25eb9742e23cf1747aefafd3f11a10fee28..10abc084cd9974fdac403d3f53a22a9e0c650527 100644 (file)
 #define SND_GAME_SOKOBAN_SOLVING                       174
 #define SND_DOOR_OPENING                               175
 #define SND_DOOR_CLOSING                               176
-#define SND_BACKGROUND_SCORES                          177
-#define SND_BACKGROUND_INFO                            178
+#define SND_BACKGROUND_MAIN                            177
+#define SND_BACKGROUND_LEVELS                          178
+#define SND_BACKGROUND_SCORES                          179
+#define SND_BACKGROUND_EDITOR                          180
+#define SND_BACKGROUND_INFO                            181
+#define SND_BACKGROUND_SETUP                           182
 
-#define NUM_SOUND_FILES                                        179
+#define NUM_SOUND_FILES                                        183
 
 #endif /* CONF_SND_H */
index a2246cbf8762f065d515d3be161ebec5bf6d8354..1199c31b5990f982319261b95b4ae400cbc08e4e 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-11-16 04:25]"
+#define COMPILE_DATE_STRING "[2003-11-16 19:11]"
index 27aa2b4074d6446d47c63875bd3f630e1268a93f..1ddc793700ca7baa57e99ad01ce242fa9fc44420 100644 (file)
@@ -8610,10 +8610,10 @@ static void StopLevelSoundActionIfLoop(int x, int y, int action)
 static void PlayLevelMusic()
 {
 #if 1
-  if (levelset.music[game_status][level_nr] != MUS_UNDEFINED)
-    PlayMusic(levelset.music[game_status][level_nr]);
+  if (levelset.music[level_nr] != MUS_UNDEFINED)
+    PlayMusic(levelset.music[level_nr]);       /* from config file */
   else
-    PlayMusic(-(level_nr + 1));
+    PlayMusic(-(level_nr + 1));                        /* from music dir */
 #else
   PlayMusic(level_nr);
 #endif
index 301f0022ad53f499e762dc15bd04eec51a22984b..c0e3fce0f4b15e05c26ab701cc4bf76dab399e2c 100644 (file)
@@ -30,6 +30,8 @@
 #include "conf_esg.c"  /* include auto-generated data structure definitions */
 #include "conf_e2s.c"  /* include auto-generated data structure definitions */
 #include "conf_fnt.c"  /* include auto-generated data structure definitions */
+#include "conf_g2s.c"  /* include auto-generated data structure definitions */
+#include "conf_g2m.c"  /* include auto-generated data structure definitions */
 
 
 #define CONFIG_TOKEN_FONT_INITIAL              "font.initial"
@@ -1183,6 +1185,39 @@ static void InitElementSoundInfo()
   }
 }
 
+static void InitGameModeSoundInfo()
+{
+  int i;
+
+  /* set values to -1 to identify later as "uninitialized" values */
+  for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++)
+    menu.sound[i] = -1;
+
+  /* initialize gamemode/sound mapping from static configuration */
+  for (i=0; gamemode_to_sound[i].sound > -1; i++)
+  {
+    int gamemode = gamemode_to_sound[i].gamemode;
+    int sound    = gamemode_to_sound[i].sound;
+
+    if (gamemode < 0)
+      gamemode = GAME_MODE_DEFAULT;
+
+    menu.sound[gamemode] = sound;
+  }
+
+  /* now set all '-1' values to levelset specific default values */
+  for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++)
+    if (menu.sound[i] == -1)
+      menu.sound[i] = menu.sound[GAME_MODE_DEFAULT];
+
+#if 0
+  /* TEST ONLY */
+  for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++)
+    if (menu.sound[i] != -1)
+      printf("::: menu.sound[%d] == %d\n", i, menu.sound[i]);
+#endif
+}
+
 static void set_sound_parameters(int sound, char **parameter_raw)
 {
   int parameter[NUM_SND_ARGS];
@@ -1335,34 +1370,34 @@ static void InitSoundInfo()
 #endif
 }
 
-static void InitLevelsetMusicInfo()
+static void InitGameModeMusicInfo()
 {
   struct PropertyMapping *property_mapping = getMusicListPropertyMapping();
   int num_property_mappings = getMusicListPropertyMappingSize();
-  int i, j;
+  int default_levelset_music = -1;
+  int i;
 
   /* set values to -1 to identify later as "uninitialized" values */
+  for (i=0; i < MAX_LEVELS; i++)
+    levelset.music[i] = -1;
   for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++)
-    for (j=0; j < MAX_LEVELS; j++)
-      levelset.music[i][j] = -1;
+    menu.music[i] = -1;
 
-#if 0
   /* initialize gamemode/music mapping from static configuration */
-  for (i=0; gamemode_to_music[i].element > -1; i++)
+  for (i=0; gamemode_to_music[i].music > -1; i++)
   {
     int gamemode = gamemode_to_music[i].gamemode;
-    int level    = gamemode_to_music[i].level;
     int music    = gamemode_to_music[i].music;
 
-    if (gamemode < 0)
-      gamemode = 0;
+#if 0
+    printf("::: gamemode == %d, music == %d\n", gamemode, music);
+#endif
 
-    if (level < 0)
-      level = 0;
+    if (gamemode < 0)
+      gamemode = GAME_MODE_DEFAULT;
 
-    levelset.music[gamemode][level] = music;
+    menu.music[gamemode] = music;
   }
-#endif
 
   /* initialize gamemode/music mapping from dynamic configuration */
   for (i=0; i < num_property_mappings; i++)
@@ -1372,39 +1407,51 @@ static void InitLevelsetMusicInfo()
     int level    = property_mapping[i].ext2_index;
     int music    = property_mapping[i].artwork_index;
 
+#if 0
+    printf("::: prefix == %d, gamemode == %d, level == %d, music == %d\n",
+          prefix, gamemode, level, music);
+#endif
+
     if (prefix < 0 || prefix >= NUM_MUSIC_PREFIXES)
       continue;
 
     if (gamemode < 0)
-      gamemode = 0;
+      gamemode = GAME_MODE_DEFAULT;
 
-    if (level < 0)
+    /* level specific music only allowed for in-game music */
+    if (level != -1 && gamemode == GAME_MODE_DEFAULT)
+      gamemode = GAME_MODE_PLAYING;
+
+    if (level == -1)
+    {
       level = 0;
+      default_levelset_music = music;
+    }
 
-    levelset.music[gamemode][level] = music;
+    if (gamemode == GAME_MODE_PLAYING || gamemode == GAME_MODE_DEFAULT)
+      levelset.music[level] = music;
+    if (gamemode != GAME_MODE_PLAYING)
+      menu.music[gamemode] = music;
   }
 
-  /* now set all '-1' values to levelset specific default values */
+  /* now set all '-1' values to menu specific default values */
+  /* (undefined values of "levelset.music[]" might stay at "-1" to
+     allow dynamic selection of music files from music directory!) */
+  for (i=0; i < MAX_LEVELS; i++)
+    if (levelset.music[i] == -1)
+      levelset.music[i] = default_levelset_music;
   for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++)
-  {
-    for (j=0; j < MAX_LEVELS; j++)
-    {
-      /* generic default music */
-      int default_music = levelset.music[i][0];                /* may still be -1 */
-
-      /* no music for this specific game mode and level -- use default music */
-      if (levelset.music[i][j] == -1)
-       levelset.music[i][j] = default_music;
-    }
-  }
+    if (menu.music[i] == -1)
+      menu.music[i] = menu.music[GAME_MODE_DEFAULT];
 
 #if 0
   /* TEST ONLY */
+  for (i=0; i < MAX_LEVELS; i++)
+    if (levelset.music[i] != -1)
+      printf("::: levelset.music[%d] == %d\n", i, levelset.music[i]);
   for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++)
-    for (j=0; j < MAX_LEVELS; j++)
-      if (levelset.music[i][j] != -1)
-       printf("::: levelset.music[%d][%d] == %d\n",
-              i, j, levelset.music[i][j]);
+    if (menu.music[i] != -1)
+      printf("::: menu.music[%d] == %d\n", i, menu.music[i]);
 #endif
 }
 
@@ -1481,6 +1528,7 @@ static void ReinitializeSounds()
 {
   InitSoundInfo();             /* sound properties mapping */
   InitElementSoundInfo();      /* element game sound mapping */
+  InitGameModeSoundInfo();     /* game mode sound mapping */
 
   InitPlayLevelSound();                /* internal game sound settings */
 }
@@ -1488,7 +1536,7 @@ static void ReinitializeSounds()
 static void ReinitializeMusic()
 {
   InitMusicInfo();             /* music properties mapping */
-  InitLevelsetMusicInfo();     /* levelset music mapping */
+  InitGameModeMusicInfo();     /* game mode music mapping */
 }
 
 void InitElementPropertiesStatic()
index 8b01135fea198c280f2a42e600ce668bbdf12b20..0e38c41961ad1fb4831d02eda3c3b1c8a45256f4 100644 (file)
@@ -870,7 +870,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl)
   }
   else
   {
-    if (snd_ctrl.nr >= num_sounds)
+    if (snd_ctrl.nr < 0 || snd_ctrl.nr >= num_sounds)
       return;
 
     snd_info = getSoundInfoEntryFromSoundID(snd_ctrl.nr);
@@ -1866,6 +1866,20 @@ static void *Load_MOD(char *filename)
 #endif
 }
 
+static void *Load_WAV_or_MOD(char *filename)
+{
+  char *basename = strrchr(filename, '/');
+
+  basename = (basename != NULL ? basename + 1 : filename);
+
+  if (FileIsSound(basename))
+    return Load_WAV(filename);
+  else if (FileIsMusic(basename))
+    return Load_MOD(filename);
+  else
+    return NULL;
+}
+
 void LoadCustomMusic_NoConf(void)
 {
   static boolean draw_init_text = TRUE;                /* only draw at startup */
@@ -2183,7 +2197,7 @@ void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries,
 
   /* ---------- initialize artwork loading/freeing functions ---------- */
 
-  music_info->load_artwork = Load_MOD;
+  music_info->load_artwork = Load_WAV_or_MOD;
   music_info->free_artwork = FreeMusic;
 }
 
index 076c334f0c655eb4b4767c7bd3456bfdc89d55c0..83a9f6c60b3444692e1b4b1177e2a620d24afc60 100644 (file)
@@ -3727,8 +3727,9 @@ struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS + 1] =
   { NULL,              0                               }
 };
 
-struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
+struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
 {
+  { ".[DEFAULT]",      GAME_MODE_DEFAULT,              },
   { ".MAIN",           GAME_MODE_MAIN,                 },
   { ".LEVELS",         GAME_MODE_LEVELS                },
   { ".SCORES",         GAME_MODE_SCORES,               },
@@ -3740,6 +3741,9 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
   { ".PREVIEW",                GAME_MODE_PSEUDO_PREVIEW,       },
   { ".CRUMBLED",       GAME_MODE_PSEUDO_CRUMBLED,      },
 
+  /* empty suffix always matches -- check as last entry in InitMusicInfo() */
+  { "",                        GAME_MODE_DEFAULT,              },
+
   { NULL,              0,                              }
 };
 
index 801fec4b57aaae774b4af7f54e13793b23eb19a0..b3a28ffa772454a7ed0e0add2e10873d2a4b1260 100644 (file)
 #define NUM_ACTIONS                            34
 
 /* values for special image configuration suffixes (must match game mode) */
-#define GFX_SPECIAL_ARG_MAIN                   0
-#define GFX_SPECIAL_ARG_LEVELS                 1
-#define GFX_SPECIAL_ARG_SCORES                 2
-#define GFX_SPECIAL_ARG_EDITOR                 3
-#define GFX_SPECIAL_ARG_INFO                   4
-#define GFX_SPECIAL_ARG_SETUP                  5
-#define GFX_SPECIAL_ARG_PLAYING                        6
-#define GFX_SPECIAL_ARG_DOOR                   7
-#define GFX_SPECIAL_ARG_PREVIEW                        8
-#define GFX_SPECIAL_ARG_CRUMBLED               9
+#define GFX_SPECIAL_ARG_DEFAULT                        0
+#define GFX_SPECIAL_ARG_MAIN                   1
+#define GFX_SPECIAL_ARG_LEVELS                 2
+#define GFX_SPECIAL_ARG_SCORES                 3
+#define GFX_SPECIAL_ARG_EDITOR                 4
+#define GFX_SPECIAL_ARG_INFO                   5
+#define GFX_SPECIAL_ARG_SETUP                  6
+#define GFX_SPECIAL_ARG_PLAYING                        7
+#define GFX_SPECIAL_ARG_DOOR                   8
+#define GFX_SPECIAL_ARG_PREVIEW                        9
+#define GFX_SPECIAL_ARG_CRUMBLED               10
 
-#define NUM_SPECIAL_GFX_ARGS                   10
+#define NUM_SPECIAL_GFX_ARGS                   11
 
 
 /* values for image configuration suffixes */
 #define NUM_INITIAL_FONTS                      4
 
 /* values for game_status (must match special image configuration suffixes) */
-#define GAME_MODE_MAIN                         0
-#define GAME_MODE_LEVELS                       1
-#define GAME_MODE_SCORES                       2
-#define GAME_MODE_EDITOR                       3
-#define GAME_MODE_INFO                         4
-#define GAME_MODE_SETUP                                5
-#define GAME_MODE_PLAYING                      6
-#define GAME_MODE_PSEUDO_DOOR                  7
-#define GAME_MODE_PSEUDO_PREVIEW               8
-#define GAME_MODE_PSEUDO_CRUMBLED              9
+#define GAME_MODE_DEFAULT                      0
+#define GAME_MODE_MAIN                         1
+#define GAME_MODE_LEVELS                       2
+#define GAME_MODE_SCORES                       3
+#define GAME_MODE_EDITOR                       4
+#define GAME_MODE_INFO                         5
+#define GAME_MODE_SETUP                                6
+#define GAME_MODE_PLAYING                      7
+#define GAME_MODE_PSEUDO_DOOR                  8
+#define GAME_MODE_PSEUDO_PREVIEW               9
+#define GAME_MODE_PSEUDO_CRUMBLED              10
 
 /* there are no special config file suffixes for these modes */
-#define GAME_MODE_PSEUDO_TYPENAME              10
-#define GAME_MODE_QUIT                         11
+#define GAME_MODE_PSEUDO_TYPENAME              11
+#define GAME_MODE_QUIT                         12
 
 /* special definitions currently only used for custom artwork configuration */
+#define MUSIC_PREFIX_BACKGROUND                        0
 #define NUM_MUSIC_PREFIXES                     1
 #define MAX_LEVELS                             1000
 
@@ -1120,6 +1123,9 @@ struct MenuInfo
 
   int list_size_default;
   int list_size[NUM_SPECIAL_GFX_ARGS];
+
+  int sound[NUM_SPECIAL_GFX_ARGS];
+  int music[NUM_SPECIAL_GFX_ARGS];
 };
 
 struct DoorInfo
@@ -1198,7 +1204,7 @@ struct PlayerInfo
 
 struct LevelSetInfo
 {
-  int music[NUM_SPECIAL_GFX_ARGS][MAX_LEVELS];
+  int music[MAX_LEVELS];
 };
 
 struct LevelInfo
index 97eabb96539c21c9390ff67fbe21acff3c85f68c..d82f3bd25be8284036384bbf8ac5ef113e914b8d 100644 (file)
@@ -139,20 +139,40 @@ static void drawChooseTreeCursor(int ypos, int color)
   game_status = last_game_status;      /* restore current game status */
 }
 
-static void PlaySound_Menu_Start(int sound)
+static void PlayMenuSound()
 {
+  int sound = menu.sound[game_status];
+
+  if (sound == SND_UNDEFINED)
+    return;
+
   if (sound_info[sound].loop)
     PlaySoundLoop(sound);
   else
     PlaySound(sound);
 }
 
-static void PlaySound_Menu_Continue(int sound)
+static void PlayMenuSoundIfLoop()
 {
+  int sound = menu.sound[game_status];
+
+  if (sound == SND_UNDEFINED)
+    return;
+
   if (sound_info[sound].loop)
     PlaySoundLoop(sound);
 }
 
+static void PlayMenuMusic()
+{
+  int music = menu.music[game_status];
+
+  if (music == MUS_UNDEFINED)
+    return;
+
+  PlayMusic(music);
+}
+
 void DrawHeadline()
 {
   int text1_width = getTextWidth(PROGRAM_TITLE_STRING,     FONT_TITLE_1);
@@ -294,6 +314,9 @@ void DrawMainMenu()
     LoadTape(level_nr);
   DrawCompleteVideoDisplay();
 
+  PlayMenuSound();
+  PlayMenuMusic();
+
   OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
 
 #if 0
@@ -1063,16 +1086,8 @@ void DrawHelpScreen()
   FadeToFront();
   InitAnimation();
 
-#if 1
-  PlaySound(SND_BACKGROUND_INFO);
-  PlayMusic(MUS_BACKGROUND_INFO);
-#else
-#if 0
-  PlaySoundLoop(SND_BACKGROUND_INFO);
-#else
-  PlaySound_Menu_Start(SND_BACKGROUND_INFO);
-#endif
-#endif
+  PlayMenuSound();
+  PlayMenuMusic();
 }
 
 void HandleHelpScreen(int button)
@@ -1129,16 +1144,7 @@ void HandleHelpScreen(int button)
        DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS);
     }
 
-    /* !!! workaround for playing "music" that is really a sound loop (and
-       must therefore periodically be reactivated with the current sound
-       engine !!! */
-#if 0
-#if 0
-    PlaySoundLoop(SND_BACKGROUND_INFO);
-#else
-    PlaySound_Menu_Continue(SND_BACKGROUND_INFO);
-#endif
-#endif
+    PlayMenuSoundIfLoop();
   }
 
   DoAnimation();
@@ -1556,6 +1562,9 @@ void DrawChooseLevel()
   SetMainBackgroundImage(IMG_BACKGROUND_LEVELS);
 
   DrawChooseTree(&leveldir_current);
+
+  PlayMenuSound();
+  PlayMenuMusic();
 }
 
 void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
@@ -1580,16 +1589,8 @@ void DrawHallOfFame(int highlight_position)
 
   HandleHallOfFame(highlight_position,0, 0,0, MB_MENU_INITIALIZE);
 
-#if 1
-  PlaySound(SND_BACKGROUND_SCORES);
-  PlayMusic(MUS_BACKGROUND_SCORES);
-#else
-#if 0
-  PlaySound(SND_BACKGROUND_SCORES);
-#else
-  PlaySound_Menu_Start(SND_BACKGROUND_SCORES);
-#endif
-#endif
+  PlayMenuSound();
+  PlayMenuMusic();
 }
 
 static void drawHallOfFameList(int first_entry, int highlight_position)
@@ -1674,12 +1675,8 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
     DrawMainMenu();
   }
 
-#if 0
-#if 1
   if (game_status == GAME_MODE_SCORES)
-    PlaySound_Menu_Continue(SND_BACKGROUND_SCORES);
-#endif
-#endif
+    PlayMenuSoundIfLoop();
 
   DoAnimation();
   BackToFront();
@@ -2780,6 +2777,9 @@ void DrawSetupScreen()
     DrawChooseTree(&artwork.mus_current);
   else
     DrawSetupScreen_Generic();
+
+  PlayMenuSound();
+  PlayMenuMusic();
 }
 
 void HandleSetupScreen(int mx, int my, int dx, int dy, int button)