aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/people.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-12 23:13:21 -0400
committerPaul Gilbert2015-06-12 23:13:21 -0400
commit6221c1de82bae650158b54a4b04f8f319416ac63 (patch)
tree6851d7d6b98671610e53a8466c81b443521ccebf /engines/sherlock/people.cpp
parent5dc79a8f3272f8e5c9131fac925d4533a25ab4d9 (diff)
downloadscummvm-rg350-6221c1de82bae650158b54a4b04f8f319416ac63.tar.gz
scummvm-rg350-6221c1de82bae650158b54a4b04f8f319416ac63.tar.bz2
scummvm-rg350-6221c1de82bae650158b54a4b04f8f319416ac63.zip
SHERLOCK: Move walkToCoords from People to Person
Diffstat (limited to 'engines/sherlock/people.cpp')
-rw-r--r--engines/sherlock/people.cpp67
1 files changed, 33 insertions, 34 deletions
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 2945d37a25..00d77d9f43 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -158,6 +158,39 @@ void Person::goAllTheWay() {
}
}
+void Person::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);
+
+ people._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);
+ }
+}
+
/*----------------------------------------------------------------*/
People *People::init(SherlockEngine *vm) {
@@ -270,40 +303,6 @@ bool People::freeWalk() {
return result;
}
-void People::walkToCoords(const Point32 &destPos, int destDir) {
- Events &events = *_vm->_events;
- 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);
- _allowWalkAbort = true;
- _data[PLAYER]->goAllTheWay();
-
- // Keep calling doBgAnim until the walk is done
- do {
- events.pollEventsAndWait();
- scene.doBgAnim();
- } while (!_vm->shouldQuit() && _data[PLAYER]->_walkCount);
-
- if (!talk._talkToAbort) {
- // Put player exactly on destination position, and set direction
- _data[PLAYER]->_position = destPos;
-assert(_data[PLAYER]->_position.y >= 10000);/***DEBUG****/
-
- _data[PLAYER]->_sequenceNumber = destDir;
- _data[PLAYER]->gotoStand();
-
- // Draw Holmes facing the new direction
- scene.doBgAnim();
-
- if (!talk._talkToAbort)
- events.setCursor(oldCursor);
- }
-}
-
int People::findSpeaker(int speaker) {
Scene &scene = *_vm->_scene;
const char *portrait = _characters[speaker]._portrait;