diff --git a/src/audio.cpp b/src/audio.cpp index 07dac61..cac2f9f 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -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) diff --git a/src/audio.h b/src/audio.h index fb7768c..8351253 100644 --- a/src/audio.h +++ b/src/audio.h @@ -23,6 +23,8 @@ along with this program. If not, see . 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(); diff --git a/src/game.cpp b/src/game.cpp index 6bce150..38d76b0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -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))