diff options
Diffstat (limited to 'engines/sherlock/scalpel/scalpel_people.cpp')
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp index af2bdc0256..94042e7a13 100644 --- a/engines/sherlock/scalpel/scalpel_people.cpp +++ b/engines/sherlock/scalpel/scalpel_people.cpp @@ -333,6 +333,39 @@ void ScalpelPerson::setWalking() { _frameNumber = oldFrame; } +void ScalpelPerson::walkToCoords(const Point32 &destPos, int destDir) { + Events &events = *_vm->_events; + People &people = *_vm->_people; + Scene &scene = *_vm->_scene; + Talk &talk = *_vm->_talk; + + CursorId oldCursor = events.getCursor(); + events.setCursor(WAIT); + + _walkDest = Common::Point(destPos.x / FIXED_INT_MULTIPLIER + 10, destPos.y / FIXED_INT_MULTIPLIER); + people._allowWalkAbort = true; + goAllTheWay(); + + // Keep calling doBgAnim until the walk is done + do { + events.pollEventsAndWait(); + scene.doBgAnim(); + } while (!_vm->shouldQuit() && _walkCount); + + if (!talk._talkToAbort) { + // Put character exactly on destination position, and set direction + _position = destPos; + _sequenceNumber = destDir; + gotoStand(); + + // Draw Holmes facing the new direction + scene.doBgAnim(); + + if (!talk._talkToAbort) + events.setCursor(oldCursor); + } +} + Common::Point ScalpelPerson::getSourcePoint() const { return Common::Point(_position.x / FIXED_INT_MULTIPLIER + frameWidth() / 2, _position.y / FIXED_INT_MULTIPLIER); |