diff options
author | Willem Jan Palenstijn | 2016-12-18 20:14:12 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2017-01-06 19:03:50 +0100 |
commit | 740b0bb0ca1585e1eff49afe8da1104830cc1e02 (patch) | |
tree | 2aa879d573ccbbfc82f6d9c4ecd7d929e7659b31 /engines/sci/engine | |
parent | 7984111289a789e835eb6762b08804f195322bb4 (diff) | |
download | scummvm-rg350-740b0bb0ca1585e1eff49afe8da1104830cc1e02.tar.gz scummvm-rg350-740b0bb0ca1585e1eff49afe8da1104830cc1e02.tar.bz2 scummvm-rg350-740b0bb0ca1585e1eff49afe8da1104830cc1e02.zip |
SCI: Unconditionally save palvary state
Additionally, add workaround to fix up old QfG3 saves with broken
_palVaryPaused state. Fixes bug #9674.
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/savegame.cpp | 24 | ||||
-rw-r--r-- | engines/sci/engine/savegame.h | 3 |
2 files changed, 22 insertions, 5 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 720f6783ee..5184874064 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -764,17 +764,33 @@ void GfxPalette::saveLoadWithSerializer(Common::Serializer &s) { palVaryRemoveTimer(); s.syncAsSint32LE(_palVaryResourceId); - if (_palVaryResourceId != -1) { - palVarySaveLoadPalette(s, &_palVaryOriginPalette); - palVarySaveLoadPalette(s, &_palVaryTargetPalette); + if (_palVaryResourceId != -1 || s.getVersion() >= 40) { + if (_palVaryResourceId != -1) { + palVarySaveLoadPalette(s, &_palVaryOriginPalette); + palVarySaveLoadPalette(s, &_palVaryTargetPalette); + } s.syncAsSint16LE(_palVaryStep); s.syncAsSint16LE(_palVaryStepStop); s.syncAsSint16LE(_palVaryDirection); s.syncAsUint16LE(_palVaryTicks); s.syncAsSint32LE(_palVaryPaused); + if (s.getVersion() >= 40) + s.syncAsSint32LE(_palVarySignal); } - _palVarySignal = 0; + if (s.isLoading() && s.getVersion() < 40) { + // Reset _palVaryPaused to 0 when loading an old savegame. + // Before version 40, we didn't restore or reset _palVaryPaused. + // In QfG3 this could get it stuck at positive values (bug #9674). + // + // Other SCI11 games don't appear to use palVaryPaused at all. + // (Looked at eq2, freddy, kq6, lb2, mgoose11, pq1, qg1, sq4, sq5) + _palVaryPaused = 0; + + // Clear any pending updates, since _palVarySignal also wasn't saved + // before version 40. + _palVarySignal = 0; + } if (s.isLoading() && _palVaryResourceId != -1) { palVaryInstallTimer(); diff --git a/engines/sci/engine/savegame.h b/engines/sci/engine/savegame.h index 873394aebb..a75db25bf9 100644 --- a/engines/sci/engine/savegame.h +++ b/engines/sci/engine/savegame.h @@ -37,6 +37,7 @@ struct EngineState; * * Version - new/changed feature * ============================= + * 40 - always store palvary variables * 39 - Accurate SCI32 arrays/strings, score metadata, avatar metadata * 38 - SCI32 cursor * 37 - Segment entry data changed to pointers @@ -64,7 +65,7 @@ struct EngineState; */ enum { - CURRENT_SAVEGAME_VERSION = 39, + CURRENT_SAVEGAME_VERSION = 40, MINIMUM_SAVEGAME_VERSION = 14 }; |