X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsound.c;h=2b1ccd873560fe89e5bdee24dc68601eefd25d5f;hb=98cdc60c12229af0a1672372157d52afe8edd3d0;hp=21c21fddeebb8e0aba8fa20366e16e20251e9611;hpb=afad49f6ce2e58eeb41f680b8d05eed74455a1ab;p=rocksndiamonds.git diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 21c21fdd..2b1ccd87 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -48,10 +48,10 @@ #define SOUND_VOLUME_LEFT(x) (stereo_volume[x]) #define SOUND_VOLUME_RIGHT(x) (stereo_volume[SOUND_MAX_LEFT2RIGHT-x]) -#define SAME_SOUND_NR(x,y) ((x).nr == (y).nr) -#define SAME_SOUND_DATA(x,y) ((x).data_ptr == (y).data_ptr) +#define SAME_SOUND_NR(x, y) ((x).nr == (y).nr) +#define SAME_SOUND_DATA(x, y) ((x).data_ptr == (y).data_ptr) -#define SOUND_VOLUME_FROM_PERCENT(v,p) ((p) < 0 ? SOUND_MIN_VOLUME : \ +#define SOUND_VOLUME_FROM_PERCENT(v, p) ((p) < 0 ? SOUND_MIN_VOLUME : \ (p) > 100 ? (v) : \ (p) * (v) / 100) @@ -59,7 +59,7 @@ #define SOUND_VOLUME_LOOPS(v) SOUND_VOLUME_FROM_PERCENT(v, setup.volume_loops) #define SOUND_VOLUME_MUSIC(v) SOUND_VOLUME_FROM_PERCENT(v, setup.volume_music) -#define SETUP_SOUND_VOLUME(v,s) ((s) & SND_CTRL_MUSIC ? \ +#define SETUP_SOUND_VOLUME(v, s) ((s) & SND_CTRL_MUSIC ? \ SOUND_VOLUME_MUSIC(v) : \ (s) & SND_CTRL_LOOP ? \ SOUND_VOLUME_LOOPS(v) : \ @@ -591,7 +591,7 @@ static void LoadCustomMusic_NoConf(void) { static boolean draw_init_text = TRUE; // only draw at startup static char *last_music_directory = NULL; - char *music_directory = getCustomMusicDirectory(); + char *music_directory = getCustomMusicDirectory_NoConf(); Directory *dir; DirectoryEntry *dir_entry; int num_music = getMusicListSize(); @@ -609,11 +609,15 @@ static void LoadCustomMusic_NoConf(void) FreeAllMusic_NoConf(); - if ((dir = openDirectory(music_directory)) == NULL) + if (music_directory == NULL) { - Warn("cannot read music directory '%s'", music_directory); + Warn("cannot find music directory with unconfigured music"); - audio.music_available = FALSE; + return; + } + else if ((dir = openDirectory(music_directory)) == NULL) + { + Warn("cannot read music directory '%s'", music_directory); return; } @@ -741,6 +745,16 @@ static MusicInfo *getMusicInfoEntryFromMusicID(int pos) return mus_info[list_pos]; } +char *getSoundInfoEntryFilename(int pos) +{ + SoundInfo *snd_info = getSoundInfoEntryFromSoundID(pos); + + if (snd_info == NULL) + return NULL; + + return getBaseNamePtr(snd_info->source_filename); +} + char *getMusicInfoEntryFilename(int pos) { MusicInfo *mus_info = getMusicInfoEntryFromMusicID(pos);