Fix MAKO::check_music()

This fixes infinite loop in the opening demo of Only You, waiting for
the end of the music.
This commit is contained in:
kichikuou
2023-03-17 15:53:52 +09:00
parent 425ddf3ea8
commit be18e06e09
5 changed files with 76 additions and 14 deletions
+13 -1
View File
@@ -353,12 +353,24 @@ void MAKO::stop_music()
delete music;
music = nullptr;
}
SDL_PauseAudio(1);
if (fm) {
SDL_PauseAudio(1);
SDL_LockMutex(fm_mutex);
fm = nullptr;
SDL_UnlockMutex(fm_mutex);
}
current_music = 0;
}
bool MAKO::check_music()
{
if (fm) {
int mark, loop;
SDL_LockMutex(fm_mutex);
fm->get_mark(&mark, &loop);
SDL_UnlockMutex(fm_mutex);
return !loop;
}
return music && music->is_playing();
}