aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorMartin Kiewitz2014-06-02 20:51:39 +0200
committerMartin Kiewitz2014-06-02 20:51:39 +0200
commitd4de84bf8be7fefb95b3330d5b178549335c459b (patch)
tree9f5c394a75efe644c28456c064b9909a8d4b6fda /engines/sci/engine
parent98dbb8070b11d2a98a5e9af784a753777a56c9fb (diff)
downloadscummvm-rg350-d4de84bf8be7fefb95b3330d5b178549335c459b.tar.gz
scummvm-rg350-d4de84bf8be7fefb95b3330d5b178549335c459b.tar.bz2
scummvm-rg350-d4de84bf8be7fefb95b3330d5b178549335c459b.zip
SCI: fix saving in mother goose sci0 (bug #6486)
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kfile.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 65acdbcdf5..b6231c4b47 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -896,12 +896,25 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
gamestate_restore(s, in);
delete in;
- if (g_sci->getGameId() == GID_MOTHERGOOSE256) {
+ switch (g_sci->getGameId()) {
+ case GID_MOTHERGOOSE:
+ // WORKAROUND: Mother Goose SCI0
+ // Script 200 / rm200::newRoom will set global C5h directly right after creating a child to the
+ // current number of children plus 1.
+ // We can't trust that global, that's why we set the actual savedgame id right here directly after
+ // restore a saved game.
+ // If we didn't, the game would always save to a new slot
+ s->variables[VAR_GLOBAL][0xC5].setOffset(SAVEGAMEID_OFFICIALRANGE_START + savegameId);
+ break;
+ case GID_MOTHERGOOSE256:
// WORKAROUND: Mother Goose SCI1/SCI1.1 does some weird things for
// saving a previously restored game.
// We set the current savedgame-id directly and remove the script
// code concerning this via script patch.
s->variables[VAR_GLOBAL][0xB3].setOffset(SAVEGAMEID_OFFICIALRANGE_START + savegameId);
+ break;
+ default:
+ break;
}
} else {
s->r_acc = TRUE_REG;