1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Move Mix_PausedMusic() call into wrapper function

This wrapper function is for (a) future-proofing (b) proactive
prevention of future copy-pasting (c) to clarify that we never actually
halt music in the SDL_mixer sense, we only pause it, so to check if the
music is halted we actually check if the music is paused instead. This
is important because Mix_PlayingMusic() does not check if the music is
paused and Mix_PausedMusic() does not check if the music is halted.
This commit is contained in:
Misa 2021-09-10 19:35:29 -07:00
parent 06a88eff39
commit 8e02b90b76
2 changed files with 8 additions and 1 deletions

View file

@ -428,7 +428,7 @@ void musicclass::processmusic(void)
} }
/* This needs to come after processing fades */ /* This needs to come after processing fades */
if (nicefade && Mix_PausedMusic() == 1) if (nicefade && halted())
{ {
play(nicechange); play(nicechange);
nicechange = -1; nicechange = -1;
@ -554,3 +554,8 @@ void musicclass::resumeef(void)
{ {
Mix_Resume(-1); Mix_Resume(-1);
} }
bool musicclass::halted(void)
{
return Mix_PausedMusic() == 1;
}

View file

@ -44,6 +44,8 @@ public:
void pauseef(void); void pauseef(void);
void resumeef(void); void resumeef(void);
bool halted(void);
std::vector<SoundTrack> soundTracks; std::vector<SoundTrack> soundTracks;
std::vector<MusicTrack> musicTracks; std::vector<MusicTrack> musicTracks;
SoundSystem soundSystem; SoundSystem soundSystem;