diff options
author | Thanasis Antoniou | 2019-09-05 10:37:47 +0300 |
---|---|---|
committer | Thanasis Antoniou | 2019-09-05 10:39:51 +0300 |
commit | 5941ab78584147a751602b4a90061899fb63e0b2 (patch) | |
tree | 32ca34f767fd4a9916730bac6ae09a1cf371904a | |
parent | b04be6f9e1e50f93fb9a57471907d5789c93e120 (diff) | |
download | scummvm-rg350-5941ab78584147a751602b4a90061899fb63e0b2.tar.gz scummvm-rg350-5941ab78584147a751602b4a90061899fb63e0b2.tar.bz2 scummvm-rg350-5941ab78584147a751602b4a90061899fb63e0b2.zip |
BLADERUNNER: Fix displaying of clues in KIA
Fixes bug where clues with no type would appear in KIA sections
"End of Act 2" would appear in Sadik's and Clovis' suspect pages, and in Bradbury crime page, whereas Sadik's photo would not appear in Sadik's page.
-rw-r--r-- | engines/bladerunner/actor.cpp | 7 | ||||
-rw-r--r-- | engines/bladerunner/actor_clues.cpp | 5 | ||||
-rw-r--r-- | engines/bladerunner/actor_clues.h | 1 | ||||
-rw-r--r-- | engines/bladerunner/game_constants.h | 6 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_clues.cpp | 22 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_crimes.cpp | 22 | ||||
-rw-r--r-- | engines/bladerunner/ui/kia_section_suspects.cpp | 11 |
7 files changed, 42 insertions, 32 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index e5933f6619..e1ecefd8ae 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -1254,12 +1254,13 @@ bool Actor::copyClues(int actorId) { bool newCluesAcquired = false; Actor *otherActor = _vm->_actors[actorId]; for (int i = 0; i < (int)_vm->_gameInfo->getClueCount(); i++) { - if (hasClue(i) && !_clues->isPrivate(i) && otherActor->canAcquireClue(i) && !otherActor->hasClue(i)) { + int clueId = _clues->getClueIdByIndex(i); + if (hasClue(clueId) && !_clues->isPrivate(clueId) && otherActor->canAcquireClue(clueId) && !otherActor->hasClue(clueId)) { int fromActorId = _id; if (_id == BladeRunnerEngine::kActorVoiceOver) { - fromActorId = _clues->getFromActorId(i); + fromActorId = _clues->getFromActorId(clueId); } - otherActor->acquireClue(i, false, fromActorId); + otherActor->acquireClue(clueId, false, fromActorId); newCluesAcquired = true; } } diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp index 63dbbbf810..4946113713 100644 --- a/engines/bladerunner/actor_clues.cpp +++ b/engines/bladerunner/actor_clues.cpp @@ -39,7 +39,7 @@ ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesLimit) { _maxCount = 0; switch (cluesLimit) { case 4: - _maxCount = _vm->_gameInfo->getClueCount(); + _maxCount = kClueCount; break; case 3: _maxCount = 100; @@ -318,6 +318,9 @@ int ActorClues::getCount() const { } int ActorClues::getClueIdByIndex(int index) const { + if (index < 0) { + return -1; + } return _clues[index].clueId; } diff --git a/engines/bladerunner/actor_clues.h b/engines/bladerunner/actor_clues.h index 88af222724..8de4190f79 100644 --- a/engines/bladerunner/actor_clues.h +++ b/engines/bladerunner/actor_clues.h @@ -32,6 +32,7 @@ class SaveFileReadStream; class SaveFileWriteStream; class ActorClues { + // _vm->_gameInfo->getClueCount() static const int kClueCount = 288; struct Clue { diff --git a/engines/bladerunner/game_constants.h b/engines/bladerunner/game_constants.h index 36c6ab624d..19af4ce3ea 100644 --- a/engines/bladerunner/game_constants.h +++ b/engines/bladerunner/game_constants.h @@ -369,9 +369,9 @@ enum Clues { kClueKingstonKitchenBox2 = 263, // ESPER hard-copy kClueCrystalsCigarette = 264, kClueSpinnerKeys = 265, - kClueAct2Ended = 266, - kClueAct3Ended = 267, - kClueAct4Ended = 268, + kClueAct2Ended = 266, // is acquired but never checked. Has no type and seems like a placeholder + kClueAct3Ended = 267, // unused + kClueAct4Ended = 268, // unused kClueExpertBomber = 269, kClueAmateurBomber = 270, kClueVKLucyReplicant = 271, diff --git a/engines/bladerunner/ui/kia_section_clues.cpp b/engines/bladerunner/ui/kia_section_clues.cpp index d4437f728b..9b9f6b7c00 100644 --- a/engines/bladerunner/ui/kia_section_clues.cpp +++ b/engines/bladerunner/ui/kia_section_clues.cpp @@ -57,7 +57,7 @@ KIASectionClues::KIASectionClues(BladeRunnerEngine *vm, ActorClues *clues) : KIA _buttons = new UIImagePicker(_vm, 2); - _cluesScrollBox = new UIScrollBox(_vm, scrollBoxCallback, this, _vm->_gameInfo->getClueCount(), 1, false, Common::Rect(312, 172, 500, 376), Common::Rect(506, 160, 506, 394)); + _cluesScrollBox = new UIScrollBox(_vm, scrollBoxCallback, this, kClueCount, 1, false, Common::Rect(312, 172, 500, 376), Common::Rect(506, 160, 506, 394)); _uiContainer->add(_cluesScrollBox); _filterScrollBox = new UIScrollBox(_vm, scrollBoxCallback, this, 128, 1, false, Common::Rect(142, 162, 291, 376), Common::Rect(120, 160, 120, 370)); @@ -283,9 +283,10 @@ void KIASectionClues::populateFilters() { }; for (int i = 0; i < kClueCount; ++i) { - if (_clues->isAcquired(i)) { - int assetType = _vm->_crimesDatabase->getAssetType(i); - int crimeId = _vm->_crimesDatabase->getCrime(i); + int clueId = _clues->getClueIdByIndex(i); + if (_clues->isAcquired(clueId)) { + int assetType = _vm->_crimesDatabase->getAssetType(clueId); + int crimeId = _vm->_crimesDatabase->getCrime(clueId); if (_debugIntangible || assetType != -1) { availableFilters[getLineIdForAssetType(assetType)] = true; availableFilters[getLineIdForCrimeId(crimeId)] = true; @@ -382,18 +383,19 @@ void KIASectionClues::populateFilters() { void KIASectionClues::populateClues() { _cluesScrollBox->clearLines(); for (int i = 0; i < kClueCount; ++i) { - if (_clues->isAcquired(i)) { - int assetType = _vm->_crimesDatabase->getAssetType(i); - int crimeId = _vm->_crimesDatabase->getCrime(i); + int clueId = _clues->getClueIdByIndex(i); + if (_clues->isAcquired(clueId)) { + int assetType = _vm->_crimesDatabase->getAssetType(clueId); + int crimeId = _vm->_crimesDatabase->getCrime(clueId); if (assetType != -1 || _debugIntangible) { if (_filters[getLineIdForAssetType(assetType)] && _filters[getLineIdForCrimeId(crimeId)]) { int flags = 0x30; - if (_clues->isPrivate(i)) { + if (_clues->isPrivate(clueId)) { flags = 0x08; - } else if (_clues->isViewed(i)) { + } else if (_clues->isViewed(clueId)) { flags = 0x10; } - _cluesScrollBox->addLine(_vm->_crimesDatabase->getClueText(i), i, flags); + _cluesScrollBox->addLine(_vm->_crimesDatabase->getClueText(clueId), clueId, flags); } } } diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp index 6369a8f3f4..9061fff78b 100644 --- a/engines/bladerunner/ui/kia_section_crimes.cpp +++ b/engines/bladerunner/ui/kia_section_crimes.cpp @@ -287,9 +287,10 @@ void KIASectionCrimes::onButtonPressed(int buttonId) { void KIASectionCrimes::populateAcquiredClues() { _acquiredClueCount = 0; for (int i = 0; i < kClueCount; ++i) { - if (_clues->isAcquired(i)) { - _acquiredClues[_acquiredClueCount].clueId = i; - _acquiredClues[_acquiredClueCount].actorId = _clues->getFromActorId(i); + int clueId = _clues->getClueIdByIndex(i); + if (_clues->isAcquired(clueId)) { + _acquiredClues[_acquiredClueCount].clueId = clueId; + _acquiredClues[_acquiredClueCount].actorId = _clues->getFromActorId(clueId); ++_acquiredClueCount; } } @@ -375,18 +376,19 @@ void KIASectionCrimes::populateSuspects() { void KIASectionCrimes::populateVisibleClues() { _cluesScrollBox->clearLines(); if (_crimeSelected != -1) { - for (uint i = 0; i < _vm->_gameInfo->getClueCount(); ++i) { - if (_vm->_crimesDatabase->getAssetType(i) != -1 - && _vm->_crimesDatabase->getCrime(i) == _crimeSelected - && _clues->isAcquired(i) + for (uint i = 0; i < kClueCount; ++i) { + int clueId = _clues->getClueIdByIndex(i); + if (_vm->_crimesDatabase->getAssetType(clueId) != -1 + && _vm->_crimesDatabase->getCrime(clueId) == _crimeSelected + && _clues->isAcquired(clueId) ) { int flags = 0x30; - if (_clues->isPrivate(i)) { + if (_clues->isPrivate(clueId)) { flags = 0x08; - } else if (_clues->isViewed(i)) { + } else if (_clues->isViewed(clueId)) { flags = 0x10; } - _cluesScrollBox->addLine(_vm->_crimesDatabase->getClueText(i), i, flags); + _cluesScrollBox->addLine(_vm->_crimesDatabase->getClueText(clueId), clueId, flags); } } _cluesScrollBox->sortLines(); diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp index cfe3fc3252..ba1f6a5f7f 100644 --- a/engines/bladerunner/ui/kia_section_suspects.cpp +++ b/engines/bladerunner/ui/kia_section_suspects.cpp @@ -66,7 +66,7 @@ KIASectionSuspects::KIASectionSuspects(BladeRunnerEngine *vm, ActorClues *clues) _replicantCheckBox = new UICheckBox(_vm, checkBoxCallback, this, Common::Rect(142, 338, 275, 348), 1, _replicantFilter); _nonReplicantCheckBox = new UICheckBox(_vm, checkBoxCallback, this, Common::Rect(142, 348, 275, 358), 1, _nonReplicantFilter); _othersCheckBox = new UICheckBox(_vm, checkBoxCallback, this, Common::Rect(142, 358, 275, 368), 1, _othersFilter); - _cluesScrollBox = new UIScrollBox(_vm, scrollBoxCallback, this,_vm->_gameInfo->getClueCount(), 1, false, Common::Rect(312, 172, 500, 376), Common::Rect(506, 160, 506, 394)); + _cluesScrollBox = new UIScrollBox(_vm, scrollBoxCallback, this, kClueCount, 1, false, Common::Rect(312, 172, 500, 376), Common::Rect(506, 160, 506, 394)); _crimesScrollBox = new UIScrollBox(_vm, scrollBoxCallback, this, 50, 1, false, Common::Rect(154, 258, 291, 298), Common::Rect(120, 249, 120, 297)); _uiContainer->add(_whereaboutsCheckBox); _uiContainer->add(_MOCheckBox); @@ -380,9 +380,10 @@ void KIASectionSuspects::onButtonPressed(int buttonId) { void KIASectionSuspects::populateAcquiredClues() { _acquiredClueCount = 0; for (int i = 0; i < kClueCount; ++i) { - if (_clues->isAcquired(i)) { - _acquiredClues[_acquiredClueCount].clueId = i; - _acquiredClues[_acquiredClueCount].actorId = _clues->getFromActorId(i); + int clueId = _clues->getClueIdByIndex(i); + if (_clues->isAcquired(clueId)) { + _acquiredClues[_acquiredClueCount].clueId = clueId; + _acquiredClues[_acquiredClueCount].actorId = _clues->getFromActorId(clueId); ++_acquiredClueCount; } } @@ -453,7 +454,7 @@ void KIASectionSuspects::populateVisibleClues() { for (int i = 0; i < _acquiredClueCount; ++i) { int clueId = _acquiredClues[i].clueId; - if (_vm->_crimesDatabase->getAssetType(i) != -1) { + if (_vm->_crimesDatabase->getAssetType(clueId) != -1) { SuspectDatabaseEntry *suspect = _vm->_suspectsDatabase->get(_suspectSelected); bool showClue = false; |