* Allow S_ChangeMusic to queue the same track for fading

* StopDigSong upon running queue so that GME works for queueing
This commit is contained in:
mazmazz 2018-08-19 22:49:53 -04:00
parent 0a41485b60
commit 1701b81079
2 changed files with 37 additions and 37 deletions

View file

@ -1400,50 +1400,46 @@ void S_ChangeMusicWithFade(const char *mmusic, UINT16 mflags, boolean looping, U
return; return;
} }
if (strncmp(music_name, newmusic, 6)) if (S_MusicExists(newmusic, false, true) && !nodigimusic && !digital_disabled) // digmusic?
{ {
if (S_MusicExists(newmusic, false, true) && !nodigimusic && !digital_disabled) // digmusic? if (prefadems) //have to queue post-fade // allow even if the music is the same
{ {
if (prefadems) //have to queue post-fade I_FadeOutStopMusic(prefadems);
{ I_QueueDigSongPostFade(newmusic, mflags & MUSIC_TRACKMASK, looping, position, fadeinms);
I_FadeOutStopMusic(prefadems);
I_QueueDigSongPostFade(newmusic, mflags & MUSIC_TRACKMASK, looping, position, fadeinms);
// HACK: set the vars now and hope everything works out // HACK: set the vars now and hope everything works out
strncpy(music_name, newmusic, 7); strncpy(music_name, newmusic, 7);
music_name[6] = 0; music_name[6] = 0;
music_lumpnum = LUMPERROR; music_lumpnum = LUMPERROR;
music_data = NULL; music_data = NULL;
music_handle = 0; music_handle = 0;
return; return;
}
else
{
S_StopMusic();
if (!S_DigMusic(newmusic, looping))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), newmusic);
return;
}
}
} }
else if (S_MusicExists(newmusic, true, false) && !nomidimusic && !music_disabled) // midimusic? else if (strncmp(music_name, newmusic, 6))
{ {
// HACK: We don't support fade for MIDI right now, so
// just fall to old behavior verbatim. This technically should be implemented in
// the interfaces, even as a stub.
S_StopMusic(); S_StopMusic();
if (!S_DigMusic(newmusic, looping))
if (!S_MIDIMusic(newmusic, looping))
{ {
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), newmusic); CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), newmusic);
return; return;
} }
I_SetSongTrack(mflags & MUSIC_TRACKMASK);
} }
} }
else if (strncmp(music_name, newmusic, 6) && S_MusicExists(newmusic, true, false) && !nomidimusic && !music_disabled) // midimusic?
{
// HACK: We don't support fade for MIDI right now, so
// just fall to old behavior verbatim. This technically should be implemented in
// the interfaces, even as a stub.
I_SetSongTrack(mflags & MUSIC_TRACKMASK); S_StopMusic();
if (!S_MIDIMusic(newmusic, looping))
{
CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), newmusic);
return;
}
}
} }
musictype_t S_MusicType() musictype_t S_MusicType()

View file

@ -527,13 +527,17 @@ static void run_queue()
{ {
if (queue_stopafterfade) if (queue_stopafterfade)
I_StopDigSong(); I_StopDigSong();
else if (queue_music_name[0] && I_StartDigSong(queue_music_name, queue_looping)) else if (queue_music_name[0])
{ {
I_SetSongTrack(queue_track); I_StopDigSong();
if (queue_fadeinms) if (I_StartDigSong(queue_music_name, queue_looping))
I_FadeMusicFromLevel(100, 0, queue_fadeinms, false); {
if (queue_position) I_SetSongTrack(queue_track);
I_SetMusicPosition(queue_position); if (queue_fadeinms)
I_FadeMusicFromLevel(100, 0, queue_fadeinms, false);
if (queue_position)
I_SetMusicPosition(queue_position);
}
} }
queuecleanup(); queuecleanup();
} }