diff options
author | Paul Gilbert | 2015-07-01 19:18:26 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-07-01 19:18:26 -0400 |
commit | 704dd8140b28668feeb3849c7c13044d8eb122ed (patch) | |
tree | 62cbe97d62827c89936e0deaf11688bd6c1eff53 /engines/sherlock | |
parent | 710aeb380b5becc71228800a047ea47a50132309 (diff) | |
download | scummvm-rg350-704dd8140b28668feeb3849c7c13044d8eb122ed.tar.gz scummvm-rg350-704dd8140b28668feeb3849c7c13044d8eb122ed.tar.bz2 scummvm-rg350-704dd8140b28668feeb3849c7c13044d8eb122ed.zip |
SHERLOCK: RT: Fix missing code in setWalking
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/tattoo/tattoo_people.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp index b4c96fe22a..42a7d26a7d 100644 --- a/engines/sherlock/tattoo/tattoo_people.cpp +++ b/engines/sherlock/tattoo/tattoo_people.cpp @@ -420,6 +420,8 @@ void TattooPerson::setWalking() { if (_sequenceNumber == WALK_LEFT || _sequenceNumber == WALK_RIGHT) { _delta.x = _delta.x / speed.x * diagSpeed.x; _delta.y = (delta.y * FIXED_INT_MULTIPLIER) / (delta.x * 10 / diagSpeed.x); + + _walkCount = delta.x * 10 / diagSpeed.x; } switch (_sequenceNumber) { @@ -434,6 +436,7 @@ void TattooPerson::setWalking() { if (_sequenceNumber == WALK_LEFT || _sequenceNumber == WALK_RIGHT) { _delta.x = _delta.x / speed.x * diagSpeed.x; _delta.y = -1 * (delta.y * FIXED_INT_MULTIPLIER) / (delta.x * 10 / diagSpeed.x); + _walkCount = (delta.x * 10) / diagSpeed.x; } @@ -453,16 +456,25 @@ void TattooPerson::setWalking() { _sequenceNumber = WALK_UP; _delta.y = speed.y * -FIXED_INT_MULTIPLIER; } else { + speed.y = diagSpeed.y; _sequenceNumber = WALK_DOWN; _delta.y = speed.y * FIXED_INT_MULTIPLIER; } // Set the delta x - _delta.x = (delta.x * FIXED_INT_MULTIPLIER) / (delta.y / speed.y); - if (_walkDest.x < (_position.x / FIXED_INT_MULTIPLIER)) + if (delta.y * 10 / speed.y) + _delta.x = (delta.x * FIXED_INT_MULTIPLIER) / (delta.y * 10 / speed.y); + else + _delta.x = (delta.x * FIXED_INT_MULTIPLIER) / delta.y; + + if (_walkDest.x < _position.y / FIXED_INT_MULTIPLIER) _delta.x = -_delta.x; - _walkCount = delta.y / speed.y; + // Set how many times we should add the delta's to the players position + if (delta.y * 10 / speed.y) + _walkCount = delta.y * 10 / speed.y; + else + _walkCount = delta.y; } } @@ -501,7 +513,7 @@ void TattooPerson::walkToCoords(const Point32 &destPos, int destDir) { CursorId oldCursor = events.getCursor(); events.setCursor(WAIT); - _walkDest = Common::Point(_position.x / FIXED_INT_MULTIPLIER, _position.y / FIXED_INT_MULTIPLIER); + _walkDest = Common::Point(destPos.x / FIXED_INT_MULTIPLIER, destPos.y / FIXED_INT_MULTIPLIER); bool isHolmes = this == &people[HOLMES]; if (isHolmes) { |