aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/set.cpp
diff options
context:
space:
mode:
authorThanasis Antoniou2019-05-23 15:05:03 +0300
committerThanasis Antoniou2019-05-23 15:06:29 +0300
commitd78dd5c058d4fe86c428c88b9af0d83f0bafc19e (patch)
tree833caf6810b7c25b60f6b9b49590cd535a472997 /engines/bladerunner/set.cpp
parent67a29ad5b361a0752f40c432d1ab37ac7701d5b6 (diff)
downloadscummvm-rg350-d78dd5c058d4fe86c428c88b9af0d83f0bafc19e.tar.gz
scummvm-rg350-d78dd5c058d4fe86c428c88b9af0d83f0bafc19e.tar.bz2
scummvm-rg350-d78dd5c058d4fe86c428c88b9af0d83f0bafc19e.zip
BLADERUNNER: Fix NR11 pathfinding
Added new method to "remove" bad objects in a scene/nr11 Removed objects, and still there, but they are renamed to "REMOVEDxx" and they won't affect obstacles and paths
Diffstat (limited to 'engines/bladerunner/set.cpp')
-rw-r--r--engines/bladerunner/set.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/engines/bladerunner/set.cpp b/engines/bladerunner/set.cpp
index 5427858688..1b21508caa 100644
--- a/engines/bladerunner/set.cpp
+++ b/engines/bladerunner/set.cpp
@@ -90,7 +90,11 @@ bool Set::open(const Common::String &name) {
_objects[i].isTarget = 0;
s->skip(4);
}
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
patchInAdditionalObjectsInSet();
+ patchOutBadObjectsFromSet();
+#endif // BLADERUNNER_ORIGINAL_BUGS
_walkboxCount = s->readUint32LE();
assert(_walkboxCount <= 95);
@@ -131,7 +135,10 @@ bool Set::open(const Common::String &name) {
void Set::addObjectsToScene(SceneObjects *sceneObjects) const {
for (int i = 0; i < _objectCount; i++) {
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
overrideSceneObjectInfo(i); // For bugfixes with respect to clickable/targetable box positioning/bounding box
+#endif // BLADERUNNER_ORIGINAL_BUGS
sceneObjects->addObject(i + kSceneObjectOffsetObjects, _objects[i].bbox, _objects[i].isClickable, _objects[i].isObstacle, _objects[i].unknown1, _objects[i].isTarget);
}
}
@@ -420,6 +427,8 @@ void Set::load(SaveFileReadStream &f) {
_footstepSoundOverride = f.readInt();
}
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
/**
* Used for bugfixes mainly with respect to bad box positioning / bounding box fixes
* TODO If we have many such cases, perhaps we could use a lookup table
@@ -455,6 +464,13 @@ void Set::overrideSceneObjectInfo(int objectId) const {
_objects[objectId].bbox.setXYZ(695.63f, 42.65f, -628.10f, 706.71f, 69.22f, -614.47f);
}
break;
+ case kSceneNR11:
+ // Right coat rack needs adjustment of bounding box
+ if (objectId == 1 && _objects[objectId].name == "COATRACK") {
+ _objects[objectId].bbox.setXYZ(14.91f, 0.0f, -368.79f, 114.67f, 87.04f, -171.28f);
+ }
+ break;
+
case kSceneUG09:
// block passage to buggy pipe
if (objectId == 7 && _objects[objectId].name == "BOXS FOR ARCHWAY 01") {
@@ -506,4 +522,40 @@ void Set::patchInAdditionalObjectsInSet() {
_objects[objectId].isTarget = 0; // init as false - Can be changed in Scene script eg. SceneLoaded() with (Un_)Combat_Target_Object
}
+/**
+* Used for "removing" objects from a Set mainly to fix a few "McCoy walking to places he should not" issues
+* This is called in Set::open()
+* Note:
+* - ScummVM (post fix) save games will have the removed objects information
+* - Original save games will not have the removed objects info if the save game room scene was an affected scene
+* but they will get them if the player exits and re-enters. This should not be an issue.
+*/
+void Set::patchOutBadObjectsFromSet() {
+ int removedIndexRef = 0;
+ switch (_vm->_scene->getSceneId()) {
+ case kSceneNR11:
+ for (int objectId = 0; objectId < _objectCount; ++objectId) {
+ if ((objectId == 46 && _objects[objectId].name == "BOX53")
+ || (objectId == 36 && _objects[objectId].name == "BOX43")
+ || (objectId == 37 && _objects[objectId].name == "BOX44")
+ || (objectId == 13 && _objects[objectId].name == "LOFT04")
+ ) {
+ // Removing obj 46, 36, 37 (BOX53, BOX43, BOX44) fixes paths in the scene
+ // Removing obj 13 (LOFT04) fixes duplicate named box that confuses the engine
+ _objects[objectId].name = Common::String::format("REMOVED%02d", removedIndexRef++);
+ _objects[objectId].isObstacle = 0;
+ _objects[objectId].isClickable = 0;
+ _objects[objectId].isHotMouse = 0;
+ _objects[objectId].unknown1 = 0;
+ _objects[objectId].isTarget = 0;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ return;
+}
+#endif // BLADERUNNER_ORIGINAL_BUGS
+
} // End of namespace BladeRunner