Pause music when pausing the game. (Untested.)

This commit is contained in:
onpon4 2015-04-26 07:45:58 -04:00
parent 60968c7b0e
commit 6ede2722a0
3 changed files with 19 additions and 0 deletions

View File

@ -102,7 +102,10 @@ void audio_playSound(int sid, float x)
void audio_haltMusic()
{
if (Mix_PlayingMusic())
{
Mix_ResumeMusic();
Mix_HaltMusic();
}
if (music != NULL)
{
@ -111,6 +114,17 @@ void audio_haltMusic()
}
}
void audio_pauseMusic()
{
if (Mix_PlayingMusic() && !Mix_PausedMusic())
Mix_PauseMusic();
}
void audio_resumeMusic()
{
Mix_ResumeMusic();
}
void audio_setMusicVolume(int volume)
{
if (engine.useMusic && engine.useAudio)

View File

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void audio_loadSounds();
void audio_playSound(int sid, float x);
void audio_haltMusic();
void audio_pauseMusic();
void audio_resumeMusic();
void audio_setMusicVolume(int volume);
void audio_playMusic(const char *filename, int loops);
void audio_playRandomTrack();

View File

@ -1745,12 +1745,15 @@ int mainGameLoop()
textSurface(22, "PAUSED", -1, screen->h / 2, FONT_WHITE);
blitText(22);
updateScreen();
audio_pauseMusic();
while (engine.paused)
{
engine.done = game_checkPauseRequest();
delayFrame();
}
audio_resumeMusic();
}
if ((currentGame.area == MISN_MARS) && (engine.addAliens > -1))