diff options
author | Peter Kohaut | 2019-01-09 23:06:10 +0100 |
---|---|---|
committer | Peter Kohaut | 2019-01-09 23:06:10 +0100 |
commit | 9d5bfdd01518f9bf1156b859894efbbb7d9f46ec (patch) | |
tree | 9d2e06ee949fee1aaaa8afe856a358e3fc6cc207 | |
parent | 03319bcc7d3e12c51995a72b709c633d2f42fd08 (diff) | |
download | scummvm-rg350-9d5bfdd01518f9bf1156b859894efbbb7d9f46ec.tar.gz scummvm-rg350-9d5bfdd01518f9bf1156b859894efbbb7d9f46ec.tar.bz2 scummvm-rg350-9d5bfdd01518f9bf1156b859894efbbb7d9f46ec.zip |
BLADERUNNER: Fixed scene video resume
Video in the back was always reset to the 1st frame. Now it is working
properly.
Also added game pause when the debugger is opened.
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 9 | ||||
-rw-r--r-- | engines/bladerunner/scene.cpp | 8 | ||||
-rw-r--r-- | engines/bladerunner/scene.h | 2 | ||||
-rw-r--r-- | engines/bladerunner/vqa_player.cpp | 16 | ||||
-rw-r--r-- | engines/bladerunner/vqa_player.h | 2 |
5 files changed, 23 insertions, 14 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 08de96766c..08848190f3 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -911,7 +911,6 @@ void BladeRunnerEngine::gameTick() { _sceneScript->sceneFrameAdvanced(frame); backgroundChanged = true; } - (void)backgroundChanged; blit(_surfaceBack, _surfaceFront); _overlays->tick(); @@ -1112,8 +1111,16 @@ void BladeRunnerEngine::handleKeyUp(Common::Event &event) { void BladeRunnerEngine::handleKeyDown(Common::Event &event) { if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) { + _time->pause(); getDebugger()->attach(); getDebugger()->onFrame(); + + _time->resume(); + + if (!_kia->isOpen() && !_spinner->isOpen() && !_elevator->isOpen() && !_esper->isOpen() && !_dialogueMenu->isOpen() && !_scores->isOpen()) { + _scene->resume(); + } + return; } diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp index 09764c9e50..78b1bb6da4 100644 --- a/engines/bladerunner/scene.cpp +++ b/engines/bladerunner/scene.cpp @@ -209,8 +209,8 @@ bool Scene::close(bool isLoadingGame) { return result; } -int Scene::advanceFrame() { - int frame = _vqaPlayer->update(); +int Scene::advanceFrame(bool useTime) { + int frame = _vqaPlayer->update(false, true, useTime); if (frame >= 0) { blit(_vm->_surfaceBack, _vm->_surfaceFront); _vqaPlayer->updateZBuffer(_vm->_zbuffer); @@ -268,7 +268,7 @@ void Scene::resume(bool isLoadingGame) { if (_defaultLoopPreloadedSet) { _specialLoopMode = kSceneLoopModeNone; startDefaultLoop(); - advanceFrame(); + advanceFrame(false); loopStartSpecial(_specialLoopMode, _specialLoop, false); } else { _defaultLoopPreloadedSet = true; @@ -285,7 +285,7 @@ void Scene::resume(bool isLoadingGame) { int frame; do { - frame = advanceFrame(); + frame = advanceFrame(false); } while (frame >= 0 && frame != targetFrame); if (!isLoadingGame) { diff --git a/engines/bladerunner/scene.h b/engines/bladerunner/scene.h index 0403cd331e..94de5755a1 100644 --- a/engines/bladerunner/scene.h +++ b/engines/bladerunner/scene.h @@ -71,7 +71,7 @@ public: bool open(int setId, int sceneId, bool isLoadingGame); bool close(bool isLoadingGame); - int advanceFrame(); + int advanceFrame(bool useTime = true); void resume(bool isLoadingGame = false); void startDefaultLoop(); void setActorStart(Vector3 position, int facing); diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp index 68a4e9491d..d4038ec4f8 100644 --- a/engines/bladerunner/vqa_player.cpp +++ b/engines/bladerunner/vqa_player.cpp @@ -71,7 +71,7 @@ void VQAPlayer::close() { _s = nullptr; } -int VQAPlayer::update(bool forceDraw, bool advanceFrame, Graphics::Surface *customSurface) { +int VQAPlayer::update(bool forceDraw, bool advanceFrame, bool useTime, Graphics::Surface *customSurface) { uint32 now = 60 * _vm->_system->getMillis(); int result = -1; @@ -106,7 +106,7 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, Graphics::Surface *cust result = -1; } else if (_frameNext > _frameEnd) { result = -3; - } else if (now < _frameNextTime) { + } else if (useTime && (now < _frameNextTime)) { result = -1; } else if (advanceFrame) { _frame = _frameNext; @@ -131,11 +131,13 @@ int VQAPlayer::update(bool forceDraw, bool advanceFrame, Graphics::Surface *cust queueAudioFrame(_decoder.decodeAudioFrame()); } } - if (_frameNextTime == 0) { - _frameNextTime = now + 60000 / 15; - } - else { - _frameNextTime += 60000 / 15; + if (useTime) { + if (_frameNextTime == 0) { + _frameNextTime = now + 60000 / 15; + } + else { + _frameNextTime += 60000 / 15; + } } _frameNext++; result = _frame; diff --git a/engines/bladerunner/vqa_player.h b/engines/bladerunner/vqa_player.h index c4dd182697..a51f39cc31 100644 --- a/engines/bladerunner/vqa_player.h +++ b/engines/bladerunner/vqa_player.h @@ -108,7 +108,7 @@ public: bool open(); void close(); - int update(bool forceDraw = false, bool advanceFrame = true, Graphics::Surface *customSurface = nullptr); + int update(bool forceDraw = false, bool advanceFrame = true, bool useTime = true, Graphics::Surface *customSurface = nullptr); void updateZBuffer(ZBuffer *zbuffer); void updateView(View *view); void updateScreenEffects(ScreenEffects *screenEffects); |