X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=25372817c65617fc2fa08f9cd8ed2fa11467a208;hb=2d603d06ca862f3ca0721b66f62da188faf866c4;hp=08069f4afa83dd1d9c217157411b20b15ba3c19d;hpb=9c6293f12f9dea224bff9050050253e9f52e3819;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 08069f4a..25372817 100644 --- a/src/init.c +++ b/src/init.c @@ -44,6 +44,7 @@ static void InitSetup(void); static void InitPlayerInfo(void); static void InitLevelInfo(void); static void InitArtworkInfo(void); +static void InitLevelArtworkInfo(void); static void InitNetworkServer(void); static void InitMixer(void); static void InitSound(void); @@ -97,6 +98,7 @@ void OpenAll(void) InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */ InitLevelInfo(); + InitLevelArtworkInfo(); InitGadgets(); /* needs to know number of level series */ InitSound(); /* needs to know current level directory */ @@ -138,6 +140,11 @@ void InitArtworkInfo() LoadArtworkInfo(); } +void InitLevelArtworkInfo() +{ + LoadLevelArtworkInfo(); +} + void InitNetworkServer() { #if defined(PLATFORM_UNIX) @@ -171,8 +178,12 @@ static void InitMixer() static void InitSound() { + /* load custom sounds and music */ InitReloadSounds(artwork.snd_current->name); InitReloadMusic(artwork.mus_current->name); + + /* initialize sound effect lookup table for element actions */ + InitGameSound(); } static void InitTileClipmasks() @@ -361,10 +372,7 @@ void InitGfx() DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW); DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED); -#if defined(PLATFORM_MSDOS) - DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE); - rest(200); -#endif + DrawInitText("Loading graphics:", 120, FC_GREEN); for(i=0; iname) + static char *leveldir_current_name = NULL; + static boolean last_override_level_graphics = FALSE; + static boolean last_override_level_sounds = FALSE; + static boolean last_override_level_music = FALSE; + + if (leveldir_current_name != leveldir_current->name) + { + /* force reload of custom artwork after new level series was selected */ + artwork.graphics_set_current_name = NULL; + artwork.sounds_set_current_name = NULL; + artwork.music_set_current_name = NULL; + + leveldir_current_name = leveldir_current->name; + } + + if (artwork.graphics_set_current_name != artwork.gfx_current->name || + last_override_level_graphics != setup.override_level_graphics) { int i; @@ -421,21 +445,26 @@ void ReloadCustomArtwork() SetDoorState(DOOR_OPEN_1 | DOOR_CLOSE_2); - artwork.graphics_set_current = artwork.gfx_current->name; + artwork.graphics_set_current_name = artwork.gfx_current->name; + last_override_level_graphics = setup.override_level_graphics; } - if (artwork.sounds_set_current != artwork.snd_current->name) + if (artwork.sounds_set_current_name != artwork.snd_current->name || + last_override_level_sounds != setup.override_level_sounds) { InitReloadSounds(artwork.snd_current->name); - artwork.sounds_set_current = artwork.snd_current->name; + artwork.sounds_set_current_name = artwork.snd_current->name; + last_override_level_sounds = setup.override_level_sounds; } - if (artwork.music_set_current != artwork.mus_current->name) + if (artwork.music_set_current_name != artwork.mus_current->name || + last_override_level_music != setup.override_level_music) { InitReloadMusic(artwork.mus_current->name); - artwork.music_set_current = artwork.mus_current->name; + artwork.music_set_current_name = artwork.mus_current->name; + last_override_level_music = setup.override_level_music; } }