diff options
Diffstat (limited to 'engines/sword2')
-rw-r--r-- | engines/sword2/screen.cpp | 15 | ||||
-rw-r--r-- | engines/sword2/screen.h | 5 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 5 |
3 files changed, 22 insertions, 3 deletions
diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp index 8319a6731a..871e55a647 100644 --- a/engines/sword2/screen.cpp +++ b/engines/sword2/screen.cpp @@ -99,6 +99,9 @@ Screen::Screen(Sword2Engine *vm, int16 width, int16 height) { _layer = 0; _dimPalette = false; + + _pauseTicks = 0; + _pauseStartTick = 0; } Screen::~Screen() { @@ -108,6 +111,14 @@ Screen::~Screen() { free(_lightMask); } +void Screen::pauseScreen(bool pause) { + if (pause) { + _pauseStartTick = _vm->_system->getMillis(); + } else { + _pauseTicks += (_vm->_system->getMillis() - _pauseStartTick); + } +} + /** * @return the graphics detail setting */ @@ -1029,6 +1040,8 @@ void Screen::rollCredits() { int scrollSteps = lineTop + CREDITS_FONT_HEIGHT; uint32 musicStart = _vm->getMillis(); + _pauseTicks = 0; + // Ideally the music should last just a tiny bit longer than the // credits. Note that musicTimeRemaining() will return 0 if the music // is muted, so we need a sensible fallback for that case. @@ -1104,7 +1117,7 @@ void Screen::rollCredits() { if (abortCredits && getFadeStatus() == RDFADE_BLACK) break; - _vm->sleepUntil(musicStart + (musicLength * scrollPos) / scrollSteps); + _vm->sleepUntil(musicStart + (musicLength * scrollPos) / scrollSteps + _pauseTicks); scrollPos++; } diff --git a/engines/sword2/screen.h b/engines/sword2/screen.h index 6defe51fdc..9971ad312c 100644 --- a/engines/sword2/screen.h +++ b/engines/sword2/screen.h @@ -352,10 +352,15 @@ private: bool _dimPalette; + uint32 _pauseTicks; + uint32 _pauseStartTick; + public: Screen(Sword2Engine *vm, int16 width, int16 height); ~Screen(); + void pauseScreen(bool pause); + int8 getRenderLevel(); void setRenderLevel(int8 level); diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 0ce5175fa4..7220151267 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -743,8 +743,7 @@ void Sword2Engine::sleepUntil(uint32 time) { void Sword2Engine::pauseEngineIntern(bool pause) { if (pause) { - // FIXME: We should never disallow pausing, and we need to do - // something about pausing during credits, etc. + // FIXME: We should never disallow pausing. // Don't allow Pause while screen fading or while black if (_screen->getFadeStatus() != RDFADE_NONE) @@ -753,6 +752,7 @@ void Sword2Engine::pauseEngineIntern(bool pause) { _sound->pauseAllSound(); _mouse->pauseEngine(true); _logic->pauseMovie(true); + _screen->pauseScreen(true); #ifdef SWORD2_DEBUG // Don't dim it if we're single-stepping through frames @@ -768,6 +768,7 @@ void Sword2Engine::pauseEngineIntern(bool pause) { } else { _mouse->pauseEngine(false); _logic->pauseMovie(false); + _screen->pauseScreen(false); _sound->unpauseAllSound(); _screen->dimPalette(false); |