[Scummvm-cvs-logs] scummvm master -> 86a33cf4280aec06a160716ead325342d17a9839

dreammaster dreammaster at scummvm.org
Sun Jul 26 18:24:26 CEST 2015


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:
86a33cf428 SHERLOCK: RT: Correct order of precedence of shapes in findBgShape


Commit: 86a33cf4280aec06a160716ead325342d17a9839
    https://github.com/scummvm/scummvm/commit/86a33cf4280aec06a160716ead325342d17a9839
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-26T12:23:26-04:00

Commit Message:
SHERLOCK: RT: Correct order of precedence of shapes in findBgShape

Changed paths:
    engines/sherlock/scalpel/scalpel_scene.cpp
    engines/sherlock/scalpel/scalpel_scene.h
    engines/sherlock/scene.cpp
    engines/sherlock/scene.h
    engines/sherlock/tattoo/tattoo_scene.cpp



diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp
index 9c36e84..2f60ceb 100644
--- a/engines/sherlock/scalpel/scalpel_scene.cpp
+++ b/engines/sherlock/scalpel/scalpel_scene.cpp
@@ -727,6 +727,27 @@ int ScalpelScene::closestZone(const Common::Point &pt) {
 	return zone;
 }
 
+int ScalpelScene::findBgShape(const Common::Point &pt) {
+	if (!_doBgAnimDone)
+		// New frame hasn't been drawn yet
+		return -1;
+
+	for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) {
+		Object &o = _bgShapes[idx];
+		if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN
+			&& o._aType <= PERSON) {
+			if (o.getNewBounds().contains(pt))
+				return idx;
+		}
+		else if (o._type == NO_SHAPE) {
+			if (o.getNoShapeBounds().contains(pt))
+				return idx;
+		}
+	}
+
+	return -1;
+}
+
 } // End of namespace Scalpel
 
 } // End of namespace Sherlock
diff --git a/engines/sherlock/scalpel/scalpel_scene.h b/engines/sherlock/scalpel/scalpel_scene.h
index 62dd1c7..8fe3b66 100644
--- a/engines/sherlock/scalpel/scalpel_scene.h
+++ b/engines/sherlock/scalpel/scalpel_scene.h
@@ -89,6 +89,12 @@ public:
 	 *		A negative playRate can also be specified to play the animation in reverse
 	 */
 	virtual int startCAnim(int cAnimNum, int playRate = 1);
+
+	/**
+	 * Attempts to find a background shape within the passed bounds. If found,
+	 * it will return the shape number, or -1 on failure.
+	 */
+	virtual int findBgShape(const Common::Point &pt);
 };
 
 } // End of namespace Scalpel
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 8669d4c..592c96f 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -1340,26 +1340,6 @@ Exit *Scene::checkForExit(const Common::Rect &r) {
 	return nullptr;
 }
 
-int Scene::findBgShape(const Common::Point &pt) {
-	if (!_doBgAnimDone)
-		// New frame hasn't been drawn yet
-		return -1;
-
-	for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) {
-		Object &o = _bgShapes[idx];
-		if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN
-			&& o._aType <= PERSON) {
-			if (o.getNewBounds().contains(pt))
-				return idx;
-		} else if (o._type == NO_SHAPE) {
-			if (o.getNoShapeBounds().contains(pt))
-				return idx;
-		}
-	}
-
-	return -1;
-}
-
 int Scene::checkForZones(const Common::Point &pt, int zoneType) {
 	int matches = 0;
 
diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h
index 0fbda38..cba4f11 100644
--- a/engines/sherlock/scene.h
+++ b/engines/sherlock/scene.h
@@ -289,7 +289,7 @@ public:
 	 * Attempts to find a background shape within the passed bounds. If found,
 	 * it will return the shape number, or -1 on failure.
 	 */
-	virtual int findBgShape(const Common::Point &pt);
+	virtual int findBgShape(const Common::Point &pt) = 0;
 
 	/**
 	 * Synchronize the data for a savegame
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index e40b4d6..2a90a51 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -724,46 +724,47 @@ void TattooScene::setNPCPath(int npc) {
 
 int TattooScene::findBgShape(const Common::Point &pt) {
 	People &people = *_vm->_people;
+	UserInterface &ui = *_vm->_ui;
 
 	if (!_doBgAnimDone)
 		// New frame hasn't been drawn yet
 		return -1;
 
-	int result = Scene::findBgShape(pt);
-	if (result == -1) {
-		if (_labTableScene) {
-			// Check for SOLID objects in the lab scene
-			for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) {
-				Object &o = _bgShapes[idx];
-				if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN && o._aType == SOLID) {
-					if (o.getNewBounds().contains(pt))
-						return idx;
-				}
-			}
+
+	for (int idx = (int)_bgShapes.size() - 1; idx >= 0; --idx) {
+		Object &o = _bgShapes[idx];
+
+		if (o._type != INVALID && o._type != NO_SHAPE && o._type != HIDDEN && 
+				(o._aType <= PERSON || (ui._menuMode == LAB_MODE && o._aType == SOLID))) {
+			if (o.getNewBounds().contains(pt))
+				return idx;
+		} else if (o._type == NO_SHAPE) {
+			if (o.getNoShapeBounds().contains(pt))
+				return idx;
 		}
+	}
 
-		// No shape found, so check whether a character is highlighted
-		for (int idx = 1; idx < MAX_CHARACTERS && result == -1; ++idx) {
-			Person &person = people[idx];
+	// If no shape found, so check whether a character is highlighted
+	for (int idx = 1; idx < MAX_CHARACTERS; ++idx) {
+		Person &person = people[idx];
 
-			if (person._type == CHARACTER) {
-				int scaleVal = getScaleVal(person._position);
-				Common::Rect charRect;
+		if (person._type == CHARACTER) {
+			int scaleVal = getScaleVal(person._position);
+			Common::Rect charRect;
 
-				if (scaleVal == SCALE_THRESHOLD)
-					charRect = Common::Rect(person.frameWidth(), person.frameHeight());
-				else
-					charRect = Common::Rect(person._imageFrame->sDrawXSize(scaleVal), person._imageFrame->sDrawYSize(scaleVal));
-				charRect.moveTo(person._position.x / FIXED_INT_MULTIPLIER, person._position.y / FIXED_INT_MULTIPLIER
-					- charRect.height());
+			if (scaleVal == SCALE_THRESHOLD)
+				charRect = Common::Rect(person.frameWidth(), person.frameHeight());
+			else
+				charRect = Common::Rect(person._imageFrame->sDrawXSize(scaleVal), person._imageFrame->sDrawYSize(scaleVal));
+			charRect.moveTo(person._position.x / FIXED_INT_MULTIPLIER, person._position.y / FIXED_INT_MULTIPLIER
+				- charRect.height());
 
-				if (charRect.contains(pt))
-					result = 1000 + idx;
-			}
+			if (charRect.contains(pt))
+				return 1000 + idx;
 		}
 	}
 
-	return result;
+	return -1;
 }
 
 void TattooScene::synchronize(Serializer &s) {






More information about the Scummvm-git-logs mailing list