aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kohaut2016-10-06 00:59:11 +0200
committerPeter Kohaut2016-10-06 00:59:11 +0200
commite0efee2eba7328914741340c2330056be8f27205 (patch)
tree5c5d9e370f8385cd9e330f27eba5e5a2d6b0a4a1
parent5d1e1131dc48f65de2f7c00bef3989df8d0d809f (diff)
downloadscummvm-rg350-e0efee2eba7328914741340c2330056be8f27205.tar.gz
scummvm-rg350-e0efee2eba7328914741340c2330056be8f27205.tar.bz2
scummvm-rg350-e0efee2eba7328914741340c2330056be8f27205.zip
BLADERUNNER: added suspects db & fixed crimes db
-rw-r--r--engines/bladerunner/actor_clues.cpp54
-rw-r--r--engines/bladerunner/bladerunner.cpp13
-rw-r--r--engines/bladerunner/bladerunner.h53
-rw-r--r--engines/bladerunner/crimes_database.cpp (renamed from engines/bladerunner/clues.cpp)30
-rw-r--r--engines/bladerunner/crimes_database.h (renamed from engines/bladerunner/clues.h)18
-rw-r--r--engines/bladerunner/gameinfo.cpp2
-rw-r--r--engines/bladerunner/gameinfo.h32
-rw-r--r--engines/bladerunner/items.cpp2
-rw-r--r--engines/bladerunner/module.mk3
-rw-r--r--engines/bladerunner/obstacles.cpp18
-rw-r--r--engines/bladerunner/obstacles.h10
-rw-r--r--engines/bladerunner/scene_objects.cpp2
-rw-r--r--engines/bladerunner/script/script.cpp53
-rw-r--r--engines/bladerunner/script/script.h20
-rw-r--r--engines/bladerunner/suspects_database.cpp236
-rw-r--r--engines/bladerunner/suspects_database.h104
16 files changed, 510 insertions, 140 deletions
diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp
index 9c0a61c2cc..a84d54906b 100644
--- a/engines/bladerunner/actor_clues.cpp
+++ b/engines/bladerunner/actor_clues.cpp
@@ -22,7 +22,7 @@
#include "bladerunner/actor_clues.h"
-#include "bladerunner/clues.h"
+#include "bladerunner/crimes_database.h"
#include "common/debug.h"
@@ -53,20 +53,23 @@ ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) {
return;
}
- if (_maxCount > 0)
+ if (_maxCount > 0) {
_clues = new ActorClue[_maxCount];
- else
- _clues = NULL;
+ } else {
+ _clues = nullptr;
+ }
- if (_clues)
+ if (_clues) {
removeAll();
- else
+ } else {
_maxCount = 0;
+ }
}
ActorClues::~ActorClues() {
- if (_clues)
+ if (_clues) {
delete[] _clues;
+ }
_maxCount = 0;
_count = 0;
@@ -78,7 +81,7 @@ void ActorClues::acquire(int clueId, char flag2, int fromActorId) {
_clues[_count]._flags = (_clues[_count]._flags & ~0x02) | ((flag2 << 1) & 0x02);
_clues[clueIndex]._fromActorId = fromActorId;
- debug("Actor acquired clue: \"%s\" from %d", _vm->_clues->getClueText(clueId), fromActorId);
+ debug("Actor acquired clue: \"%s\" from %d", _vm->_crimesDatabase->getClueText(clueId), fromActorId);
}
void ActorClues::lose(int clueId) {
@@ -88,51 +91,58 @@ void ActorClues::lose(int clueId) {
bool ActorClues::isAcquired(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return _clues[clueIndex]._flags & 0x01;
}
int ActorClues::getFromActorId(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
+ if (clueIndex == -1) {
return -1;
+ }
return _clues[clueIndex]._fromActorId;
}
bool ActorClues::isFlag2(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return (_clues[clueIndex]._flags & 0x02) >> 1;
}
bool ActorClues::isFlag3(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return (_clues[clueIndex]._flags & 0x04) >> 2;
}
bool ActorClues::isFlag4(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return (_clues[clueIndex]._flags & 0x08) >> 3;
}
int ActorClues::getField1(int clueId) {
- if (!_count)
+ if (!_count) {
return 0;
+ }
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
+ if (clueIndex == -1) {
return 0;
+ }
return _clues[clueIndex]._field1;
}
@@ -160,7 +170,7 @@ int ActorClues::findClueIndex(int clueId) {
void ActorClues::add(int actorId, int clueId, int unknown, bool acquired, bool unknownFlag, int fromActorId) {
assert(_count < _maxCount);
- debug("Actor %d added clue: \"%s\" from %d", actorId, _vm->_clues->getClueText(clueId), fromActorId);
+ debug("Actor %d added clue: \"%s\" from %d", actorId, _vm->_crimesDatabase->getClueText(clueId), fromActorId);
_clues[_count]._clueId = clueId;
_clues[_count]._field1 = unknown;
@@ -174,8 +184,8 @@ void ActorClues::add(int actorId, int clueId, int unknown, bool acquired, bool u
}
void ActorClues::remove(int index) {
- if (_vm->_clues)
- debug("Actor removed clue: \"%s\"", _vm->_clues->getClueText(_clues[index]._clueId));
+ if (_vm->_crimesDatabase)
+ debug("Actor removed clue: \"%s\"", _vm->_crimesDatabase->getClueText(_clues[index]._clueId));
_clues[index]._clueId = -1;
_clues[index]._field1 = 0;
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 66ed387e0d..804bfbd81c 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -28,8 +28,8 @@
#include "bladerunner/audio_player.h"
#include "bladerunner/audio_speech.h"
#include "bladerunner/chapters.h"
-#include "bladerunner/clues.h"
#include "bladerunner/combat.h"
+#include "bladerunner/crimes_database.h"
#include "bladerunner/gameflags.h"
#include "bladerunner/gameinfo.h"
#include "bladerunner/image.h"
@@ -58,6 +58,7 @@
#include "engines/util.h"
#include "graphics/pixelformat.h"
+#include "suspects_database.h"
namespace BladeRunner {
@@ -68,7 +69,7 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst)
_gameIsRunning = true;
_playerLosesControlCounter = 0;
- _clues = nullptr;
+ _crimesDatabase = nullptr;
_script = new Script(this);
_settings = new Settings(this);
_lights = new Lights(this);
@@ -267,7 +268,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
// TODO: Dialogue Menu (DLGMENU.TRE)
- // TODO: SDB
+ _suspectsDatabase = new SuspectsDatabase(this, _gameInfo->getSuspectsDatabaseSize());
// TODO: KIA
@@ -312,7 +313,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_sliceRenderer = new SliceRenderer(this);
- _clues = new Clues(this, "CLUES", _gameInfo->getClueCount());
+ _crimesDatabase = new CrimesDatabase(this, "CLUES", _gameInfo->getClueCount());
// TODO: Scene
_scene = new Scene(this);
@@ -368,8 +369,8 @@ void BladeRunnerEngine::shutdown() {
_chapters = nullptr;
}
- delete _clues;
- _clues = nullptr;
+ delete _crimesDatabase;
+ _crimesDatabase = nullptr;
delete _sliceRenderer;
_sliceRenderer = nullptr;
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index d3759d6ce8..525aedfd6e 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -32,6 +32,7 @@
#include "engines/engine.h"
#include "graphics/surface.h"
+#include "suspects_database.h"
namespace BladeRunner {
@@ -42,7 +43,7 @@ class AmbientSounds;
class AudioPlayer;
class AudioSpeech;
class Chapters;
-class Clues;
+class CrimesDatabase;
class Combat;
class GameFlags;
class GameInfo;
@@ -67,29 +68,30 @@ public:
bool _windowIsActive;
int _playerLosesControlCounter;
- ADQ *_adq;
- AIScripts *_aiScripts;
- AmbientSounds *_ambientSounds;
- AudioPlayer *_audioPlayer;
- AudioSpeech *_audioSpeech;
- Chapters *_chapters;
- Clues *_clues;
- Combat *_combat;
- GameFlags *_gameFlags;
- GameInfo *_gameInfo;
- Items *_items;
- Lights *_lights;
- Mouse *_mouse;
- Obstacles *_obstacles;
- Scene *_scene;
- SceneObjects *_sceneObjects;
- Script *_script;
- Settings *_settings;
- SliceAnimations *_sliceAnimations;
- SliceRenderer *_sliceRenderer;
- View *_view;
- Waypoints *_waypoints;
- int *_gameVars;
+ ADQ *_adq;
+ AIScripts *_aiScripts;
+ AmbientSounds *_ambientSounds;
+ AudioPlayer *_audioPlayer;
+ AudioSpeech *_audioSpeech;
+ Chapters *_chapters;
+ CrimesDatabase *_crimesDatabase;
+ Combat *_combat;
+ GameFlags *_gameFlags;
+ GameInfo *_gameInfo;
+ Items *_items;
+ Lights *_lights;
+ Mouse *_mouse;
+ Obstacles *_obstacles;
+ Scene *_scene;
+ SceneObjects *_sceneObjects;
+ Script *_script;
+ Settings *_settings;
+ SliceAnimations *_sliceAnimations;
+ SliceRenderer *_sliceRenderer;
+ SuspectsDatabase *_suspectsDatabase;
+ View *_view;
+ Waypoints *_waypoints;
+ int *_gameVars;
TextResource *_textActorNames;
TextResource *_textCrimes;
@@ -125,8 +127,7 @@ public:
int _walkSoundId;
int _walkSoundVolume;
int _walkSoundBalance;
- int _walkingActorId;
-
+ int _walkingActorId;
private:
static const int kArchiveCount = 10;
MIXArchive _archives[kArchiveCount];
diff --git a/engines/bladerunner/clues.cpp b/engines/bladerunner/crimes_database.cpp
index b87761b470..c142a05318 100644
--- a/engines/bladerunner/clues.cpp
+++ b/engines/bladerunner/crimes_database.cpp
@@ -20,7 +20,7 @@
*
*/
-#include "bladerunner/clues.h"
+#include "bladerunner/crimes_database.h"
#include "bladerunner/bladerunner.h"
@@ -28,28 +28,44 @@
namespace BladeRunner {
-Clues::Clues(BladeRunnerEngine *vm, const char *cluesResource, int clueCount) : _clueCount(clueCount) {
+CrimesDatabase::CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimesCount) : _crimesCount(crimesCount) {
// reset();
- _crimes = new int[_clueCount];
- _assetTypes = new int[_clueCount];
+ _crimes = new int[_crimesCount];
+ _assetTypes = new int[_crimesCount];
_cluesText = new TextResource(vm);
_cluesText->open(cluesResource);
- for (int i = 0; i != _clueCount; ++i) {
+ for (int i = 0; i != _crimesCount; ++i) {
_crimes[i] = -1;
_assetTypes[i] = -1;
}
}
-Clues::~Clues() {
+CrimesDatabase::~CrimesDatabase() {
delete _cluesText;
delete[] _assetTypes;
delete[] _crimes;
}
-const char *Clues::getClueText(int id) {
+void CrimesDatabase::setCrime(int crimeId, int value) {
+ _crimes[crimeId] = value;
+}
+
+int CrimesDatabase::getCrime(int crimeId) {
+ return _crimes[crimeId];
+}
+
+void CrimesDatabase::setAssetType(int assetId, int assetType) {
+ _assetTypes[assetId] = assetType;
+}
+
+int CrimesDatabase::getAssetType(int assetId) {
+ return _assetTypes[assetId];
+}
+
+const char *CrimesDatabase::getClueText(int id) {
return _cluesText->getText(id);
}
diff --git a/engines/bladerunner/clues.h b/engines/bladerunner/crimes_database.h
index 4afdef682e..fc82bf2075 100644
--- a/engines/bladerunner/clues.h
+++ b/engines/bladerunner/crimes_database.h
@@ -20,23 +20,29 @@
*
*/
-#ifndef BLADERUNNER_CLUES_H
-#define BLADERUNNER_CLUES_H
+#ifndef BLADERUNNER_CRIMES_DATABASE_H
+#define BLADERUNNER_CRIMES_DATABASE_H
namespace BladeRunner {
class BladeRunnerEngine;
class TextResource;
-class Clues {
- int _clueCount;
+class CrimesDatabase {
+ int _crimesCount;
int *_crimes;
int *_assetTypes;
TextResource *_cluesText;
public:
- Clues(BladeRunnerEngine *vm, const char *cluesResource, int clueCount);
- ~Clues();
+ CrimesDatabase(BladeRunnerEngine *vm, const char *cluesResource, int crimesCount);
+ ~CrimesDatabase();
+
+ void setCrime(int crimeId, int value);
+ int getCrime(int crimeId);
+
+ void setAssetType(int assetId, int assetType);
+ int getAssetType(int assetId);
const char *getClueText(int id);
};
diff --git a/engines/bladerunner/gameinfo.cpp b/engines/bladerunner/gameinfo.cpp
index 5f30e51b84..487c39d046 100644
--- a/engines/bladerunner/gameinfo.cpp
+++ b/engines/bladerunner/gameinfo.cpp
@@ -66,7 +66,7 @@ bool GameInfo::open(const Common::String &name) {
_music_track_count = s->readUint32LE(); /* 12 */
_outtake_count = s->readUint32LE(); /* 13 */
unk = s->readUint32LE(); /* 14 */
- unk = s->readUint32LE(); /* 15 */
+ _suspectsDatabaseSize = s->readUint32LE(); /* 15 */
_cover_waypoint_count = s->readUint32LE(); /* 16 */
_flee_waypoint_count = s->readUint32LE(); /* 17 */
diff --git a/engines/bladerunner/gameinfo.h b/engines/bladerunner/gameinfo.h
index b77251d864..6f9aab5c20 100644
--- a/engines/bladerunner/gameinfo.h
+++ b/engines/bladerunner/gameinfo.h
@@ -46,6 +46,7 @@ class GameInfo {
uint32 _sfx_track_count;
uint32 _music_track_count;
uint32 _outtake_count;
+ uint32 _suspectsDatabaseSize;
uint32 _cover_waypoint_count;
uint32 _flee_waypoint_count;
@@ -53,27 +54,28 @@ class GameInfo {
char (*_sfx_tracks)[13];
char (*_music_tracks)[13];
char (*_outtakes)[13];
-
+
public:
GameInfo(BladeRunnerEngine *vm);
~GameInfo();
bool open(const Common::String &name);
- uint32 getActorCount() { return _actor_count; }
- uint32 getPlayerId() { return _player_id; }
- uint32 getFlagCount() { return _flag_count; }
- uint32 getClueCount() { return _clue_count; }
- uint32 getGlobalVarCount() { return _global_var_count; }
- uint32 getSetNamesCount() { return _set_names_count; }
- uint32 getInitialSceneId() { return _initial_scene_id; }
- uint32 getInitialSetId() { return _initial_set_id; }
- uint32 getWaypointCount() { return _waypoint_count; }
- uint32 getSfxTrackCount() { return _sfx_track_count; }
- uint32 getMusicTrackCount() { return _music_track_count; }
- uint32 getOuttakeCount() { return _outtake_count; }
- uint32 getCoverWaypointCount() { return _cover_waypoint_count; }
- uint32 getFleeWaypointCount() { return _flee_waypoint_count; }
+ uint32 getActorCount() { return _actor_count; }
+ uint32 getPlayerId() { return _player_id; }
+ uint32 getFlagCount() { return _flag_count; }
+ uint32 getClueCount() { return _clue_count; }
+ uint32 getGlobalVarCount() { return _global_var_count; }
+ uint32 getSetNamesCount() { return _set_names_count; }
+ uint32 getInitialSceneId() { return _initial_scene_id; }
+ uint32 getInitialSetId() { return _initial_set_id; }
+ uint32 getWaypointCount() { return _waypoint_count; }
+ uint32 getSfxTrackCount() { return _sfx_track_count; }
+ uint32 getMusicTrackCount() { return _music_track_count; }
+ uint32 getOuttakeCount() { return _outtake_count; }
+ uint32 getSuspectsDatabaseSize() { return _suspectsDatabaseSize; }
+ uint32 getCoverWaypointCount() { return _cover_waypoint_count; }
+ uint32 getFleeWaypointCount() { return _flee_waypoint_count; }
const char *getSceneName(int i) { return _scene_names[i]; }
const char *getSfxTrack(int i) { return _sfx_tracks[i]; }
diff --git a/engines/bladerunner/items.cpp b/engines/bladerunner/items.cpp
index 51145a3b14..66ae132fda 100644
--- a/engines/bladerunner/items.cpp
+++ b/engines/bladerunner/items.cpp
@@ -32,7 +32,7 @@ Items::Items(BladeRunnerEngine *vm) {
}
Items::~Items() {
- for(int i = _items.size() -1; i >= 0; i--) {
+ for(int i = _items.size() - 1; i >= 0; i--) {
delete _items.remove_at(i);
}
}
diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk
index b7c85ceeec..2aa3c24437 100644
--- a/engines/bladerunner/module.mk
+++ b/engines/bladerunner/module.mk
@@ -15,8 +15,8 @@ MODULE_OBJS = \
bladerunner.o \
boundingbox.o \
chapters.o \
- clues.o \
combat.o \
+ crimes_database.o \
decompress_lcw.o \
decompress_lzo.o \
detection.o \
@@ -160,6 +160,7 @@ MODULE_OBJS = \
shape.o \
slice_animations.o \
slice_renderer.o \
+ suspects_database.o \
text_resource.o \
view.o \
vqa_decoder.o \
diff --git a/engines/bladerunner/obstacles.cpp b/engines/bladerunner/obstacles.cpp
index 61d21430ea..9e701a9341 100644
--- a/engines/bladerunner/obstacles.cpp
+++ b/engines/bladerunner/obstacles.cpp
@@ -28,15 +28,15 @@ namespace BladeRunner {
Obstacles::Obstacles(BladeRunnerEngine *vm) {
_vm = vm;
- _polygons = new ObstaclesPolygon[50];
- _polygons2 = new ObstaclesPolygon[50];
- _unknown = new int[50];
+ _polygons = new ObstaclesPolygon[50];
+ _polygonsBackup = new ObstaclesPolygon[50];
+ _vertices = new Vector2[150];
clear();
}
Obstacles::~Obstacles() {
- delete[] _unknown;
- delete[] _polygons2;
+ delete[] _vertices;
+ delete[] _polygonsBackup;
delete[] _polygons;
}
@@ -49,12 +49,12 @@ void Obstacles::clear() {
_polygons[i]._vertices[j].y = 0.0f;
}
}
+ _verticesCount = 0;
+ _backup = false;
_count = 0;
- _processed = false;
}
void Obstacles::add(float x0, float z0, float x1, float z1) {
-
}
bool Obstacles::find(const Vector3 &from, const Vector3 &to, Vector3 *next) {
@@ -63,6 +63,8 @@ bool Obstacles::find(const Vector3 &from, const Vector3 &to, Vector3 *next) {
return true;
}
-void Obstacles::process() {
+void Obstacles::backup() {
}
+
+
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/obstacles.h b/engines/bladerunner/obstacles.h
index 9cf3ffa8f5..f9641bfe6b 100644
--- a/engines/bladerunner/obstacles.h
+++ b/engines/bladerunner/obstacles.h
@@ -45,10 +45,11 @@ class Obstacles {
private:
ObstaclesPolygon *_polygons;
- ObstaclesPolygon *_polygons2;
- int *_unknown;
+ ObstaclesPolygon *_polygonsBackup;
+ Vector2 *_vertices;
+ int _verticesCount;
int _count;
- bool _processed;
+ bool _backup;
public:
Obstacles(BladeRunnerEngine *vm);
@@ -57,7 +58,8 @@ public:
void clear();
void add(float x0, float z0, float x1, float z1);
bool find(const Vector3 &from, const Vector3 &to, Vector3 *next);
- void process();
+ void backup();
+ void restore();
};
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/scene_objects.cpp b/engines/bladerunner/scene_objects.cpp
index 59df6c12b4..6d10edd83f 100644
--- a/engines/bladerunner/scene_objects.cpp
+++ b/engines/bladerunner/scene_objects.cpp
@@ -295,7 +295,7 @@ void SceneObjects::updateObstacles() {
_vm->_obstacles->add(x0, z0, x1, z1);
}
}
- _vm->_obstacles->process();
+ _vm->_obstacles->backup();
}
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 180e8cb96e..8c6afc6b16 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -30,7 +30,7 @@
#include "bladerunner/ambient_sounds.h"
#include "bladerunner/audio_player.h"
#include "bladerunner/audio_speech.h"
-#include "bladerunner/clues.h"
+#include "bladerunner/crimes_database.h"
#include "bladerunner/combat.h"
#include "bladerunner/gameflags.h"
#include "bladerunner/gameinfo.h"
@@ -1122,62 +1122,51 @@ void ScriptBase::Police_Maze_Set_Pause_State(int a1) {
}
void ScriptBase::CDB_Set_Crime(int crimeId, int value) {
- //TODO
- warning("CDB_Set_Crime(%d, %d)", crimeId, value);
+ _vm->_crimesDatabase->setCrime(crimeId, value);
}
void ScriptBase::CDB_Set_Clue_Asset_Type(int assetId, int type) {
- //TODO
- warning("CDB_Set_Clue_Asset_Type(%d, %d)", assetId, type);
+ _vm->_crimesDatabase->setAssetType(assetId, type);
}
-void ScriptBase::SDB_Set_Actor(int actorId, int a2) {
- //TODO
- warning("SDB_Set_Actor(%d, %d)", actorId, a2);
+void ScriptBase::SDB_Set_Actor(int suspectId, int actorId) {
+ _vm->_suspectsDatabase->get(suspectId)->setActor(actorId);
}
-void ScriptBase::SDB_Add_Photo_Clue(int actorId, int a2, int a3) {
- //TODO
- warning("SDB_Add_Photo_Clue(%d, %d, %d)", actorId, a2, a3);
+bool ScriptBase::SDB_Add_Photo_Clue(int suspectId, int a2, int a3) {
+ return _vm->_suspectsDatabase->get(suspectId)->addPhotoClue(a2, a3);
}
void ScriptBase::SDB_Set_Name(int actorId) {
// not implemented in game
}
-void ScriptBase::SDB_Set_Sex(int actorId, int a2) {
- //TODO
- warning("SDB_Set_Sex(%d, %d)", actorId, a2);
+void ScriptBase::SDB_Set_Sex(int suspectId, int sex) {
+ _vm->_suspectsDatabase->get(suspectId)->setSex(sex);
}
-void ScriptBase::SDB_Add_Identity_Clue(int actorId, int a2) {
- //TODO
- warning("SDB_Add_Identity_Clue(%d, %d)", actorId, a2);
+bool ScriptBase::SDB_Add_Identity_Clue(int suspectId, int clueId) {
+ return _vm->_suspectsDatabase->get(suspectId)->addIdentityClue(clueId);
}
-void ScriptBase::SDB_Add_MO_Clue(int actorId, int a2) {
- //TODO
- warning("SDB_Add_MO_Clue(%d, %d)", actorId, a2);
+bool ScriptBase::SDB_Add_MO_Clue(int suspectId, int clueId) {
+ return _vm->_suspectsDatabase->get(suspectId)->addMOClue(clueId);
}
-void ScriptBase::SDB_Add_Whereabouts_Clue(int actorId, int a2) {
- //TODO
- warning("SDB_Add_Whereabouts_Clue(%d, %d)", actorId, a2);
+bool ScriptBase::SDB_Add_Whereabouts_Clue(int suspectId, int clueId) {
+ return _vm->_suspectsDatabase->get(suspectId)->addWhereaboutsClue(clueId);
}
-void ScriptBase::SDB_Add_Replicant_Clue(int actorId, int a2) {
- //TODO
- warning("SDB_Add_Replicant_Clue(%d, %d)", actorId, a2);
+bool ScriptBase::SDB_Add_Replicant_Clue(int suspectId, int clueId) {
+ return _vm->_suspectsDatabase->get(suspectId)->addReplicantClue(clueId);
}
-void ScriptBase::SDB_Add_Non_Replicant_Clue(int actorId, int a2) {
- //TODO
- warning("SDB_Add_Non_Replicant_Clue(%d, %d)", actorId, a2);
+bool ScriptBase::SDB_Add_Non_Replicant_Clue(int suspectId, int clueId) {
+ return _vm->_suspectsDatabase->get(suspectId)->addNonReplicantClue(clueId);
}
-void ScriptBase::SDB_Add_Other_Clue(int actorId, int a2) {
- //TODO
- warning("SDB_Add_Other_Clue(%d, %d)", actorId, a2);
+bool ScriptBase::SDB_Add_Other_Clue(int suspectId, int clueId) {
+ return _vm->_suspectsDatabase->get(suspectId)->addOtherClue(clueId);
}
void ScriptBase::Spinner_Set_Selectable_Destination_Flag(int a1, int a2) {
diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h
index fb38fdaf91..5966b67868 100644
--- a/engines/bladerunner/script/script.h
+++ b/engines/bladerunner/script/script.h
@@ -213,16 +213,16 @@ protected:
void Police_Maze_Set_Pause_State(int a1);
void CDB_Set_Crime(int crimeId, int value);
void CDB_Set_Clue_Asset_Type(int assetId, int type);
- void SDB_Set_Actor(int actorId, int a2);
- void SDB_Add_Photo_Clue(int actorId, int a2, int a3);
- void SDB_Set_Name(int actorId);
- void SDB_Set_Sex(int actorId, int a2);
- void SDB_Add_Identity_Clue(int actorId, int a2);
- void SDB_Add_MO_Clue(int actorId, int a2);
- void SDB_Add_Whereabouts_Clue(int actorId, int a2);
- void SDB_Add_Replicant_Clue(int actorId, int a2);
- void SDB_Add_Non_Replicant_Clue(int actorId, int a2);
- void SDB_Add_Other_Clue(int actorId, int a2);
+ void SDB_Set_Actor(int suspectId, int actorId);
+ bool SDB_Add_Photo_Clue(int suspectId, int a2, int a3);
+ void SDB_Set_Name(int suspectId);
+ void SDB_Set_Sex(int suspectId, int sex);
+ bool SDB_Add_Identity_Clue(int suspectId, int clueId);
+ bool SDB_Add_MO_Clue(int suspectId, int clueId);
+ bool SDB_Add_Whereabouts_Clue(int suspectId, int clueId);
+ bool SDB_Add_Replicant_Clue(int suspectId, int clueId);
+ bool SDB_Add_Non_Replicant_Clue(int suspectId, int clueId);
+ bool SDB_Add_Other_Clue(int suspectId, int clueId);
void Spinner_Set_Selectable_Destination_Flag(int a1, int a2);
// Spinner_Query_Selectable_Destination_Flag
int Spinner_Interface_Choose_Dest(int a1, int a2);
diff --git a/engines/bladerunner/suspects_database.cpp b/engines/bladerunner/suspects_database.cpp
new file mode 100644
index 0000000000..9c447841e9
--- /dev/null
+++ b/engines/bladerunner/suspects_database.cpp
@@ -0,0 +1,236 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "bladerunner/suspects_database.h"
+
+#include "bladerunner/bladerunner.h"
+
+#include "bladerunner/text_resource.h"
+
+namespace BladeRunner {
+
+SuspectDatabaseEntry::SuspectDatabaseEntry(BladeRunnerEngine *vm) {
+ _vm = vm;
+ reset();
+}
+
+SuspectDatabaseEntry::~SuspectDatabaseEntry() {
+}
+
+void SuspectDatabaseEntry::setActor(int actorId) {
+ _actorId = actorId;
+}
+
+void SuspectDatabaseEntry::setSex(int sex) {
+ _sex = sex;
+}
+
+bool SuspectDatabaseEntry::addMOClue(int clueId) {
+ if (_moCluesCount >= MO_CLUES_COUNT) {
+ return false;
+ }
+ _moClues[_moCluesCount++] = clueId;
+ return true;
+}
+
+bool SuspectDatabaseEntry::addWhereaboutsClue(int clueId) {
+ if (_whereaboutsCluesCount >= WHEREABOUTS_CLUES_COUNT) {
+ return false;
+ }
+ _whereaboutsClues[_whereaboutsCluesCount++] = clueId;
+ return true;
+}
+
+bool SuspectDatabaseEntry::addReplicantClue(int clueId) {
+ if (_replicantCluesCount >= REPLICANT_CLUES_COUNT) {
+ return false;
+ }
+ _replicantClues[_replicantCluesCount++] = clueId;
+ return true;
+}
+
+bool SuspectDatabaseEntry::addNonReplicantClue(int clueId) {
+ if (_nonReplicantCluesCount >= NONREPLICANT_CLUES_COUNT) {
+ return false;
+ }
+ _nonReplicantClues[_nonReplicantCluesCount++] = clueId;
+ return true;
+}
+
+bool SuspectDatabaseEntry::addOtherClue(int clueId) {
+ if (_otherCluesCount >= OTHER_CLUES_COUNT) {
+ return false;
+ }
+ _otherClues[_otherCluesCount++] = clueId;
+ return true;
+}
+
+bool SuspectDatabaseEntry::addIdentityClue(int clueId) {
+ if (_identityCluesCount >= IDENTITY_CLUES_COUNT) {
+ return false;
+ }
+ _identityClues[_identityCluesCount++] = clueId;
+ return true;
+}
+
+bool SuspectDatabaseEntry::addPhotoClue(int a1, int a2) {
+ if (_photoCluesCount >= PHOTO_CLUES_COUNT) {
+ return false;
+ }
+ _photoClues[_photoCluesCount][0] = a2;
+ _photoClues[_photoCluesCount][1] = a1;
+ _photoClues[_photoCluesCount][2] = -1;
+
+ _photoCluesCount++;
+ return true;
+}
+
+const char *SuspectDatabaseEntry::getName() {
+ return _vm->_textActorNames->getText(_actorId);
+}
+
+bool SuspectDatabaseEntry::hasMOClue(int clueId) {
+ for (int i = 0; i < _moCluesCount; i++) {
+ if (_moClues[i] == clueId) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SuspectDatabaseEntry::hasWhereaboutsClue(int clueId) {
+ for (int i = 0; i < _whereaboutsCluesCount; i++) {
+ if (_whereaboutsClues[i] == clueId) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SuspectDatabaseEntry::hasReplicantClue(int clueId) {
+ for (int i = 0; i < _replicantCluesCount; i++) {
+ if (_replicantClues[i] == clueId) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SuspectDatabaseEntry::hasNonReplicantClue(int clueId) {
+ for (int i = 0; i < _nonReplicantCluesCount; i++) {
+ if (_nonReplicantClues[i] == clueId) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SuspectDatabaseEntry::hasOtherClue(int clueId) {
+ for (int i = 0; i < _otherCluesCount; i++) {
+ if (_otherClues[i] == clueId) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SuspectDatabaseEntry::hasIdentityClue(int clueId) {
+ for (int i = 0; i < _identityCluesCount; i++) {
+ if (_identityClues[i] == clueId) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool SuspectDatabaseEntry::hasClue(int clueId) {
+ return hasMOClue(clueId)
+ || hasWhereaboutsClue(clueId)
+ || hasReplicantClue(clueId)
+ || hasNonReplicantClue(clueId)
+ || hasOtherClue(clueId);
+}
+
+int SuspectDatabaseEntry::getPhotoClue1(int photoId) {
+ return _photoClues[photoId][0];
+}
+
+int SuspectDatabaseEntry::getPhotoClue2(int photoId) {
+ return _photoClues[photoId][1];
+}
+
+int SuspectDatabaseEntry::getPhotoClue3(int photoId) {
+ return _photoClues[photoId][2];
+}
+
+void SuspectDatabaseEntry::reset() {
+ _actorId = -1;
+ _sex = -1;
+ for (int i = 0; i < MO_CLUES_COUNT; i++) {
+ _moClues[i] = -1;
+ }
+ for (int i = 0; i < WHEREABOUTS_CLUES_COUNT; i++) {
+ _whereaboutsClues[i] = -1;
+ }
+ for (int i = 0; i < IDENTITY_CLUES_COUNT; i++) {
+ _identityClues[i] = -1;
+ }
+ for (int i = 0; i < REPLICANT_CLUES_COUNT; i++) {
+ _replicantClues[i] = -1;
+ }
+ for (int i = 0; i < NONREPLICANT_CLUES_COUNT; i++) {
+ _nonReplicantClues[i] = -1;
+ }
+ for (int i = 0; i < OTHER_CLUES_COUNT; i++) {
+ _otherClues[i] = -1;
+ }
+
+ // photo clues are not reseted in original game
+
+ _moCluesCount = 0;
+ _whereaboutsCluesCount = 0;
+ _replicantCluesCount = 0;
+ _nonReplicantCluesCount = 0;
+ _otherCluesCount = 0;
+ _identityCluesCount = 0;
+ _photoCluesCount = 0;
+}
+
+SuspectsDatabase::SuspectsDatabase(BladeRunnerEngine *vm, int size) {
+ _vm = vm;
+ for (int i = 0; i < size; i++) {
+ _suspects.push_back(new SuspectDatabaseEntry(_vm));
+ }
+}
+
+SuspectsDatabase::~SuspectsDatabase() {
+ for (int i = _suspects.size() - 1; i >= 0; i--) {
+ delete _suspects.remove_at(i);
+ }
+ _suspects.clear();
+}
+
+SuspectDatabaseEntry *SuspectsDatabase::get(int suspectId) {
+ return _suspects[suspectId];
+}
+
+} // End of namespace BladeRunner
diff --git a/engines/bladerunner/suspects_database.h b/engines/bladerunner/suspects_database.h
new file mode 100644
index 0000000000..83e551b1a1
--- /dev/null
+++ b/engines/bladerunner/suspects_database.h
@@ -0,0 +1,104 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BLADERUNNER_SUSPECTS_DATABASE_H
+#define BLADERUNNER_SUSPECTS_DATABASE_H
+#include "common/array.h"
+
+namespace BladeRunner {
+
+class BladeRunnerEngine;
+class TextResource;
+
+#define MO_CLUES_COUNT 10
+#define WHEREABOUTS_CLUES_COUNT 10
+#define REPLICANT_CLUES_COUNT 20
+#define NONREPLICANT_CLUES_COUNT 20
+#define OTHER_CLUES_COUNT 20
+#define IDENTITY_CLUES_COUNT 10
+#define PHOTO_CLUES_COUNT 10
+
+class SuspectDatabaseEntry {
+ BladeRunnerEngine *_vm;
+
+ int _actorId;
+ int _sex;
+ int _moClues[MO_CLUES_COUNT];
+ int _whereaboutsClues[WHEREABOUTS_CLUES_COUNT];
+ int _replicantClues[REPLICANT_CLUES_COUNT];
+ int _nonReplicantClues[NONREPLICANT_CLUES_COUNT];
+ int _otherClues[OTHER_CLUES_COUNT];
+ int _identityClues[IDENTITY_CLUES_COUNT];
+ int _photoClues[6][3];
+ int _moCluesCount;
+ int _whereaboutsCluesCount;
+ int _replicantCluesCount;
+ int _nonReplicantCluesCount;
+ int _otherCluesCount;
+ int _identityCluesCount;
+ int _photoCluesCount;
+
+public:
+ SuspectDatabaseEntry(BladeRunnerEngine *_vm);
+ ~SuspectDatabaseEntry();
+
+ void setActor(int actorId);
+ void setSex(int sex);
+ bool addMOClue(int clueId);
+ bool addWhereaboutsClue(int clueId);
+ bool addReplicantClue(int clueId);
+ bool addNonReplicantClue(int clueId);
+ bool addOtherClue(int clueId);
+ bool addIdentityClue(int clueId);
+ bool addPhotoClue(int a1, int a2);
+
+ const char *getName();
+ bool hasMOClue(int clueId);
+ bool hasWhereaboutsClue(int clueId);
+ bool hasReplicantClue(int clueId);
+ bool hasNonReplicantClue(int clueId);
+ bool hasOtherClue(int clueId);
+ bool hasIdentityClue(int clueId);
+ bool hasClue(int clueId);
+ int getPhotoClue1(int photoId);
+ int getPhotoClue2(int photoId);
+ int getPhotoClue3(int photoId);
+
+private:
+ void reset();
+};
+
+class SuspectsDatabase {
+ BladeRunnerEngine *_vm;
+
+ Common::Array<SuspectDatabaseEntry*> _suspects;
+
+public:
+ SuspectsDatabase(BladeRunnerEngine *_vm, int size);
+ ~SuspectsDatabase();
+
+ SuspectDatabaseEntry *get(int suspectId);
+};
+
+} // End of namespace BladeRunner
+
+#endif