-1,
MUS_BACKGROUND
},
+ {
+ GFX_SPECIAL_ARG_TITLE_INITIAL,
+ MUS_BACKGROUND_TITLE_INITIAL
+ },
{
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_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
}
gamemode_to_sound[] =
{
+ {
+ GFX_SPECIAL_ARG_TITLE_INITIAL,
+ SND_BACKGROUND_TITLE_INITIAL
+ },
{
GFX_SPECIAL_ARG_TITLE,
SND_BACKGROUND_TITLE
},
+ {
+ GFX_SPECIAL_ARG_MESSAGE_INITIAL,
+ SND_BACKGROUND_MESSAGE_INITIAL
+ },
{
GFX_SPECIAL_ARG_MESSAGE,
SND_BACKGROUND_MESSAGE
struct ConfigInfo music_config[] =
{
{ "background", UNDEFINED_FILENAME },
+ { "background.TITLE_INITIAL", UNDEFINED_FILENAME },
{ "background.TITLE", UNDEFINED_FILENAME },
+ { "background.MESSAGE_INITIAL", UNDEFINED_FILENAME },
{ "background.MESSAGE", UNDEFINED_FILENAME },
{ "background.MAIN", UNDEFINED_FILENAME },
{ "background.LEVELS", UNDEFINED_FILENAME },
/* 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 */
{ "menu.item.activating", "empty.wav" },
{ "menu.item.selecting", "base.wav" },
+ { "background.TITLE_INITIAL", UNDEFINED_FILENAME },
{ "background.TITLE", UNDEFINED_FILENAME },
+ { "background.MESSAGE_INITIAL", UNDEFINED_FILENAME },
{ "background.MESSAGE", UNDEFINED_FILENAME },
{ "background.MAIN", UNDEFINED_FILENAME },
{ "background.LEVELS", UNDEFINED_FILENAME },
#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 */
-#define COMPILE_DATE_STRING "2007-03-16 01:17"
+#define COMPILE_DATE_STRING "2007-03-17 21:32"
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()
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;
free(basepath);
free(basename);
free(filename_include);
+
+ include_count++;
}
else
{
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)
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);
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 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 use_cross_fading = !show_title_initial; /* default */
#endif
struct TitleControlInfo *tci;
+ int sound, music;
if (button == MB_MENU_INITIALIZE)
{
+#if 0
int last_game_status = game_status; /* save current game status */
+#endif
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();
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);
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);
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();
+ else
+ FadeOut(REDRAW_ALL);
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
#endif
}
-void PlayMenuSound()
+void PlayMenuSoundExt(int sound)
{
- int sound = menu.sound[game_status];
-
if (sound == SND_UNDEFINED)
return;
PlaySound(sound);
}
+void PlayMenuSound()
+{
+ PlayMenuSoundExt(menu.sound[game_status]);
+}
+
void PlayMenuSoundStereo(int sound, int stereo_position)
{
if (sound == SND_UNDEFINED)
PlaySoundStereo(sound, stereo_position);
}
-void PlayMenuSoundIfLoop()
+void PlayMenuSoundIfLoopExt(int sound)
{
- int sound = menu.sound[game_status];
-
if (sound == SND_UNDEFINED)
return;
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;
PlayMusic(music);
}
+void PlayMenuMusic()
+{
+ PlayMenuMusicExt(menu.music[game_status]);
+}
+
void PlaySoundActivating()
{
#if 0
unsigned int InitRND(long);
void InitGraphicInfo_EM(void);
+void PlayMenuSoundExt(int);
void PlayMenuSound();
void PlayMenuSoundStereo(int, int);
+void PlayMenuSoundIfLoopExt(int);
void PlayMenuSoundIfLoop();
+void PlayMenuMusicExt(int);
void PlayMenuMusic();
void PlaySoundActivating();
void PlaySoundSelecting();