diff options
author | Torbjörn Andersson | 2008-11-09 14:32:24 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2008-11-09 14:32:24 +0000 |
commit | d896c892e5e78614b2faec9c175cfd1330a0bc55 (patch) | |
tree | 785adb7a8b7c6f365cc41a199914d12354c24f85 /engines/sword2/sword2.cpp | |
parent | 2e9e68fc8e1ebcfd017500165f64b97c6b6a72a8 (diff) | |
download | scummvm-rg350-d896c892e5e78614b2faec9c175cfd1330a0bc55.tar.gz scummvm-rg350-d896c892e5e78614b2faec9c175cfd1330a0bc55.tar.bz2 scummvm-rg350-d896c892e5e78614b2faec9c175cfd1330a0bc55.zip |
Allow pausing (from the outside) during credits and palette fades. Refactored the
code to distinguish outside pausing from in-game pausing, to avoid cursor-related
problems. The screen is now only dimmed during in-game pausing.
svn-id: r34957
Diffstat (limited to 'engines/sword2/sword2.cpp')
-rw-r--r-- | engines/sword2/sword2.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 7220151267..d8ebbf99d3 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -451,7 +451,7 @@ Common::Error Sword2Engine::go() { #ifdef SWORD2_DEBUG if (_stepOneCycle) { - pauseEngineIntern(true); + pauseEngine(true); _stepOneCycle = false; } #endif @@ -465,9 +465,9 @@ Common::Error Sword2Engine::go() { switch (ke->kbd.keycode) { case Common::KEYCODE_p: if (_gamePaused) - pauseEngineIntern(false); + pauseEngine(false); else - pauseEngineIntern(true); + pauseEngine(true); break; case Common::KEYCODE_c: if (!_logic->readVar(DEMO) && !_mouse->isChoosing()) { @@ -480,7 +480,7 @@ Common::Error Sword2Engine::go() { case Common::KEYCODE_SPACE: if (_gamePaused) { _stepOneCycle = true; - pauseEngineIntern(false); + pauseEngine(false); } break; case Common::KEYCODE_s: @@ -741,19 +741,13 @@ void Sword2Engine::sleepUntil(uint32 time) { } } -void Sword2Engine::pauseEngineIntern(bool pause) { - if (pause) { - // FIXME: We should never disallow pausing. +void Sword2Engine::pauseEngine(bool pause) { + if (pause == _gamePaused) + return; - // Don't allow Pause while screen fading or while black - if (_screen->getFadeStatus() != RDFADE_NONE) - return; - - _sound->pauseAllSound(); - _mouse->pauseEngine(true); - _logic->pauseMovie(true); - _screen->pauseScreen(true); + pauseEngineIntern(pause); + if (pause) { #ifdef SWORD2_DEBUG // Don't dim it if we're single-stepping through frames // dim the palette during the pause @@ -763,21 +757,31 @@ void Sword2Engine::pauseEngineIntern(bool pause) { #else _screen->dimPalette(true); #endif + } else { + _screen->dimPalette(false); + + // If mouse is about or we're in a chooser menu + if (!_mouse->getMouseStatus() || _mouse->isChoosing()) + _mouse->setMouse(NORMAL_MOUSE_ID); + } +} + +void Sword2Engine::pauseEngineIntern(bool pause) { + if (pause == _gamePaused) + return; + if (pause) { + _sound->pauseAllSound(); + _mouse->pauseEngine(true); + _logic->pauseMovie(true); + _screen->pauseScreen(true); _gamePaused = true; } else { _mouse->pauseEngine(false); _logic->pauseMovie(false); _screen->pauseScreen(false); _sound->unpauseAllSound(); - - _screen->dimPalette(false); - _gamePaused = false; - - // If mouse is about or we're in a chooser menu - if (!_mouse->getMouseStatus() || _mouse->isChoosing()) - _mouse->setMouse(NORMAL_MOUSE_ID); } } |