aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-07-08 20:49:00 -0400
committerPaul Gilbert2015-07-08 20:49:00 -0400
commit6b3df0d9669d83eebd94976a9b995620e75445be (patch)
tree2a4932a1e7eb994d62659be2b891ec8d14abb731 /engines/sherlock
parentda562308cf534949aa2fbde65cab72e9a5958222 (diff)
downloadscummvm-rg350-6b3df0d9669d83eebd94976a9b995620e75445be.tar.gz
scummvm-rg350-6b3df0d9669d83eebd94976a9b995620e75445be.tar.bz2
scummvm-rg350-6b3df0d9669d83eebd94976a9b995620e75445be.zip
SHERLOCK: RT: Implement handling of 2nd object requiredFlag
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/inventory.cpp2
-rw-r--r--engines/sherlock/objects.cpp9
-rw-r--r--engines/sherlock/objects.h3
-rw-r--r--engines/sherlock/scene.cpp12
4 files changed, 15 insertions, 11 deletions
diff --git a/engines/sherlock/inventory.cpp b/engines/sherlock/inventory.cpp
index 01d515c61e..9b08b9d540 100644
--- a/engines/sherlock/inventory.cpp
+++ b/engines/sherlock/inventory.cpp
@@ -199,7 +199,7 @@ void Inventory::copyToInventory(Object &obj) {
invItem._description = obj._description;
invItem._examine = obj._examine;
invItem._lookFlag = obj._lookFlag;
- invItem._requiredFlag = obj._requiredFlag;
+ invItem._requiredFlag = obj._requiredFlag[0];
insert_at(_holdings, invItem);
++_holdings;
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 6471710ae3..a27807627e 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -64,7 +64,7 @@ BaseObject::BaseObject() {
_allow = 0;
_frameNumber = 0;
_lookFlag = 0;
- _requiredFlag = 0;
+ _requiredFlag[0] = _requiredFlag[1] = 0;
_status = 0;
_misc = 0;
_maxFrames = 0;
@@ -80,7 +80,6 @@ BaseObject::BaseObject() {
_seqSize = 0;
_quickDraw = 0;
_scaleVal = 0;
- _requiredFlags1 = 0;
_gotoSeq = 0;
_talkSeq = 0;
_restoreSlot = 0;
@@ -980,7 +979,7 @@ void Object::load(Common::SeekableReadStream &s, bool isRoseTattoo) {
_defaultCommand = isRoseTattoo ? 0 : s.readByte();
_lookFlag = s.readSint16LE();
_pickupFlag = isRoseTattoo ? 0 : s.readSint16LE();
- _requiredFlag = s.readSint16LE();
+ _requiredFlag[0] = s.readSint16LE();
_noShapeSize.x = s.readUint16LE();
_noShapeSize.y = s.readUint16LE();
_status = s.readUint16LE();
@@ -1019,7 +1018,7 @@ void Object::load(Common::SeekableReadStream &s, bool isRoseTattoo) {
_quickDraw = s.readByte();
_scaleVal = s.readUint16LE();
- _requiredFlags1 = s.readSint16LE();
+ _requiredFlag[1] = s.readSint16LE();
_gotoSeq = s.readByte();
_talkSeq = s.readByte();
_restoreSlot = s.readByte();
@@ -1074,7 +1073,7 @@ void Object::load3DO(Common::SeekableReadStream &s) {
// Unverified
_lookFlag = s.readSint16BE();
_pickupFlag = s.readSint16BE();
- _requiredFlag = s.readSint16BE();
+ _requiredFlag[0] = s.readSint16BE();
_noShapeSize.x = s.readUint16BE();
_noShapeSize.y = s.readUint16BE();
_status = s.readUint16BE();
diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h
index ef62ff9d26..8cfb466255 100644
--- a/engines/sherlock/objects.h
+++ b/engines/sherlock/objects.h
@@ -218,7 +218,7 @@ public:
Point32 _goto; // Walk destination
int _lookFlag; // Which flag LOOK will set (if any)
- int _requiredFlag; // Object will be hidden if not set
+ int _requiredFlag[2]; // Object will be hidden if not set
Common::Point _noShapeSize; // Size of a NO_SHAPE
int _status; // Status (open/closed, moved/not)
int8 _misc; // Misc field -- use varies with type
@@ -237,7 +237,6 @@ public:
UseType _use[6]; // Serrated Scalpel uses 4, Rose Tattoo 6
int _quickDraw; // Flag telling whether to use quick draw routine or not
int _scaleVal; // Tells how to scale the sprite
- int _requiredFlags1; // This flag must also be set, or the sprite is hidden
int _gotoSeq; // Used by Talk to tell which sequence to goto when able
int _talkSeq; // Tells which talk sequence currently in use (Talk or Listen)
int _restoreSlot; // Used when talk returns to the previous sequence
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 450370de2d..4e5cacb5b2 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -1099,9 +1099,15 @@ void Scene::checkSceneFlags(bool flag) {
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
Object &o = _bgShapes[idx];
+ bool flag = true;
- if (o._requiredFlag) {
- if (!_vm->readFlags(_bgShapes[idx]._requiredFlag)) {
+ if (o._requiredFlag[0] || o._requiredFlag[1]) {
+ if (o._requiredFlag[0] != 0)
+ flag = _vm->readFlags(o._requiredFlag[0]);
+ if (o._requiredFlag[1] != 0)
+ flag &= _vm->readFlags(o._requiredFlag[1]);
+
+ if (!flag) {
// Kill object
if (o._type != HIDDEN && o._type != INVALID) {
if (o._images == nullptr || o._images->size() == 0)
@@ -1111,7 +1117,7 @@ void Scene::checkSceneFlags(bool flag) {
// Flag it as needing to be hidden after first erasing it
o._type = mode;
}
- } else if (_bgShapes[idx]._requiredFlag > 0) {
+ } else if (IS_ROSE_TATTOO || o._requiredFlag > 0) {
// Restore object
if (o._images == nullptr || o._images->size() == 0)
o._type = NO_SHAPE;