diff options
Diffstat (limited to 'engines/sherlock/scalpel')
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.cpp | 119 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.h | 11 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_scene.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_user_interface.cpp | 2 |
4 files changed, 68 insertions, 68 deletions
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp index 82840b22a4..4fcdff086a 100644 --- a/engines/sherlock/scalpel/scalpel_people.cpp +++ b/engines/sherlock/scalpel/scalpel_people.cpp @@ -49,7 +49,7 @@ void ScalpelPerson::adjustSprite() { people._walkDest = people._walkTo.pop(); people.setWalking(); } else { - people.gotoStand(*this); + gotoStand(); } } } @@ -57,22 +57,22 @@ void ScalpelPerson::adjustSprite() { if (_type == CHARACTER && !map._active) { if ((_position.y / FIXED_INT_MULTIPLIER) > LOWER_LIMIT) { _position.y = LOWER_LIMIT * FIXED_INT_MULTIPLIER; - people.gotoStand(*this); + gotoStand(); } if ((_position.y / FIXED_INT_MULTIPLIER) < UPPER_LIMIT) { _position.y = UPPER_LIMIT * FIXED_INT_MULTIPLIER; - people.gotoStand(*this); + gotoStand(); } if ((_position.x / FIXED_INT_MULTIPLIER) < LEFT_LIMIT) { _position.x = LEFT_LIMIT * FIXED_INT_MULTIPLIER; - people.gotoStand(*this); + gotoStand(); } if ((_position.x / FIXED_INT_MULTIPLIER) > RIGHT_LIMIT) { _position.x = RIGHT_LIMIT * FIXED_INT_MULTIPLIER; - people.gotoStand(*this); + gotoStand(); } } else if (!map._active) { _position.y = CLIP((int)_position.y, (int)UPPER_LIMIT, (int)LOWER_LIMIT); @@ -118,9 +118,9 @@ void ScalpelPerson::adjustSprite() { if (exit) { scene._goToScene = exit->_scene; - if (exit->_people.x != 0) { - people._hSavedPos = exit->_people; - people._hSavedFacing = exit->_peopleDir; + if (exit->_newPosition.x != 0) { + people._hSavedPos = exit->_newPosition; + people._hSavedFacing = exit->_newFacing; if (people._hSavedFacing > 100 && people._hSavedPos.x < 1) people._hSavedPos.x = 100; @@ -129,6 +129,58 @@ void ScalpelPerson::adjustSprite() { } } + +void ScalpelPerson::gotoStand() { + ScalpelMap &map = *(ScalpelMap *)_vm->_map; + People &people = *_vm->_people; + _walkTo.clear(); + _walkCount = 0; + + switch (_sequenceNumber) { + case Scalpel::WALK_UP: + _sequenceNumber = STOP_UP; + break; + case WALK_DOWN: + _sequenceNumber = STOP_DOWN; + break; + case TALK_LEFT: + case WALK_LEFT: + _sequenceNumber = STOP_LEFT; + break; + case TALK_RIGHT: + case WALK_RIGHT: + _sequenceNumber = STOP_RIGHT; + break; + case WALK_UPRIGHT: + _sequenceNumber = STOP_UPRIGHT; + break; + case WALK_UPLEFT: + _sequenceNumber = STOP_UPLEFT; + break; + case WALK_DOWNRIGHT: + _sequenceNumber = STOP_DOWNRIGHT; + break; + case WALK_DOWNLEFT: + _sequenceNumber = STOP_DOWNLEFT; + break; + default: + break; + } + + // Only restart frame at 0 if the sequence number has changed + if (_oldWalkSequence != -1 || _sequenceNumber == Scalpel::STOP_UP) + _frameNumber = 0; + + if (map._active) { + _sequenceNumber = 0; + people[PLAYER]._position.x = (map[map._charPoint].x - 6) * FIXED_INT_MULTIPLIER; + people[PLAYER]._position.y = (map[map._charPoint].y + 10) * FIXED_INT_MULTIPLIER; + } + + _oldWalkSequence = -1; + people._allowWalkAbort = true; +} + /*----------------------------------------------------------------*/ ScalpelPeople::ScalpelPeople(SherlockEngine *vm) : People(vm) { @@ -237,57 +289,6 @@ void ScalpelPeople::setTalkSequence(int speaker, int sequenceNum) { } } -void ScalpelPeople::gotoStand(Sprite &sprite) { - ScalpelMap &map = *(ScalpelMap *)_vm->_map; - _walkTo.clear(); - sprite._walkCount = 0; - - switch (sprite._sequenceNumber) { - case Scalpel::WALK_UP: - sprite._sequenceNumber = STOP_UP; - break; - case WALK_DOWN: - sprite._sequenceNumber = STOP_DOWN; - break; - case TALK_LEFT: - case WALK_LEFT: - sprite._sequenceNumber = STOP_LEFT; - break; - case TALK_RIGHT: - case WALK_RIGHT: - sprite._sequenceNumber = STOP_RIGHT; - break; - case WALK_UPRIGHT: - sprite._sequenceNumber = STOP_UPRIGHT; - break; - case WALK_UPLEFT: - sprite._sequenceNumber = STOP_UPLEFT; - break; - case WALK_DOWNRIGHT: - sprite._sequenceNumber = STOP_DOWNRIGHT; - break; - case WALK_DOWNLEFT: - sprite._sequenceNumber = STOP_DOWNLEFT; - break; - default: - break; - } - - // Only restart frame at 0 if the sequence number has changed - if (_oldWalkSequence != -1 || sprite._sequenceNumber == Scalpel::STOP_UP) - sprite._frameNumber = 0; - - if (map._active) { - sprite._sequenceNumber = 0; - _data[PLAYER]->_position.x = (map[map._charPoint].x - 6) * FIXED_INT_MULTIPLIER; - _data[PLAYER]->_position.y = (map[map._charPoint].y + 10) * FIXED_INT_MULTIPLIER; - } - - _oldWalkSequence = -1; - _allowWalkAbort = true; -} - - } // End of namespace Scalpel } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_people.h b/engines/sherlock/scalpel/scalpel_people.h index dac685b26c..cc4e6b6605 100644 --- a/engines/sherlock/scalpel/scalpel_people.h +++ b/engines/sherlock/scalpel/scalpel_people.h @@ -50,6 +50,11 @@ public: * This adjusts the sprites position, as well as it's animation sequence: */ virtual void adjustSprite(); + + /** + * Bring a moving character to a standing position + */ + virtual void gotoStand(); }; class ScalpelPeople : public People { @@ -71,12 +76,6 @@ public: * Change the sequence of the scene background object associated with the specified speaker. */ virtual void setTalkSequence(int speaker, int sequenceNum = 1); - - /** - * Bring a moving character to a standing position. If the Scalpel chessboard - * is being displayed, then the chraracter will always face down. - */ - virtual void gotoStand(Sprite &sprite); }; } // End of namespace Scalpel diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp index e3bc6483eb..47ec639559 100644 --- a/engines/sherlock/scalpel/scalpel_scene.cpp +++ b/engines/sherlock/scalpel/scalpel_scene.cpp @@ -660,7 +660,7 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { if (tpPos.x != -1) { people[PLAYER]._position = tpPos; // Place the player people[PLAYER]._sequenceNumber = tpDir; - people.gotoStand(people[PLAYER]); + people[PLAYER].gotoStand(); } if (playRate < 0) @@ -689,7 +689,7 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) { people[PLAYER]._position = tpPos; people[PLAYER]._sequenceNumber = tpDir; - people.gotoStand(people[PLAYER]); + people[PLAYER].gotoStand(); } events.setCursor(oldCursor); diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index 31399b0ad9..a334632b25 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -2232,7 +2232,7 @@ void ScalpelUserInterface::checkAction(ActionType &action, const char *const mes // Ensure Holmes is on the exact intended location people[PLAYER]._position = pt; people[PLAYER]._sequenceNumber = dir; - people.gotoStand(people[PLAYER]); + people[PLAYER].gotoStand(); talk.talkTo(action._names[nameIdx].c_str() + 2); if (ch == 'T') |