mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Merge branch 'music-error-cleanup' into 'master'
Clean up music error messages Closes #407 See merge request STJr/SRB2Internal!585
This commit is contained in:
commit
231d387aa3
1 changed files with 7 additions and 19 deletions
|
@ -2095,22 +2095,9 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname)
|
|||
return W_GetNumForName(va("o_%s", mname));
|
||||
else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||
return W_GetNumForName(va("d_%s", mname));
|
||||
else if (S_DigMusicDisabled() && S_DigExists(mname))
|
||||
{
|
||||
//CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n");
|
||||
return LUMPERROR;
|
||||
}
|
||||
else if (S_MIDIMusicDisabled() && S_MIDIExists(mname))
|
||||
{
|
||||
//CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n");
|
||||
return LUMPERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname);
|
||||
return LUMPERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean S_LoadMusic(const char *mname)
|
||||
{
|
||||
|
@ -2123,7 +2110,10 @@ static boolean S_LoadMusic(const char *mname)
|
|||
mlumpnum = S_GetMusicLumpNum(mname);
|
||||
|
||||
if (mlumpnum == LUMPERROR)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Music %.6s could not be loaded: lump not found!\n", mname);
|
||||
return false;
|
||||
}
|
||||
|
||||
// load & register it
|
||||
mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC);
|
||||
|
@ -2148,8 +2138,11 @@ static boolean S_LoadMusic(const char *mname)
|
|||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Music %.6s could not be loaded: engine failure!\n", mname);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void S_UnloadMusic(void)
|
||||
{
|
||||
|
@ -2173,6 +2166,7 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
|
|||
if ((!fadeinms && !I_PlaySong(looping)) ||
|
||||
(fadeinms && !I_FadeInPlaySong(fadeinms, looping)))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Music %.6s could not be played: engine failure!\n", music_name);
|
||||
S_UnloadMusic();
|
||||
return false;
|
||||
}
|
||||
|
@ -2249,19 +2243,13 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
|
|||
S_StopMusic();
|
||||
|
||||
if (!S_LoadMusic(newmusic))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Music %.6s could not be loaded!\n", newmusic);
|
||||
return;
|
||||
}
|
||||
|
||||
music_flags = mflags;
|
||||
music_looping = looping;
|
||||
|
||||
if (!S_PlayMusic(looping, fadeinms))
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Music %.6s could not be played!\n", newmusic);
|
||||
return;
|
||||
}
|
||||
|
||||
if (position)
|
||||
I_SetSongPosition(position);
|
||||
|
|
Loading…
Reference in a new issue