Midimode safeties for song queueing/fading

This commit is contained in:
mazmazz 2018-08-20 00:53:32 -04:00
parent 6d8e3c2ac1
commit 9539c597dd
2 changed files with 16 additions and 12 deletions

View File

@ -1386,7 +1386,7 @@ void S_ChangeMusicWithFade(const char *mmusic, UINT16 mflags, boolean looping, U
char newmusic[7];
boolean digiexists = S_DigExists(mmusic);
boolean midiexists = S_MIDIExists(newmusic);
boolean midiexists = S_MIDIExists(mmusic);
#if defined(HAVE_BLUA) && defined(HAVE_LUA_MUSICPLUS)
if(LUAh_MusicChange(music_name, mmusic, newmusic, &mflags, &looping))
@ -1405,7 +1405,7 @@ void S_ChangeMusicWithFade(const char *mmusic, UINT16 mflags, boolean looping, U
if (digiexists && !nodigimusic && !digital_disabled) // digmusic?
{
if (prefadems) //have to queue post-fade // allow even if the music is the same
if (prefadems && I_MusicType() != MU_MID) //have to queue post-fade // allow even if the music is the same
{
I_FadeOutStopMusic(prefadems);
I_QueueDigSongPostFade(newmusic, mflags & MUSIC_TRACKMASK, looping, position, fadeinms);

View File

@ -512,11 +512,17 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata)
static void run_queue()
{
if (queue_stopafterfade)
if (queue_stopafterfade && midimode)
I_StopSong(1337);
else if (queue_stopafterfade && !midimode)
I_StopDigSong();
else if (queue_music_name[0])
{
I_StopDigSong();
if (!midimode)
I_StopDigSong();
else
I_StopSong(1337);
if (I_StartDigSong(queue_music_name, queue_looping))
{
I_SetSongTrack(queue_track);
@ -1252,15 +1258,13 @@ boolean I_FadeMusicFromLevel(UINT8 target_volume, UINT8 source_volume, UINT32 ms
return true;
}
}
else if (!volume_delta)
else if (!volume_delta || midimode)
{
if (stopafterfade)
{
if (stopafterfade && !midimode)
I_StopDigSong();
return true;
}
else
return true;
else if (stopafterfade && midimode)
I_StopSong(1337);
return true;
}
// Round MS to nearest 10
@ -1309,7 +1313,7 @@ boolean I_FadeInStartDigSong(const char *musicname, UINT16 track, boolean loopin
{
if (musicname[0] == 0)
return true; // nothing to play
else if (queuepostfade && is_fading)
else if (queuepostfade && is_fading && !midimode)
{
strncpy(queue_music_name, musicname, 7);
queue_music_name[6] = 0;