From 884db54d739f5838243315f390d28634cb99a7d9 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 28 Apr 2002 23:51:32 +0200 Subject: [PATCH] rnd-20020428-3-src --- src/init.c | 8 +++-- src/libgame/setup.c | 19 ++++++++++++ src/libgame/setup.h | 1 + src/libgame/sound.c | 72 ++++++++++++++++++++++++++++++++++++++------ src/libgame/sound.h | 22 +++++++++----- src/libgame/system.c | 2 ++ src/libgame/system.h | 5 ++- src/main.c | 13 ++++++++ src/main.h | 9 ++++++ src/timestamp.h | 2 +- 10 files changed, 129 insertions(+), 24 deletions(-) diff --git a/src/init.c b/src/init.c index ef6586f7..232f37a4 100644 --- a/src/init.c +++ b/src/init.c @@ -153,6 +153,7 @@ void InitNetworkServer() #endif } +#if 0 static void ReloadCustomSounds() { int i; @@ -161,9 +162,8 @@ static void ReloadCustomSounds() printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current); #endif - FreeAllSounds(); + LoadSoundsInfo(); - InitSoundList(NUM_SOUNDS); for(i=0; isource_filename) == 0) + { + /* The old and new sound are the same (have the same filename and path). + This usually means that this sound does not exist in this sound set + and a fallback to the existing sound is done. */ + + return; + } + + if (*snd_info) + FreeSound(*snd_info); + + *snd_info = Load_WAV(filename); } -void InitSoundList(int num_list_entries) +void InitSoundList(char *sound_name_list[], int num_list_entries) { - Sound = checked_calloc(num_list_entries * sizeof(SoundInfo *)); + if (Sound == NULL) + Sound = checked_calloc(num_list_entries * sizeof(SoundInfo *)); + + sound_name = sound_name_list; num_sounds = num_list_entries; } @@ -1227,10 +1257,7 @@ void LoadSoundToList(char *basename, int list_pos) if (Sound == NULL || list_pos >= num_sounds) return; - if (Sound[list_pos]) - FreeSound(Sound[list_pos]); - - Sound[list_pos] = LoadCustomSound(basename); + LoadCustomSound(&Sound[list_pos], basename); } static MusicInfo *Load_MOD(char *filename) @@ -1507,6 +1534,31 @@ void StopSoundExt(int nr, int method) #endif } +static void ReloadCustomSounds() +{ + int i; + +#if 1 + printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current); +#endif + + LoadSoundsInfo(); + + for(i=0; i