[Scummvm-git-logs] scummvm master -> 433c7ce38ff46dcd1f085e8d5c3fa1d504a6bb5a

neuromancer noreply at scummvm.org
Thu Nov 17 12:36:19 UTC 2022


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:
433c7ce38f FREESCAPE: fixed a bug where several conditions are triggered producing a change in the current area


Commit: 433c7ce38ff46dcd1f085e8d5c3fa1d504a6bb5a
    https://github.com/scummvm/scummvm/commit/433c7ce38ff46dcd1f085e8d5c3fa1d504a6bb5a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-11-17T13:37:04+01:00

Commit Message:
FREESCAPE: fixed a bug where several conditions are triggered producing a change in the current area

Changed paths:
    engines/freescape/movement.cpp


diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index d4f26ff26e0..3112c6dce81 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -314,10 +314,23 @@ bool FreescapeEngine::checkCollisions(bool executeCode) {
 	boundingBox.expand(v3);
 
 	objs = _currentArea->checkCollisions(boundingBox);
+
+	// sort so the condition from those objects that are larger are executed last
+	struct {
+		bool operator()(Object *object1, Object *object2) {
+			return object1->getSize().length() < object2->getSize().length();
+		};
+	} compareObjectsSizes;
+
+	Common::sort(objs.begin(), objs.end(), compareObjectsSizes);
+	uint16 areaID = _currentArea->getAreaID();
+
 	for (auto &obj : objs) {
 		GeometricObject *gobj = (GeometricObject *)obj;
 		debugC(1, kFreescapeDebugMove, "Collided with object id %d of size %f %f %f", gobj->getObjectID(), gobj->getSize().x(), gobj->getSize().y(), gobj->getSize().z());
 		executeObjectConditions(gobj, false, true);
+		if (areaID != _currentArea->getAreaID())
+			break;
 	}
 	// We still need to return the original result, not the collision using the expanded bounding box
 	// This will avoid detecting the floor constantly




More information about the Scummvm-git-logs mailing list