diff options
author | Paul Gilbert | 2015-04-24 17:47:58 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-04-24 17:47:58 -0500 |
commit | 930600c85740012db40a11eb06b02b0c78356529 (patch) | |
tree | f020f946dcdec7b2a975cacf9843d474880d0afb /engines/sherlock | |
parent | 6eb51c3d50e5134c4054f9652624fe61d772b004 (diff) | |
download | scummvm-rg350-930600c85740012db40a11eb06b02b0c78356529.tar.gz scummvm-rg350-930600c85740012db40a11eb06b02b0c78356529.tar.bz2 scummvm-rg350-930600c85740012db40a11eb06b02b0c78356529.zip |
SHERLOCK: Implement saving scene status when saving game or leaving scene
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/scene.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index e5d9fc611f..3ecc7be422 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -451,7 +451,7 @@ bool Scene::loadScene(const Common::String &filename) { * opening or moving them */ void Scene::checkSceneStatus() { - if (_sceneStats[_currentScene][65]) { + if (_sceneStats[_currentScene][64]) { for (uint idx = 0; idx < 64; ++idx) { int val = _sceneStats[_currentScene][idx]; @@ -476,6 +476,23 @@ void Scene::checkSceneStatus() { } /** + * Restores objects to the correct status. This ensures that things like being opened or moved + * will remain the same on future visits to the scene + */ +void Scene::saveSceneStatus() { + // Flag any objects for the scene that have been altered + int count = MIN((int)_bgShapes.size(), 64); + for (int idx = 0; idx < count; ++idx) { + Object &obj = _bgShapes[idx]; + _sceneStats[_currentScene][idx] = obj._type == HIDDEN || obj._type == REMOVE + || obj._type == HIDE_SHAPE || obj._type == INVALID; + } + + // Flag scene as having been visited + _sceneStats[_currentScene][64] = true; +} + +/** * Check the scene's objects against the game flags. If false is passed, * it means the scene has just been loaded. A value of true means that the scene * is in use (ie. not just loaded) @@ -1364,10 +1381,6 @@ void Scene::doBgAnim() { } } -void Scene::saveSceneStatus() { - // TODO -} - /** * Attempts to find a background shape within the passed bounds. If found, * it will return the shape number, or -1 on failure. @@ -1453,6 +1466,9 @@ int Scene::closestZone(const Common::Point &pt) { * Synchronize the data for a savegame */ void Scene::synchronize(Common::Serializer &s) { + if (s.isSaving()) + saveSceneStatus(); + s.syncAsSint16LE(_bigPos.x); s.syncAsSint16LE(_bigPos.y); s.syncAsSint16LE(_overPos.x); |