diff options
author | Max Horn | 2009-07-28 23:19:33 +0000 |
---|---|---|
committer | Max Horn | 2009-07-28 23:19:33 +0000 |
commit | eb9600b5e95f105736f01b9adbbd603e69b51638 (patch) | |
tree | 74de124830c9592b62f7a69222340207264f2c82 /engines/scumm | |
parent | caacc3a6df66f036c4b3e7db89960d018af3d51c (diff) | |
download | scummvm-rg350-eb9600b5e95f105736f01b9adbbd603e69b51638.tar.gz scummvm-rg350-eb9600b5e95f105736f01b9adbbd603e69b51638.tar.bz2 scummvm-rg350-eb9600b5e95f105736f01b9adbbd603e69b51638.zip |
SCUMM: Moved _inventoryOffset to ScummEngine_v2 and save it.
Fixes bug #2828417: Zak V2: inventory position isn't reset when loading.
svn-id: r42870
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/saveload.cpp | 19 | ||||
-rw-r--r-- | engines/scumm/saveload.h | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 3 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 1 | ||||
-rw-r--r-- | engines/scumm/scumm_v2.h | 3 |
5 files changed, 24 insertions, 4 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index d906760243..aa046dc6dd 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -1382,7 +1382,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { } void ScummEngine_v0::saveOrLoad(Serializer *s) { - ScummEngine::saveOrLoad(s); + ScummEngine_v2::saveOrLoad(s); const SaveLoadEntry v0Entrys[] = { MKLINE(ScummEngine_v0, _currentMode, sleByte, VER(78)), @@ -1392,6 +1392,23 @@ void ScummEngine_v0::saveOrLoad(Serializer *s) { s->saveLoadEntries(this, v0Entrys); } + +void ScummEngine_v2::saveOrLoad(Serializer *s) { + ScummEngine::saveOrLoad(s); + + const SaveLoadEntry v2Entrys[] = { + MKLINE(ScummEngine_v2, _inventoryOffset, sleUint16, VER(79)), + MKEND() + }; + s->saveLoadEntries(this, v2Entrys); + + // In old saves we didn't store _inventoryOffset -> reset it to + // a sane default when loading one of those. + if (s->getVersion() < 79 && s->isLoading()) { + _inventoryOffset = 0; + } +} + void ScummEngine_v5::saveOrLoad(Serializer *s) { ScummEngine::saveOrLoad(s); diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h index 49bfe39b21..4f6adc5570 100644 --- a/engines/scumm/saveload.h +++ b/engines/scumm/saveload.h @@ -50,7 +50,7 @@ namespace Scumm { * only saves/loads those which are valid for the version of the savegame * which is being loaded/saved currently. */ -#define CURRENT_VER 78 +#define CURRENT_VER 79 /** * An auxillary macro, used to specify savegame versions. We use this instead diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 409a2ce306..600b9ec385 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -217,7 +217,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _roomResource = 0; OF_OWNER_ROOM = 0; _verbMouseOver = 0; - _inventoryOffset = 0; _classData = NULL; _actorToPrintStrFor = 0; _sentenceNum = 0; @@ -649,6 +648,8 @@ ScummEngine_v3old::ScummEngine_v3old(OSystem *syst, const DetectorResult &dr) ScummEngine_v2::ScummEngine_v2(OSystem *syst, const DetectorResult &dr) : ScummEngine_v3old(syst, dr) { + _inventoryOffset = 0; + _activeInventory = 0; _activeObject = 0; _activeVerb = 0; diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 753c5c2bca..6582ef0230 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -889,7 +889,6 @@ protected: protected: /* Should be in Verb class */ uint16 _verbMouseOver; - int _inventoryOffset; int8 _userPut; uint16 _userState; diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h index 76176b9c53..ee9591bc45 100644 --- a/engines/scumm/scumm_v2.h +++ b/engines/scumm/scumm_v2.h @@ -45,6 +45,7 @@ protected: int8 _mouseOverBoxV2; char _sentenceBuf[256]; + uint16 _inventoryOffset; int _activeInventory; int _activeObject; @@ -66,6 +67,8 @@ protected: virtual void resetScummVars(); virtual void decodeParseString(); + virtual void saveOrLoad(Serializer *s); + virtual void processKeyboard(Common::KeyState lastKeyHit); virtual void readIndexFile(); |