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
--- /dev/null
+/***********************************************************
+* 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 */
--- /dev/null
+/***********************************************************
+* 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 */
{ "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 }
};
#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 */
{ "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" },
#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 */
-#define COMPILE_DATE_STRING "[2003-11-16 04:25]"
+#define COMPILE_DATE_STRING "[2003-11-16 19:11]"
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
#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"
}
}
+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];
#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++)
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
}
{
InitSoundInfo(); /* sound properties mapping */
InitElementSoundInfo(); /* element game sound mapping */
+ InitGameModeSoundInfo(); /* game mode sound mapping */
InitPlayLevelSound(); /* internal game sound settings */
}
static void ReinitializeMusic()
{
InitMusicInfo(); /* music properties mapping */
- InitLevelsetMusicInfo(); /* levelset music mapping */
+ InitGameModeMusicInfo(); /* game mode music mapping */
}
void InitElementPropertiesStatic()
}
else
{
- if (snd_ctrl.nr >= num_sounds)
+ if (snd_ctrl.nr < 0 || snd_ctrl.nr >= num_sounds)
return;
snd_info = getSoundInfoEntryFromSoundID(snd_ctrl.nr);
#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 */
/* ---------- initialize artwork loading/freeing functions ---------- */
- music_info->load_artwork = Load_MOD;
+ music_info->load_artwork = Load_WAV_or_MOD;
music_info->free_artwork = FreeMusic;
}
{ 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, },
{ ".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, }
};
#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
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
struct LevelSetInfo
{
- int music[NUM_SPECIAL_GFX_ARGS][MAX_LEVELS];
+ int music[MAX_LEVELS];
};
struct LevelInfo
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);
LoadTape(level_nr);
DrawCompleteVideoDisplay();
+ PlayMenuSound();
+ PlayMenuMusic();
+
OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
#if 0
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)
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();
SetMainBackgroundImage(IMG_BACKGROUND_LEVELS);
DrawChooseTree(&leveldir_current);
+
+ PlayMenuSound();
+ PlayMenuMusic();
}
void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
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)
DrawMainMenu();
}
-#if 0
-#if 1
if (game_status == GAME_MODE_SCORES)
- PlaySound_Menu_Continue(SND_BACKGROUND_SCORES);
-#endif
-#endif
+ PlayMenuSoundIfLoop();
DoAnimation();
BackToFront();
DrawChooseTree(&artwork.mus_current);
else
DrawSetupScreen_Generic();
+
+ PlayMenuSound();
+ PlayMenuMusic();
}
void HandleSetupScreen(int mx, int my, int dx, int dy, int button)