diff options
author | Thomas Fach-Pedersen | 2018-03-04 12:35:30 +0100 |
---|---|---|
committer | Thomas Fach-Pedersen | 2018-03-04 13:30:26 +0100 |
commit | 92c49a857161b1650ca197c71668ee189d667e48 (patch) | |
tree | 956abc0c31439f6b577bcccff2324a39828193d1 /engines | |
parent | b32e9116da8c149f1fc228f779b73a2170e05210 (diff) | |
download | scummvm-rg350-92c49a857161b1650ca197c71668ee189d667e48.tar.gz scummvm-rg350-92c49a857161b1650ca197c71668ee189d667e48.tar.bz2 scummvm-rg350-92c49a857161b1650ca197c71668ee189d667e48.zip |
BLADERUNNER: Add scene resume
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/scene.cpp | 60 | ||||
-rw-r--r-- | engines/bladerunner/scene.h | 2 | ||||
-rw-r--r-- | engines/bladerunner/ui/esper.cpp | 3 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia.cpp | 7 | ||||
-rw-r--r-- | engines/bladerunner/ui/spinner.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/ui/vk.cpp | 2 |
6 files changed, 64 insertions, 12 deletions
diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp index 0a4877e45a..123134ed96 100644 --- a/engines/bladerunner/scene.cpp +++ b/engines/bladerunner/scene.cpp @@ -38,6 +38,7 @@ #include "bladerunner/script/scene_script.h" #include "bladerunner/ui/spinner.h" #include "bladerunner/vqa_player.h" +#include "bladerunner/zbuffer.h" #include "common/str.h" @@ -128,7 +129,7 @@ bool Scene::open(int setId, int sceneId, bool isLoadingGame) { _vm->_sliceRenderer->setView(_vm->_view); if (isLoadingGame) { - // TODO: Advance VQA frame + resume(true); if (sceneId == kScenePS10 || sceneId == kScenePS11 || sceneId == kScenePS12 || sceneId == kScenePS13) { // police maze? _vm->_sceneScript->sceneLoaded(); } @@ -140,11 +141,9 @@ bool Scene::open(int setId, int sceneId, bool isLoadingGame) { } if (_specialLoopMode == kSceneLoopModeNone) { - _vqaPlayer->setLoop(_defaultLoop, -1, kLoopSetModeImmediate, nullptr, nullptr); - _defaultLoopSet = true; - _defaultLoopPreloadedSet = false; + startDefaultLoop(); } - _vm->_scene->advanceFrame(); + advanceFrame(); _vm->_playerActor->setAtXYZ(_actorStartPosition, _actorStartFacing); _vm->_playerActor->setSetId(setId); @@ -244,6 +243,57 @@ int Scene::advanceFrame() { return frame; } +void Scene::resume(bool isLoadingGame) { + if (!_vqaPlayer) { + return; + } + + int targetFrame = _frame; + + if (!isLoadingGame) { + _vm->_zbuffer->disable(); + } + + if (_specialLoopMode == kSceneLoopModeNone) { + startDefaultLoop(); + } else { + if (_specialLoopMode == kSceneLoopModeChangeSet) { + _vm->_settings->setNewSetAndScene(_setId, _sceneId); + } + if (_defaultLoopPreloadedSet) { + _specialLoopMode = kSceneLoopModeNone; + startDefaultLoop(); + advanceFrame(); + loopStartSpecial(_specialLoopMode, _specialLoop, false); + } else { + _defaultLoopPreloadedSet = true; + loopStartSpecial(_specialLoopMode, _specialLoop, true); + if (_specialLoopMode == kSceneLoopModeLoseControl || _specialLoopMode == kSceneLoopModeChangeSet) { + _vm->playerGainsControl(); + + } + } + if (_specialLoopMode == kSceneLoopModeChangeSet) { + _vm->_settings->clearNewSetAndScene(); + } + } + + int frame; + do { + frame = advanceFrame(); + } while (frame >= 0 && frame != targetFrame); + + if (!isLoadingGame) { + _vm->_zbuffer->enable(); + } +} + +void Scene::startDefaultLoop() { + _vqaPlayer->setLoop(_defaultLoop, -1, kLoopSetModeImmediate, nullptr, nullptr); + _defaultLoopSet = true; + _defaultLoopPreloadedSet = false; +} + void Scene::setActorStart(Vector3 position, int facing) { _actorStartPosition = position; _actorStartFacing = facing; diff --git a/engines/bladerunner/scene.h b/engines/bladerunner/scene.h index e0d017556b..4e48769863 100644 --- a/engines/bladerunner/scene.h +++ b/engines/bladerunner/scene.h @@ -66,6 +66,8 @@ public: bool open(int setId, int sceneId, bool isLoadingGame); bool close(bool isLoadingGame); int advanceFrame(); + void resume(bool isLoadingGame = false); + void startDefaultLoop(); void setActorStart(Vector3 position, int facing); void loopSetDefault(int loopId); diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp index 181ef0f5d1..338ee148f3 100644 --- a/engines/bladerunner/ui/esper.cpp +++ b/engines/bladerunner/ui/esper.cpp @@ -31,6 +31,7 @@ #include "bladerunner/font.h" #include "bladerunner/game_info.h" #include "bladerunner/mouse.h" +#include "bladerunner/scene.h" #include "bladerunner/shape.h" #include "bladerunner/script/esper_script.h" #include "bladerunner/text_resource.h" @@ -152,7 +153,7 @@ void ESPER::close() { //TODO: time->unlock() _vm->_ambientSounds->setVolume(_ambientVolume); - //TODO: _vm->_scene->resume(false); + _vm->_scene->resume(); reset(); } diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp index 9f7ec13ea0..86fdc9254a 100644 --- a/engines/bladerunner/ui/kia.cpp +++ b/engines/bladerunner/ui/kia.cpp @@ -684,10 +684,9 @@ void KIA::unload() { // TODO: Unfreeze game time - //if (!_vm->_settings->isLoadingGame(&Settings) && GameRunning) - // if (_vm->_gameIsRunning) { - // _vm->_scene->resume(false); - // } + if (!_vm->_settings->getLoadingGame() && _vm->_gameIsRunning) { + _vm->_scene->resume(); + } } void KIA::createButtons(int sectionId) { diff --git a/engines/bladerunner/ui/spinner.cpp b/engines/bladerunner/ui/spinner.cpp index 2df9390afe..0740715fc4 100644 --- a/engines/bladerunner/ui/spinner.cpp +++ b/engines/bladerunner/ui/spinner.cpp @@ -176,7 +176,7 @@ int Spinner::chooseDestination(int loopId, bool immediately) { _isOpen = false; // TODO: Unfreeze game time - // TODO: _vm->_scene->resume(); + _vm->_scene->resume(); return _selectedDestination; } diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp index ebd088735e..ec5013ca4c 100644 --- a/engines/bladerunner/ui/vk.cpp +++ b/engines/bladerunner/ui/vk.cpp @@ -183,7 +183,7 @@ void VK::close() { _vm->_ambientSounds->setVolume(_volumeAmbient); // TODO: time->unlock(); - // _vm->_scene->resume(false); + _vm->_scene->resume(); } void VK::tick() { |