aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Fach-Pedersen2017-08-22 19:51:11 +0200
committerThomas Fach-Pedersen2017-08-22 19:51:11 +0200
commit54accdffae0e0d5e9c8ef33eed534bad1089fc42 (patch)
treec4ef73e043728261ff4ebd6c0e59f6922afe03e0
parenta4c799238841e4e9ae63985b503a669449521cd6 (diff)
downloadscummvm-rg350-54accdffae0e0d5e9c8ef33eed534bad1089fc42.tar.gz
scummvm-rg350-54accdffae0e0d5e9c8ef33eed534bad1089fc42.tar.bz2
scummvm-rg350-54accdffae0e0d5e9c8ef33eed534bad1089fc42.zip
BLADERUNNER: Call AI script when clue is received
-rw-r--r--engines/bladerunner/actor.cpp4
-rw-r--r--engines/bladerunner/script/ai.cpp9
-rw-r--r--engines/bladerunner/script/ai.h3
3 files changed, 15 insertions, 1 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index 6265a0480a..85c5d89240 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -1062,7 +1062,11 @@ void Actor::addClueToDatabase(int clueId, int weight, bool clueAcquired, bool un
}
void Actor::acquireClue(int clueId, bool unknownFlag, int fromActorId) {
+ bool hasAlready = hasClue(clueId);
_clues->acquire(clueId, unknownFlag, fromActorId);
+ if (!hasAlready) {
+ _vm->_aiScripts->ReceivedClue(_id, clueId, fromActorId);
+ }
}
void Actor::loseClue(int clueId) {
diff --git a/engines/bladerunner/script/ai.cpp b/engines/bladerunner/script/ai.cpp
index 492abc0974..c695886a61 100644
--- a/engines/bladerunner/script/ai.cpp
+++ b/engines/bladerunner/script/ai.cpp
@@ -91,6 +91,15 @@ void AIScripts::CompletedMovementTrack(int actor) {
}
}
+void AIScripts::ReceivedClue(int actor, int clueId, int fromActorId) {
+ assert(actor < _actorsCount);
+ _inScriptCounter++;
+ if (_AIScripts[actor]) {
+ _AIScripts[actor]->ReceivedClue(clueId, fromActorId);
+ }
+ _inScriptCounter--;
+}
+
void AIScripts::EnteredScene(int actor, int setId) {
assert(actor < _actorsCount);
_inScriptCounter++;
diff --git a/engines/bladerunner/script/ai.h b/engines/bladerunner/script/ai.h
index 00a9f8e819..c3fec411e9 100644
--- a/engines/bladerunner/script/ai.h
+++ b/engines/bladerunner/script/ai.h
@@ -104,7 +104,7 @@ DECLARE_SCRIPT(McCoy)
float off_45A100;
float flt_462710;
float flt_462714;
-
+
void sub_4053E0();
void sub_4054F0();
void sub_405660();
@@ -170,6 +170,7 @@ public:
void Update(int actor);
void TimerExpired(int actor, int timer);
void CompletedMovementTrack(int actor);
+ void ReceivedClue(int actor, int clueId, int fromActorId);
void EnteredScene(int actor, int setId);
void OtherAgentEnteredThisScene(int actor, int otherActorId);
void OtherAgentExitedThisScene(int actor, int otherActorId);