diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/people.h | 5 | ||||
-rw-r--r-- | engines/sherlock/scene.cpp | 14 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_people.cpp | 9 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_people.h | 10 |
4 files changed, 27 insertions, 11 deletions
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h index b59522e4b8..d790e4ccb0 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 2ae45b0530..8669d4c092 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 7aaa0a082c..94a40780e6 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 fb3f6e7628..0983ca4dcc 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 { |