diff options
-rw-r--r-- | engines/sherlock/objects.cpp | 22 | ||||
-rw-r--r-- | engines/sherlock/people.cpp | 13 | ||||
-rw-r--r-- | engines/sherlock/people.h | 2 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/scene.cpp | 34 | ||||
-rw-r--r-- | engines/sherlock/scene.h | 2 | ||||
-rw-r--r-- | engines/sherlock/sherlock.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/talk.cpp | 4 |
8 files changed, 45 insertions, 38 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index 49f64c85b0..7341fc3b30 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -165,11 +165,11 @@ void Sprite::adjustSprite() { scene._goToScene = exit->_scene; if (exit->_people.x != 0) { - scene._hsavedPos = exit->_people; - scene._hsavedFs = exit->_peopleDir; + people._hSavedPos = exit->_people; + people._hSavedFacing = exit->_peopleDir; - if (scene._hsavedFs > 100 && scene._hsavedPos.x < 1) - scene._hsavedPos.x = 100; + if (people._hSavedFacing > 100 && people._hSavedPos.x < 1) + people._hSavedPos.x = 100; } } } @@ -869,18 +869,18 @@ int Object::checkNameForCodes(const Common::String &name, const char *const mess ++p; Common::String s(p, p + 3); - scene._hsavedPos.x = atoi(s.c_str()); + people._hSavedPos.x = atoi(s.c_str()); s = Common::String(p + 3, p + 6); - scene._hsavedPos.y = atoi(s.c_str()); + people._hSavedPos.y = atoi(s.c_str()); s = Common::String(p + 6, p + 9); - scene._hsavedFs = atoi(s.c_str()); - if (scene._hsavedFs == 0) - scene._hsavedFs = 10; + people._hSavedFacing = atoi(s.c_str()); + if (people._hSavedFacing == 0) + people._hSavedFacing = 10; } else if ((p = strchr(name.c_str(), '/')) != nullptr) { - scene._hsavedPos = Common::Point(1, 0); - scene._hsavedFs = 100 + atoi(p + 1); + people._hSavedPos = Common::Point(1, 0); + people._hSavedFacing = 100 + atoi(p + 1); } } else { scene._goToScene = 100; diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp index e126757231..43e1fa046b 100644 --- a/engines/sherlock/people.cpp +++ b/engines/sherlock/people.cpp @@ -204,6 +204,8 @@ People::People(SherlockEngine *vm) : _vm(vm), _player(_data[0]) { _speakerFlip = false; _holmesFlip = false; _holmesQuotient = 0; + _hSavedPos = Common::Point(-1, -1); + _hSavedFacing = -1; _portrait._sequences = new byte[32]; } @@ -708,10 +710,15 @@ void People::setTalking(int speaker) { */ void People::synchronize(Common::Serializer &s) { s.syncAsByte(_holmesOn); - s.syncAsSint16LE(_data[AL]._position.x); - s.syncAsSint16LE(_data[AL]._position.y); - s.syncAsSint16LE(_data[AL]._sequenceNumber); + s.syncAsSint16LE(_player._position.x); + s.syncAsSint16LE(_player._position.y); + s.syncAsSint16LE(_player._sequenceNumber); s.syncAsSint16LE(_holmesQuotient); + + if (s.isLoading()) { + _hSavedPos = _player._position; + _hSavedFacing = _player._sequenceNumber; + } } } // End of namespace Sherlock diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h index 8a7476a33a..f1ed3496a1 100644 --- a/engines/sherlock/people.h +++ b/engines/sherlock/people.h @@ -74,6 +74,8 @@ private: public: ImageFile *_talkPics; Common::Point _walkDest; + Common::Point _hSavedPos; + int _hSavedFacing; Common::Queue<Common::Point> _walkTo; Person &_player; bool _holmesOn; diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 2ca9f80c42..65ca61b09f 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -479,8 +479,8 @@ void ScalpelEngine::startScene() { _scene->_goToScene = _map->show(); _sound->freeSong(); - _scene->_hsavedPos = Common::Point(-1, -1); - _scene->_hsavedFs = -1; + _people->_hSavedPos = Common::Point(-1, -1); + _people->_hSavedFacing = -1; } // Some rooms are prologue cutscenes, rather than normal game scenes. These are: diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index d9161e25c0..2d0f6fd751 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -97,8 +97,6 @@ Scene::Scene(SherlockEngine *vm): _vm(vm) { _version = 0; _lzwMode = false; _invGraphicItems = 0; - _hsavedPos = Common::Point(-1, -1); - _hsavedFs = -1; _cAnimFramePause = 0; _restoreFlag = false; _invLookFlag = false; @@ -579,48 +577,50 @@ void Scene::transitionToScene() { SaveManager &saves = *_vm->_saves; Screen &screen = *_vm->_screen; Talk &talk = *_vm->_talk; + Common::Point &hSavedPos = people._hSavedPos; + int &hSavedFacing = people._hSavedFacing; const int FS_TRANS[8] = { STOP_UP, STOP_UPRIGHT, STOP_RIGHT, STOP_DOWNRIGHT, STOP_DOWN, STOP_DOWNLEFT, STOP_LEFT, STOP_UPLEFT }; - if (_hsavedPos.x < 1) { + if (hSavedPos.x < 1) { // No exit information from last scene-check entrance info if (_entrance._startPosition.x < 1) { // No entrance info either, so use defaults - _hsavedPos = Common::Point(16000, 10000); - _hsavedFs = 4; + hSavedPos = Common::Point(16000, 10000); + hSavedFacing = 4; } else { // setup entrance info - _hsavedPos = _entrance._startPosition; - _hsavedFs = _entrance._startDir; + hSavedPos = _entrance._startPosition; + hSavedFacing = _entrance._startDir; } } else { // Exit information exists, translate it to real sequence info // Note: If a savegame was just loaded, then the data is already correct. // Otherwise, this is a linked scene or entrance info, and must be translated - if (_hsavedFs < 8 && !saves._justLoaded) { - _hsavedFs = FS_TRANS[_hsavedFs]; - _hsavedPos.x *= 100; - _hsavedPos.y *= 100; + if (hSavedFacing < 8 && !saves._justLoaded) { + hSavedFacing = FS_TRANS[hSavedFacing]; + hSavedPos.x *= 100; + hSavedPos.y *= 100; } } int cAnimNum = -1; - if (_hsavedFs < 101) { + if (hSavedFacing < 101) { // Standard info, so set it - people[PLAYER]._position = _hsavedPos; - people[PLAYER]._sequenceNumber = _hsavedFs; + people[PLAYER]._position = hSavedPos; + people[PLAYER]._sequenceNumber = hSavedFacing; } else { // It's canimation information - cAnimNum = _hsavedFs - 101; + cAnimNum = hSavedFacing - 101; } // Reset positioning for next load - _hsavedPos = Common::Point(-1, -1); - _hsavedFs = -1; + hSavedPos = Common::Point(-1, -1); + hSavedFacing = -1; if (cAnimNum != -1) { // Prevent Holmes from being drawn diff --git a/engines/sherlock/scene.h b/engines/sherlock/scene.h index cc01fa92ab..892163a2f6 100644 --- a/engines/sherlock/scene.h +++ b/engines/sherlock/scene.h @@ -130,8 +130,6 @@ public: Common::Array<Exit> _exits; SceneEntry _entrance; Common::Array<SceneSound> _sounds; - Common::Point _hsavedPos; - int _hsavedFs; Common::Array<Object> _canimShapes; bool _restoreFlag; int _animating; diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index d880257406..406b796fc9 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -147,7 +147,7 @@ void SherlockEngine::sceneLoop() { // Handle any input from the keyboard or mouse handleInput(); - if (_scene->_hsavedPos.x == -1) { + if (_people->_hSavedPos.x == -1) { _canLoadSave = true; _scene->doBgAnim(); _canLoadSave = false; diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index c605f9a7e9..0793552846 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -1361,8 +1361,8 @@ void Talk::doScript(const Common::String &script) { // Run a canimation? if (str[2] > 100) { - scene._hsavedFs = str[2]; - scene._hsavedPos = Common::Point(160, 100); + people._hSavedFacing = (byte)str[2]; + people._hSavedPos = Common::Point(160, 100); } } str += 6; |