diff options
| author | Peter Kohaut | 2018-11-21 23:16:15 +0100 |
|---|---|---|
| committer | Peter Kohaut | 2018-11-24 08:39:03 +0100 |
| commit | 824ecc0aad325c54f34c8fb7f64cf4df71c53090 (patch) | |
| tree | 109abb14609bacaac2c0b1b2ed42e67a8cd2c5ec /engines/bladerunner/ui | |
| parent | 44b68a0aeb92d6dc6b6d1b3260ec5f82c529b9f0 (diff) | |
| download | scummvm-rg350-824ecc0aad325c54f34c8fb7f64cf4df71c53090.tar.gz scummvm-rg350-824ecc0aad325c54f34c8fb7f64cf4df71c53090.tar.bz2 scummvm-rg350-824ecc0aad325c54f34c8fb7f64cf4df71c53090.zip | |
BLADERUNNER: Preliminary saving & loading support
Saving and loading is accessible via ScummVM dialogs.
No in-game UI support yet.
It is possible to load saves from original game via debugger console.
ScummVM saves have additional header and are incompatibile with original
game.
Diffstat (limited to 'engines/bladerunner/ui')
| -rw-r--r-- | engines/bladerunner/ui/elevator.cpp | 6 | ||||
| -rw-r--r-- | engines/bladerunner/ui/esper.cpp | 10 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia.cpp | 30 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia.h | 4 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia_section_clues.cpp | 12 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia_section_clues.h | 2 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia_section_crimes.cpp | 22 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia_section_crimes.h | 3 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia_section_suspects.cpp | 24 | ||||
| -rw-r--r-- | engines/bladerunner/ui/kia_section_suspects.h | 3 | ||||
| -rw-r--r-- | engines/bladerunner/ui/scores.cpp | 4 | ||||
| -rw-r--r-- | engines/bladerunner/ui/spinner.cpp | 8 | ||||
| -rw-r--r-- | engines/bladerunner/ui/vk.cpp | 8 |
13 files changed, 106 insertions, 30 deletions
diff --git a/engines/bladerunner/ui/elevator.cpp b/engines/bladerunner/ui/elevator.cpp index 7a6ab3ca35..c7432368f2 100644 --- a/engines/bladerunner/ui/elevator.cpp +++ b/engines/bladerunner/ui/elevator.cpp @@ -66,8 +66,8 @@ int Elevator::activate(int elevatorId) { return 0; } - _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack); - if (!_vqaPlayer->open(vqaName)) { + _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack, vqaName); + if (!_vqaPlayer->open()) { return 0; } @@ -161,7 +161,7 @@ int Elevator::activate(int elevatorId) { _buttonClicked = -1; do { _vm->gameTick(); - } while (_buttonClicked == -1); + } while (_vm->_gameIsRunning && _buttonClicked == -1); _imagePicker->deactivate(); diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp index 338ee148f3..6803ce5c5c 100644 --- a/engines/bladerunner/ui/esper.cpp +++ b/engines/bladerunner/ui/esper.cpp @@ -107,8 +107,8 @@ void ESPER::open(Graphics::Surface *surface) { _shapesPhotos.resize(10); - _vqaPlayerMain = new VQAPlayer(_vm, &_vm->_surfaceBack); - if (!_vqaPlayerMain->open("ESPER.VQA")) { + _vqaPlayerMain = new VQAPlayer(_vm, &_vm->_surfaceBack, "ESPER.VQA"); + if (!_vqaPlayerMain->open()) { return; } _vqaPlayerMain->setLoop(2, -1, kLoopSetModeJustStart, nullptr, nullptr); @@ -534,7 +534,7 @@ void ESPER::wait(int timeout) { if (!_isWaiting) { _isWaiting = true; uint timeEnd = timeout + _vm->getTotalPlayTime(); - while (_vm->getTotalPlayTime() < timeEnd) { + while (_vm->_gameIsRunning && _vm->getTotalPlayTime() < timeEnd) { _vm->gameTick(); } _isWaiting = false; @@ -866,8 +866,8 @@ void ESPER::drawPhotoZoomOut(Graphics::Surface &surface) { void ESPER::drawVideoZooming(Graphics::Surface &surface) { if (_vqaPlayerPhoto == nullptr) { - _vqaPlayerPhoto = new VQAPlayer(_vm, &_surfaceViewport); - if (!_vqaPlayerPhoto->open(Common::String(_regions[_regionSelected].name) + ".VQA")) { + _vqaPlayerPhoto = new VQAPlayer(_vm, &_surfaceViewport, Common::String(_regions[_regionSelected].name) + ".VQA"); + if (!_vqaPlayerPhoto->open()) { setStatePhoto(kEsperPhotoStateShow); _vm->_mouse->enable(); diff --git a/engines/bladerunner/ui/kia.cpp b/engines/bladerunner/ui/kia.cpp index 756f1bd2cd..4b95607541 100644 --- a/engines/bladerunner/ui/kia.cpp +++ b/engines/bladerunner/ui/kia.cpp @@ -88,6 +88,8 @@ KIA::KIA(BladeRunnerEngine *vm) { _pogoPos = 0; + _thumbnail = nullptr; + _buttons = new UIImagePicker(_vm, 22); _crimesSection = new KIASectionCrimes(_vm, _vm->_playerActor->_clues); @@ -124,6 +126,18 @@ KIA::~KIA() { delete _script; } +void KIA::reset() { + _lastSectionIdKIA = kKIASectionCrimes; + _lastSectionIdOptions = kKIASectionSettings; + _playerVqaFrame = 0; + _playerVisualizerState = 0; + _playerSliceModelAngle = 0.0f; + + _crimesSection->reset(); + _suspectsSection->reset(); + _cluesSection->reset(); +} + void KIA::openLastOpened() { open(_lastSectionIdKIA); } @@ -169,8 +183,8 @@ void KIA::open(KIASections sectionId) { _mainVqaPlayer = nullptr; } - _mainVqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack); - _mainVqaPlayer->open(name); + _mainVqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack, name); + _mainVqaPlayer->open(); } if (_transitionId) { @@ -621,6 +635,9 @@ void KIA::loopEnded(void *callbackData, int frame, int loopId) { } void KIA::init() { + _thumbnail = new byte[SaveFile::kThumbnailSize]; + _vm->generateThumbnail(_thumbnail); + if (!_vm->openArchive("MODE.MIX")) { return; } @@ -640,8 +657,8 @@ void KIA::init() { _vm->_mouse->setCursor(0); if (_playerVqaPlayer == nullptr) { - _playerVqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceFront); - _playerVqaPlayer->open("kiaover.vqa"); + _playerVqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceFront, "kiaover.vqa"); + _playerVqaPlayer->open(); _playerVqaPlayer->setLoop(0, -1, kLoopSetModeJustStart, nullptr, nullptr); } _vm->_audioPlayer->playAud(_vm->_gameInfo->getSfxTrack(501), 70, 0, 0, 50, 0); @@ -650,6 +667,9 @@ void KIA::init() { } void KIA::unload() { + delete[] _thumbnail; + _thumbnail = nullptr; + if (!isOpen()) { return; } @@ -684,7 +704,7 @@ void KIA::unload() { // TODO: Unfreeze game time - if (!_vm->_settings->getLoadingGame() && _vm->_gameIsRunning) { + if (!_vm->_settings->isLoadingGame() && _vm->_gameIsRunning) { _vm->_scene->resume(); } } diff --git a/engines/bladerunner/ui/kia.h b/engines/bladerunner/ui/kia.h index 1c2dc19d9f..0612234db1 100644 --- a/engines/bladerunner/ui/kia.h +++ b/engines/bladerunner/ui/kia.h @@ -117,6 +117,8 @@ class KIA { int _pogoPos; + byte *_thumbnail; + public: KIALog *_log; KIAScript *_script; @@ -126,6 +128,8 @@ public: KIA(BladeRunnerEngine *vm); ~KIA(); + void reset(); + void openLastOpened(); void open(KIASections sectionId); bool isOpen() const; diff --git a/engines/bladerunner/ui/kia_section_clues.cpp b/engines/bladerunner/ui/kia_section_clues.cpp index e003e9bb28..7485d8ebcb 100644 --- a/engines/bladerunner/ui/kia_section_clues.cpp +++ b/engines/bladerunner/ui/kia_section_clues.cpp @@ -80,6 +80,18 @@ KIASectionClues::~KIASectionClues() { delete _uiContainer; } +void KIASectionClues::reset() { + _debugIntangible = false; + _debugNop = 0; + + _mouseX = 0; + _mouseY = 0; + + for (int i = 0; i < _filterCount; ++i) { + _filters[i] = true; + } +} + void KIASectionClues::open() { _isOpen = true; diff --git a/engines/bladerunner/ui/kia_section_clues.h b/engines/bladerunner/ui/kia_section_clues.h index 3f6a13d135..afd8b67433 100644 --- a/engines/bladerunner/ui/kia_section_clues.h +++ b/engines/bladerunner/ui/kia_section_clues.h @@ -67,6 +67,8 @@ public: KIASectionClues(BladeRunnerEngine *vm, ActorClues *clues); ~KIASectionClues(); + void reset(); + void open(); void close(); diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp index 96075fbc22..ff6352b3e0 100644 --- a/engines/bladerunner/ui/kia_section_crimes.cpp +++ b/engines/bladerunner/ui/kia_section_crimes.cpp @@ -41,7 +41,6 @@ #include "bladerunner/ui/ui_image_picker.h" #include "bladerunner/ui/ui_scroll_box.h" - #include "graphics/surface.h" namespace BladeRunner { @@ -71,6 +70,7 @@ KIASectionCrimes::KIASectionCrimes(BladeRunnerEngine *vm, ActorClues *clues) : K _suspectSelected = -1; _suspectPhotoShapeId = -1; + _suspectPhotoNotUsed = -1; _suspectPhotoShape = nullptr; _suspectsFoundCount = 0; _suspectsFound.resize(_vm->_gameInfo->getSuspectCount()); @@ -87,6 +87,18 @@ KIASectionCrimes::~KIASectionCrimes() { delete _uiContainer; } +void KIASectionCrimes::reset() { + _acquiredClueCount = 0; + _crimesFoundCount = 0; + _suspectsFoundCount = 0; + _mouseX = 0; + _mouseY = 0; + _suspectSelected = -1; + _crimeSelected = -1; + _suspectPhotoShapeId = -1; + _suspectPhotoNotUsed = -1; +} + void KIASectionCrimes::open() { _scheduledSwitch = false; @@ -277,7 +289,7 @@ void KIASectionCrimes::populateAcquiredClues() { ++_acquiredClueCount; } } - // sort clues by name, is it necessary + // sort clues by name, is it necessary? } void KIASectionCrimes::populateCrimes() { @@ -391,18 +403,20 @@ void KIASectionCrimes::updateSuspectPhoto() { SuspectDatabaseEntry *suspect = _vm->_suspectsDatabase->get(_suspectSelected); _suspectPhotoShapeId = -1; + _suspectPhotoNotUsed = -1; int photoCluesCount = suspect->getPhotoCount(); if (photoCluesCount > 0) { for (int i = 0 ; i < photoCluesCount; i++) { - //TODO: weird stuff going on here... it's using index instead id, also some field is used but its always -1 + //TODO: weird stuff going on here... original game is using internal clue index instead id if (_clues->isAcquired(suspect->getPhotoClueId(i))) { _suspectPhotoShapeId = suspect->getPhotoShapeId(i); + _suspectPhotoNotUsed = suspect->getPhotoNotUsed(i); break; } } } - if (_suspectPhotoShapeId == -1) { + if (_suspectPhotoShapeId == -1 && _suspectPhotoNotUsed == -1) { if (suspect->getSex()) { _suspectPhotoShapeId = 14; } else { diff --git a/engines/bladerunner/ui/kia_section_crimes.h b/engines/bladerunner/ui/kia_section_crimes.h index 23983b8d39..bd2a2f2d80 100644 --- a/engines/bladerunner/ui/kia_section_crimes.h +++ b/engines/bladerunner/ui/kia_section_crimes.h @@ -69,6 +69,7 @@ class KIASectionCrimes : public KIASectionBase { int _mouseY; int _suspectPhotoShapeId; + int _suspectPhotoNotUsed; Shape *_suspectPhotoShape; public: @@ -78,6 +79,8 @@ public: KIASectionCrimes(BladeRunnerEngine *vm, ActorClues *clues); ~KIASectionCrimes(); + void reset(); + void open(); void close(); diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp index 54e33cb62b..460f744a2a 100644 --- a/engines/bladerunner/ui/kia_section_suspects.cpp +++ b/engines/bladerunner/ui/kia_section_suspects.cpp @@ -86,6 +86,7 @@ KIASectionSuspects::KIASectionSuspects(BladeRunnerEngine *vm, ActorClues *clues) _suspectSelected = -1; _suspectPhotoShapeId = -1; + _suspectPhotoNotUsed = -1; _suspectPhotoShape = nullptr; _suspectsFoundCount = 0; _suspectsFound.resize(_vm->_gameInfo->getSuspectCount()); @@ -108,6 +109,22 @@ KIASectionSuspects::~KIASectionSuspects() { delete _uiContainer; } +void KIASectionSuspects::reset() { + _acquiredClueCount = 0; + _suspectsFoundCount = 0; + _mouseX = 0; + _mouseY = 0; + _suspectSelected = -1; + _crimeSelected = -1; + _suspectPhotoShapeId = -1; + _suspectPhotoNotUsed = -1; + _whereaboutsFilter = true; + _MOFilter = true; + _replicantFilter = true; + _nonReplicantFilter = true; + _othersFilter = true; +} + void KIASectionSuspects::open() { _scheduledSwitch = false; @@ -169,7 +186,6 @@ void KIASectionSuspects::draw(Graphics::Surface &surface) { _uiContainer->draw(surface); - _vm->_mainFont->drawColor(_vm->_textKIA->getText(0), surface, 300, 162, 0x77DF); _vm->_mainFont->drawColor(_vm->_textKIA->getText(46), surface, 142, 248, 0x77DF); _vm->_mainFont->drawColor(_vm->_textKIA->getText(47), surface, 142, 308, 0x77DF); @@ -479,18 +495,20 @@ void KIASectionSuspects::updateSuspectPhoto() { SuspectDatabaseEntry *suspect = _vm->_suspectsDatabase->get(_suspectSelected); _suspectPhotoShapeId = -1; + _suspectPhotoNotUsed = -1; int photoCluesCount = suspect->getPhotoCount(); if (photoCluesCount > 0) { for (int i = 0 ; i < photoCluesCount; i++) { - //TODO: weird stuff going on here... it's using index instead id, also some field is used but its always -1 + //TODO: weird stuff going on here... original game is using internal clue index instead id if (_clues->isAcquired(suspect->getPhotoClueId(i))) { _suspectPhotoShapeId = suspect->getPhotoShapeId(i); + _suspectPhotoNotUsed = suspect->getPhotoNotUsed(i); break; } } } - if (_suspectPhotoShapeId == -1) { + if (_suspectPhotoShapeId == -1 && _suspectPhotoNotUsed == -1) { if (suspect->getSex()) { _suspectPhotoShapeId = 14; } else { diff --git a/engines/bladerunner/ui/kia_section_suspects.h b/engines/bladerunner/ui/kia_section_suspects.h index 0cc957f609..22a3accbee 100644 --- a/engines/bladerunner/ui/kia_section_suspects.h +++ b/engines/bladerunner/ui/kia_section_suspects.h @@ -78,6 +78,7 @@ class KIASectionSuspects : public KIASectionBase { int _mouseY; int _suspectPhotoShapeId; + int _suspectPhotoNotUsed; Shape *_suspectPhotoShape; public: @@ -87,6 +88,8 @@ public: KIASectionSuspects(BladeRunnerEngine *vm, ActorClues *clues); ~KIASectionSuspects(); + void reset(); + void open(); void close(); diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp index c4a7df778c..8fc3378207 100644 --- a/engines/bladerunner/ui/scores.cpp +++ b/engines/bladerunner/ui/scores.cpp @@ -50,9 +50,9 @@ void Scores::open() { return; } - _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack); + _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack, "SCORE.VQA"); - if (!_vqaPlayer->open("SCORE.VQA")) { + if (!_vqaPlayer->open()) { return; } diff --git a/engines/bladerunner/ui/spinner.cpp b/engines/bladerunner/ui/spinner.cpp index 9e491f719c..32809e8740 100644 --- a/engines/bladerunner/ui/spinner.cpp +++ b/engines/bladerunner/ui/spinner.cpp @@ -74,14 +74,14 @@ int Spinner::chooseDestination(int loopId, bool immediately) { } else { _vm->playerLosesControl(); _vm->_scene->loopStartSpecial(kSceneLoopModeSpinner, loopId, immediately); - while (!_isOpen) { + while (_vm->_gameIsRunning && !_isOpen) { _vm->gameTick(); } _vm->playerGainsControl(); } - _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack); - if (!_vqaPlayer->open("SPINNER.VQA")) { + _vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceBack, "SPINNER.VQA"); + if (!_vqaPlayer->open()) { return 0; } @@ -159,7 +159,7 @@ int Spinner::chooseDestination(int loopId, bool immediately) { _selectedDestination = -1; do { _vm->gameTick(); - } while (_selectedDestination == -1); + } while (_vm->_gameIsRunning && _selectedDestination == -1); _imagePicker->deactivate(); diff --git a/engines/bladerunner/ui/vk.cpp b/engines/bladerunner/ui/vk.cpp index ec5013ca4c..ae776b7e55 100644 --- a/engines/bladerunner/ui/vk.cpp +++ b/engines/bladerunner/ui/vk.cpp @@ -87,8 +87,8 @@ void VK::open(int actorId, int calibrationRatio) { _shapes[i]->open("VK.SHP", i); } - _vqaPlayerMain = new VQAPlayer(_vm, &_vm->_surfaceBack); - if (!_vqaPlayerMain->open("VK.VQA")) { + _vqaPlayerMain = new VQAPlayer(_vm, &_vm->_surfaceBack, "VK.VQA"); + if (!_vqaPlayerMain->open()) { return; } @@ -114,8 +114,8 @@ void VK::open(int actorId, int calibrationRatio) { } _surfaceEye.create(172, 116, createRGB555()); - _vqaPlayerEye = new VQAPlayer(_vm, &_surfaceEye); - if (!_vqaPlayerEye->open(eyeVqa)) { + _vqaPlayerEye = new VQAPlayer(_vm, &_surfaceEye, eyeVqa); + if (!_vqaPlayerEye->open()) { return; } if (!_vqaPlayerEye->setLoop(0, -1, kLoopSetModeEnqueue, nullptr, nullptr)) { |
