aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
authorEugene Sandulenko2018-03-23 22:02:49 +0100
committerEugene Sandulenko2018-03-24 02:45:26 +0100
commitda2c7142ce2513b8464c30ed4872eeff69987d6e (patch)
treeaef5fa185fadbe8a7cdb33f0559912516c4fe269 /engines/bladerunner
parenta284213aa0d54dda9677aac4f1d6946ddd4b3a3b (diff)
downloadscummvm-rg350-da2c7142ce2513b8464c30ed4872eeff69987d6e.tar.gz
scummvm-rg350-da2c7142ce2513b8464c30ed4872eeff69987d6e.tar.bz2
scummvm-rg350-da2c7142ce2513b8464c30ed4872eeff69987d6e.zip
BLADERUNNER: Implement Item_Spin_In_World()
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/item.cpp13
-rw-r--r--engines/bladerunner/item.h2
-rw-r--r--engines/bladerunner/items.cpp16
-rw-r--r--engines/bladerunner/items.h3
-rw-r--r--engines/bladerunner/script/script.cpp7
5 files changed, 40 insertions, 1 deletions
diff --git a/engines/bladerunner/item.cpp b/engines/bladerunner/item.cpp
index af7b2ef4c2..7fca4d108c 100644
--- a/engines/bladerunner/item.cpp
+++ b/engines/bladerunner/item.cpp
@@ -73,6 +73,10 @@ bool Item::isTarget() const {
return _isTarget;
}
+bool Item::isPoliceMazeEnemy() const {
+ return _isPoliceMazeEnemy;
+}
+
bool Item::tick(Common::Rect *screenRect, bool special) {
if (!_isVisible) {
*screenRect = Common::Rect();
@@ -152,6 +156,15 @@ void Item::setup(int itemId, int setId, int animationId, Vector3 position, int f
_screenRectangle.left = -1;
}
+void Item::spinInWorld() {
+ _isSpinning = true;
+ if (_vm->_rnd.getRandomNumberRng(1, 2) == 1) {
+ _facingChange = -340;
+ } else {
+ _facingChange = 340;
+ }
+}
+
bool Item::isUnderMouse(int mouseX, int mouseY) const {
return _isVisible
&& mouseX >= _screenRectangle.left - 10
diff --git a/engines/bladerunner/item.h b/engines/bladerunner/item.h
index 89bec5590b..baabdb8890 100644
--- a/engines/bladerunner/item.h
+++ b/engines/bladerunner/item.h
@@ -66,6 +66,8 @@ public:
void getWidthHeight(int *width, int *height) const;
bool isTarget() const;
+ bool isPoliceMazeEnemy() const;
+ void spinInWorld();
bool tick(Common::Rect *screenRect, bool special);
void setup(int itemId, int setId, int animationId, Vector3 position, int facing, int height, int width, bool isTargetFlag, bool isVisible, bool isPoliceMazeEnemy);
diff --git a/engines/bladerunner/items.cpp b/engines/bladerunner/items.cpp
index 9d9efd6a38..d526477b1f 100644
--- a/engines/bladerunner/items.cpp
+++ b/engines/bladerunner/items.cpp
@@ -126,6 +126,22 @@ bool Items::isTarget(int itemId) const {
return _items[itemIndex]->isTarget();
}
+bool Items::isPoliceMazeEnemy(int itemId) const {
+ int itemIndex = findItem(itemId);
+ if (itemIndex == -1) {
+ return false;
+ }
+ return _items[itemIndex]->isTarget();
+}
+
+void Items::spinInWorld(int itemId) {
+ int itemIndex = findItem(itemId);
+ if (itemIndex == -1) {
+ return;
+ }
+ _items[itemIndex]->spinInWorld();
+}
+
int Items::findTargetUnderMouse(int mouseX, int mouseY) const {
int setId = _vm->_scene->getSetId();
for (int i = 0 ; i < (int)_items.size(); ++i) {
diff --git a/engines/bladerunner/items.h b/engines/bladerunner/items.h
index 1aac82e8da..20f51b93b3 100644
--- a/engines/bladerunner/items.h
+++ b/engines/bladerunner/items.h
@@ -48,8 +48,11 @@ public:
bool remove(int itemId);
bool isTarget(int itemId) const;
+ bool isPoliceMazeEnemy(int itemId) const;
int findTargetUnderMouse(int mouseX, int mouseY) const;
+ void spinInWorld(int itemId);
+
private:
int findItem(int itemId) const;
};
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index f4818b1e0f..26e87cb497 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -681,7 +681,12 @@ void ScriptBase::Item_Remove_From_World(int itemId) {
}
void ScriptBase::Item_Spin_In_World(int itemId) {
- warning("Item_Spin_In_World(%d)", itemId);
+ _vm->_items->spinInWorld(itemId);
+ if (_vm->_items->isPoliceMazeEnemy(itemId)) {
+ Police_Maze_Increment_Score(1);
+ } else {
+ Police_Maze_Decrement_Score(1);
+ }
}
void ScriptBase::Item_Flag_As_Target(int itemId) {