Skip to content

Commit

Permalink
BLADERUNNER: Fix displaying of clues in KIA
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
antoniou79 committed Sep 5, 2019
1 parent b04be6f commit 5941ab7
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 32 deletions.
7 changes: 4 additions & 3 deletions engines/bladerunner/actor.cpp
Expand Up @@ -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;
}
}
Expand Down
5 changes: 4 additions & 1 deletion engines/bladerunner/actor_clues.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -318,6 +318,9 @@ int ActorClues::getCount() const {
}

int ActorClues::getClueIdByIndex(int index) const {
if (index < 0) {
return -1;
}
return _clues[index].clueId;
}

Expand Down
1 change: 1 addition & 0 deletions engines/bladerunner/actor_clues.h
Expand Up @@ -32,6 +32,7 @@ class SaveFileReadStream;
class SaveFileWriteStream;

class ActorClues {
// _vm->_gameInfo->getClueCount()
static const int kClueCount = 288;

struct Clue {
Expand Down
6 changes: 3 additions & 3 deletions engines/bladerunner/game_constants.h
Expand Up @@ -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,
Expand Down
22 changes: 12 additions & 10 deletions engines/bladerunner/ui/kia_section_clues.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
22 changes: 12 additions & 10 deletions engines/bladerunner/ui/kia_section_crimes.cpp
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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();
Expand Down
11 changes: 6 additions & 5 deletions engines/bladerunner/ui/kia_section_suspects.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5941ab7

Please sign in to comment.