[Scummvm-cvs-logs] scummvm master -> 3e0383ac0c3101460453d8305468db8cc9ac38b2

dreammaster dreammaster at scummvm.org
Sat Jul 25 23:25:32 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:
3e0383ac0c SHERLOCK: RT: Fix centering screen on person when scene starts


Commit: 3e0383ac0c3101460453d8305468db8cc9ac38b2
    https://github.com/scummvm/scummvm/commit/3e0383ac0c3101460453d8305468db8cc9ac38b2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-25T17:24:31-04:00

Commit Message:
SHERLOCK: RT: Fix centering screen on person when scene starts

Changed paths:
    engines/sherlock/people.h
    engines/sherlock/scene.cpp
    engines/sherlock/tattoo/tattoo_people.cpp
    engines/sherlock/tattoo/tattoo_people.h



diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index b59522e..d790e4c 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -87,6 +87,11 @@ public:
 	 * Walk to the co-ordinates passed, and then face the given direction
 	 */
 	virtual void walkToCoords(const Point32 &destPos, int destDir) = 0;
+
+	/**
+	 * Center the visible screen so that the person is in the center of the screen
+	 */
+	virtual void centerScreenOnPerson() {}
 };
 
 class SherlockEngine;
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 2ae45b0..8669d4c 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -1207,15 +1207,6 @@ void Scene::transitionToScene() {
 		// Standard info, so set it
 		people[HOLMES]._position = hSavedPos;
 		people[HOLMES]._sequenceNumber = hSavedFacing;
-
-		if (saves._justLoaded && IS_ROSE_TATTOO) {
-			Tattoo::TattooUserInterface &ui = *(Tattoo::TattooUserInterface *)_vm->_ui;
-
-			// For scrolling scenes, make sure the player is on-screen
-			ui._targetScroll.x = CLIP(people[HOLMES]._position.x / FIXED_INT_MULTIPLIER -
-				SHERLOCK_SCREEN_WIDTH / 8 - 250, 0, screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH);
-			screen._currentScroll = ui._targetScroll;
-		}
 	} else {
 		// It's canimation information
 		cAnimNum = hSavedFacing - 101;
@@ -1230,6 +1221,11 @@ void Scene::transitionToScene() {
 		people[HOLMES]._position = Common::Point(0, 0);
 	}
 
+	// If the scene is capable of scrolling, set the current scroll so that whoever has control 
+	// of the scroll code is in the middle of the screen
+	if (screen._backBuffer1.w() > SHERLOCK_SCREEN_WIDTH)
+		people[people._walkControl].centerScreenOnPerson();
+
 	for (uint objIdx = 0; objIdx < _bgShapes.size(); ++objIdx) {
 		Object &obj = _bgShapes[objIdx];
 
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index 7aaa0a0..94a4078 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -1105,6 +1105,15 @@ void TattooPerson::walkHolmesToNPC() {
 	}
 }
 
+void TattooPerson::centerScreenOnPerson() {
+	Screen &screen = *_vm->_screen;
+	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
+
+	ui._targetScroll.x = CLIP(_position.x / FIXED_INT_MULTIPLIER - SHERLOCK_SCREEN_WIDTH / 2,
+		0, screen._backBuffer1.w() - SHERLOCK_SCREEN_WIDTH);
+	screen._currentScroll = ui._targetScroll;
+}
+
 /*----------------------------------------------------------------*/
 
 TattooPeople::TattooPeople(SherlockEngine *vm) : People(vm) {
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index fb3f6e7..0983ca4 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -176,6 +176,12 @@ public:
 	 */
 	void synchronize(Serializer &s);
 
+
+	/**
+	 * Walk Holmes to the NPC
+	 */
+	void walkHolmesToNPC();
+
 	/**
 	 * This adjusts the sprites position, as well as it's animation sequence:
 	 */
@@ -207,9 +213,9 @@ public:
 	virtual void setObjTalkSequence(int seq);
 
 	/**
-	 * Walk Holmes to the NPC
+	 * Center the visible screen so that the person is in the center of the screen
 	 */
-	void walkHolmesToNPC();
+	virtual void centerScreenOnPerson();
 };
 
 class TattooPeople : public People {






More information about the Scummvm-git-logs mailing list