[Scummvm-git-logs] scummvm master -> d78dd5c058d4fe86c428c88b9af0d83f0bafc19e

antoniou79 antoniou at cti.gr
Thu May 23 14:07:31 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d78dd5c058 BLADERUNNER: Fix NR11 pathfinding


Commit: d78dd5c058d4fe86c428c88b9af0d83f0bafc19e
    https://github.com/scummvm/scummvm/commit/d78dd5c058d4fe86c428c88b9af0d83f0bafc19e
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-05-23T15:06:29+03:00

Commit Message:
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

Changed paths:
    engines/bladerunner/script/scene/nr11.cpp
    engines/bladerunner/script/script.cpp
    engines/bladerunner/set.cpp
    engines/bladerunner/set.h


diff --git a/engines/bladerunner/script/scene/nr11.cpp b/engines/bladerunner/script/scene/nr11.cpp
index 515fb787..c52208e 100644
--- a/engines/bladerunner/script/scene/nr11.cpp
+++ b/engines/bladerunner/script/scene/nr11.cpp
@@ -70,7 +70,10 @@ void SceneScriptNR11::SceneLoaded() {
 		Clickable_Object("CLOTHING02");
 		Clickable_Object("BOX27");
 		Clickable_Object("BOX39");
+#if BLADERUNNER_ORIGINAL_BUGS
+		// in our bugfixes this object is removed
 		Clickable_Object("BOX44");
+#endif // BLADERUNNER_ORIGINAL_BUGS
 		Clickable_Object("DRESS");
 		Clickable_Object("COATRACK");
 		Clickable_Object("COLUMN3 DETS");
@@ -85,7 +88,10 @@ void SceneScriptNR11::SceneLoaded() {
 		Combat_Target_Object("CLOTHING02");
 		Combat_Target_Object("BOX27");
 		Combat_Target_Object("BOX39");
+#if BLADERUNNER_ORIGINAL_BUGS
+		// in our bugfixes this object is removed
 		Combat_Target_Object("BOX44");
+#endif // BLADERUNNER_ORIGINAL_BUGS
 		Combat_Target_Object("DRESS");
 		Combat_Target_Object("COATRACK");
 		Combat_Target_Object("COLUMN3 DETS");
@@ -101,7 +107,10 @@ void SceneScriptNR11::SceneLoaded() {
 		Unclickable_Object("CLOTHING02");
 		Unclickable_Object("BOX27");
 		Unclickable_Object("BOX39");
+#if BLADERUNNER_ORIGINAL_BUGS
+		// in our bugfixes this object is removed
 		Unclickable_Object("BOX44");
+#endif
 		Unclickable_Object("DRESS");
 		Unclickable_Object("COATRACK");
 		Unclickable_Object("COLUMN3 DETS");
@@ -125,7 +134,10 @@ bool SceneScriptNR11::ClickedOn3DObject(const char *objectName, bool combatMode)
 	if (Object_Query_Click("CLOTHING02", objectName)
 	 || Object_Query_Click("BOX27", objectName)
 	 || Object_Query_Click("BOX39", objectName)
+#if BLADERUNNER_ORIGINAL_BUGS
+	 // in our bugfixes this object is removed
 	 || Object_Query_Click("BOX44", objectName)
+#endif // BLADERUNNER_ORIGINAL_BUGS
 	 || Object_Query_Click("DRESS", objectName)
 	 || Object_Query_Click("COATRACK", objectName)
 	 || Object_Query_Click("COLUMN3 DETS", objectName)
@@ -410,7 +422,10 @@ void SceneScriptNR11::untargetEverything() {
 	Un_Combat_Target_Object("CLOTHING02");
 	Un_Combat_Target_Object("BOX27");
 	Un_Combat_Target_Object("BOX39");
+#if BLADERUNNER_ORIGINAL_BUGS
+	// in our bugfixes this object is removed
 	Un_Combat_Target_Object("BOX44");
+#endif // BLADERUNNER_ORIGINAL_BUGS
 	Un_Combat_Target_Object("DRESS");
 	Un_Combat_Target_Object("COATRACK");
 	Un_Combat_Target_Object("COLUMN3 DETS");
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index c8a5c60..c65fb03 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -1507,8 +1507,9 @@ void ScriptBase::Clickable_Object(const char *objectName) {
 void ScriptBase::Unclickable_Object(const char *objectName) {
 	debugC(kDebugScript, "Unclickable_Object(%s)", objectName);
 	int objectId = _vm->_scene->findObject(objectName);
-	if (objectId == -1)
+	if (objectId == -1) {
 		return;
+	}
 	_vm->_scene->objectSetIsClickable(objectId, false, !_vm->_sceneIsLoading);
 }
 
diff --git a/engines/bladerunner/set.cpp b/engines/bladerunner/set.cpp
index 5427858..1b21508 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
diff --git a/engines/bladerunner/set.h b/engines/bladerunner/set.h
index b2aca93..dbf4b9a 100644
--- a/engines/bladerunner/set.h
+++ b/engines/bladerunner/set.h
@@ -107,8 +107,12 @@ public:
 
 private:
 	static bool isXZInWalkbox(float x, float z, const Walkbox &walkbox);
+#if BLADERUNNER_ORIGINAL_BUGS
+#else
 	void overrideSceneObjectInfo(int objectId) const;
 	void patchInAdditionalObjectsInSet();
+	void patchOutBadObjectsFromSet();
+#endif // BLADERUNNER_ORIGINAL_BUGS
 };
 
 } // End of namespace BladeRunner





More information about the Scummvm-git-logs mailing list