aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-08-06 21:40:35 -0400
committerPaul Gilbert2015-08-06 21:40:35 -0400
commit59bc9f846d639c2794ec41065092e49e8458c5f9 (patch)
treeede98a2958aa3da90e6f74705d045f71d3fe7a41 /engines
parentb2e98f4f52341c049df90d3410ff05f806bf1100 (diff)
downloadscummvm-rg350-59bc9f846d639c2794ec41065092e49e8458c5f9.tar.gz
scummvm-rg350-59bc9f846d639c2794ec41065092e49e8458c5f9.tar.bz2
scummvm-rg350-59bc9f846d639c2794ec41065092e49e8458c5f9.zip
SHERLOCK: RT: Properly implement cmdWalkHolmesAndNPCToCoords
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/tattoo/tattoo_people.cpp69
-rw-r--r--engines/sherlock/tattoo/tattoo_people.h5
-rw-r--r--engines/sherlock/tattoo/tattoo_talk.cpp12
3 files changed, 84 insertions, 2 deletions
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index b0dfa73faf..3738bbf418 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -1111,6 +1111,75 @@ void TattooPerson::walkHolmesToNPC() {
}
}
+void TattooPerson::walkBothToCoords(const PositionFacing &holmesDest, const PositionFacing &npcDest) {
+ Events &events = *_vm->_events;
+ TattooPeople &people = *(TattooPeople *)_vm->_people;
+ Scene &scene = *_vm->_scene;
+ Talk &talk = *_vm->_talk;
+ TattooPerson &holmes = people[HOLMES];
+ bool holmesStopped = false, npcStopped = false;
+
+ // Save the current cursor and change to the wait cursor
+ CursorId oldCursor = events.getCursor();
+ events.setCursor(WAIT);
+
+ holmes._centerWalk = false;
+ _centerWalk = false;
+
+ // Start Holmes walking to his dest
+ holmes._walkDest = Common::Point(holmesDest.x / FIXED_INT_MULTIPLIER + 10, holmesDest.y / FIXED_INT_MULTIPLIER);
+ people._allowWalkAbort = true;
+ holmes.goAllTheWay();
+
+ // Start the NPC walking to their dest
+ _walkDest = Common::Point(npcDest.x / FIXED_INT_MULTIPLIER + 10, npcDest.y / FIXED_INT_MULTIPLIER);
+ goAllTheWay();
+
+ // Clear the path variables
+ _npcIndex = _npcPause = 0;
+ Common::fill(&_npcPath[0], &_npcPath[100], 0);
+ _npcFacing = npcDest._facing;
+
+ // Now loop until both stop walking
+ do {
+ events.pollEvents();
+ scene.doBgAnim();
+
+ if (!holmes._walkCount && !holmesStopped) {
+ // Holmes finished walking
+ holmesStopped = true;
+
+ // Ensure Holmes is on the exact destination spot
+ holmes._position = holmesDest;
+ holmes._sequenceNumber = holmesDest._facing;
+ holmes.gotoStand();
+ }
+
+ if (!_walkCount && !npcStopped) {
+ // NPC finished walking
+ npcStopped = true;
+
+ // Ensure NPC is on the exact destination spot
+ _position = npcDest;
+ _sequenceNumber = npcDest._facing;
+ gotoStand();
+ }
+
+ } while (!_vm->shouldQuit() && (holmes._walkCount || _walkCount));
+
+ holmes._centerWalk = true;
+ _centerWalk = true;
+
+ // Do one last frame draw so that the lsat person to stop will be drawn in their final position
+ scene.doBgAnim();
+
+ _updateNPCPath = true;
+
+ if (!talk._talkToAbort)
+ // Restore original mouse cursor
+ events.setCursor(oldCursor);
+}
+
void TattooPerson::centerScreenOnPerson() {
Screen &screen = *_vm->_screen;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index 06c6776314..4e57cfe9b2 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -183,6 +183,11 @@ public:
void walkHolmesToNPC();
/**
+ * Walk both the specified character and Holmes to specified destination positions
+ */
+ void walkBothToCoords(const PositionFacing &holmesDest, const PositionFacing &npcDest);
+
+ /**
* This adjusts the sprites position, as well as it's animation sequence:
*/
virtual void adjustSprite();
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index 260aee8857..0d385008b3 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -862,13 +862,21 @@ OpcodeReturn TattooTalk::cmdWalkHomesAndNPCToCoords(const byte *&str) {
person.pushNPCPath();
person._npcMoved = true;
+ // Get destination position and facing for Holmes
int xp = (str[0] - 1) * 256 + str[1] - 1;
if (xp > 16384)
xp = -1 * (xp - 16384);
int yp = (str[2] - 1) * 256 + str[3] - 1;
+ PositionFacing holmesDest(xp * FIXED_INT_MULTIPLIER, yp * FIXED_INT_MULTIPLIER, DIRECTION_CONVERSION[str[4] - 1]);
- person.walkToCoords(Point32(xp * FIXED_INT_MULTIPLIER, yp * FIXED_INT_MULTIPLIER),
- DIRECTION_CONVERSION[str[4] - 1]);
+ // Get destination position and facing for specified NPC
+ xp = (str[5] - 1) * 256 + str[6] - 1;
+ if (xp > 16384)
+ xp = -1 * (xp - 16384);
+ yp = (str[7] - 1) * 256 + str[8] - 1;
+ PositionFacing npcDest(xp * FIXED_INT_MULTIPLIER, yp * FIXED_INT_MULTIPLIER, DIRECTION_CONVERSION[str[9] - 1]);
+
+ person.walkBothToCoords(holmesDest, npcDest);
if (_talkToAbort)
return RET_EXIT;