aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-21 17:21:48 +0100
committerMartin Kiewitz2016-02-21 17:21:48 +0100
commit3e4efdbd278583569b41fc4453e7ebbb4aebfab0 (patch)
tree92d41f68321365186d91236e3fdbaec790fac063 /engines/sci/engine
parent0abd5b5c4e4074d1b6d3dfb17ee5737280e6f28f (diff)
downloadscummvm-rg350-3e4efdbd278583569b41fc4453e7ebbb4aebfab0.tar.gz
scummvm-rg350-3e4efdbd278583569b41fc4453e7ebbb4aebfab0.tar.bz2
scummvm-rg350-3e4efdbd278583569b41fc4453e7ebbb4aebfab0.zip
SCI32: Implement syncing planes+screen items from VM for restore
Fixes restoring saved games, when ScummVM dialogs are patched in Removing clearing planes+screen items as well, because the scripts actually did that, but did not clear everything. Fixes "Invalid screen item" message when entering options menu, after restoring in SQ6.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/savegame.cpp14
-rw-r--r--engines/sci/engine/selector.cpp1
-rw-r--r--engines/sci/engine/selector.h2
3 files changed, 14 insertions, 3 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index fcf951e4f2..1b56e667bf 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -1066,10 +1066,12 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
if (g_sci->_gfxScreen)
g_sci->_gfxScreen->clearForRestoreGame();
#ifdef ENABLE_SCI32
- // Also clear any SCI32 planes/screen items currently showing so they
- // don't show up after the load.
+ // Delete current planes/elements of actively loaded VM, only when our ScummVM dialogs are patched in
+ // We MUST NOT delete all planes/screen items. At least Space Quest 6 has a few in memory like for example
+ // the options plane, which are not re-added and are in memory all the time right from the start of the
+ // game. Sierra SCI32 did not clear planes, only scripts cleared the ones inside planes::elements.
if (getSciVersion() >= SCI_VERSION_2)
- g_sci->_gfxFrameout->clear();
+ g_sci->_gfxFrameout->syncWithScripts(false);
#endif
s->reset(true);
@@ -1094,6 +1096,12 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
if (g_sci->_gfxPorts)
g_sci->_gfxPorts->saveLoadWithSerializer(ser);
+#ifdef ENABLE_SCI32
+ // Add current planes/screen elements of freshly loaded VM, only when our ScummVM dialogs are patched in
+ if (getSciVersion() >= SCI_VERSION_2)
+ g_sci->_gfxFrameout->syncWithScripts(true);
+#endif
+
Vocabulary *voc = g_sci->getVocabulary();
if (ser.getVersion() >= 30 && voc)
voc->saveLoadWithSerializer(ser);
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index b86e0ffd68..66f3793918 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -193,6 +193,7 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(textBottom);
FIND_SELECTOR(textRight);
FIND_SELECTOR(magnifier);
+ FIND_SELECTOR(casts);
#endif
}
diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h
index 6b724ed271..12074ed7d2 100644
--- a/engines/sci/engine/selector.h
+++ b/engines/sci/engine/selector.h
@@ -157,6 +157,8 @@ struct SelectorCache {
Selector textTop, textLeft, textBottom, textRight;
Selector magnifier;
+
+ Selector casts; // needed for sync'ing screen items/planes with scripts, when our save/restore code is patched in (see GfxFrameout::syncWithScripts)
#endif
};