diff options
author | Travis Howell | 2005-10-19 12:15:36 +0000 |
---|---|---|
committer | Travis Howell | 2005-10-19 12:15:36 +0000 |
commit | ba780d65df2bfbfbe18c48b39bace42b518a4975 (patch) | |
tree | e385bc6477c59eeb0fdee7c3d252ecc034741b23 | |
parent | 5fb75ec31cc07d2f14ef5d48b7f6f632d1611847 (diff) | |
download | scummvm-rg350-ba780d65df2bfbfbe18c48b39bace42b518a4975.tar.gz scummvm-rg350-ba780d65df2bfbfbe18c48b39bace42b518a4975.tar.bz2 scummvm-rg350-ba780d65df2bfbfbe18c48b39bace42b518a4975.zip |
HE games require _arraysSlots and sound resource 1 to be saved.
Breaks all old saved games for HE games only.
svn-id: r19179
-rw-r--r-- | scumm/intern.h | 6 | ||||
-rw-r--r-- | scumm/resource.cpp | 2 | ||||
-rw-r--r-- | scumm/saveload.cpp | 54 | ||||
-rw-r--r-- | scumm/saveload.h | 2 |
4 files changed, 41 insertions, 23 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 6b649b749f..609e752a72 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -790,6 +790,8 @@ protected: virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); + virtual void saveOrLoad(Serializer *s, uint32 savegameVersion); + void localizeArray(int slot, byte scriptSlot); void redimArray(int arrayId, int newX, int newY, int d); int readFileToArray(int slot, int32 size); @@ -909,6 +911,8 @@ public: ScummEngine_v71he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16], int substResFileNameIndex); protected: + virtual void saveOrLoad(Serializer *s, uint32 savegameVersion); + virtual void redrawBGAreas(); virtual void processActors(); @@ -1243,6 +1247,8 @@ protected: virtual void readMAXS(int blockSize); + virtual void saveOrLoad(Serializer *s, uint32 savegameVersion); + virtual void copyPalColor(int dst, int src); virtual void darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor); virtual void setPaletteFromPtr(const byte *ptr, int numcolor = -1); diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 85b5bdc6bc..59bfca15ed 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -1272,6 +1272,8 @@ void ScummEngine::allocateArrays() { _bitVars = (byte *)calloc(_numBitVariables >> 3, 1); if (_heversion >= 60) { _arraySlot = (byte *)calloc(_numArray, 1); + } + if (_heversion >= 70) { _storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData)); } diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index e24036971e..c5737939d5 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -446,7 +446,7 @@ bool ScummEngine::getSavegameName(int slot, char *desc) { } // We (deliberately) broke HE savegame compatibility at some point. - if (hdr.ver < VER(50) && _heversion >= 71) { + if (hdr.ver < VER(57) && _heversion >= 60) { strcpy(desc, "Unsupported version"); return false; } @@ -1194,9 +1194,29 @@ void ScummEngine_v7::saveOrLoad(Serializer *s, uint32 savegameVersion) { #endif #ifndef DISABLE_HE -void ScummEngine_v70he::saveOrLoad(Serializer *s, uint32 savegameVersion) { +void ScummEngine_v60he::saveOrLoad(Serializer *s, uint32 savegameVersion) { ScummEngine::saveOrLoad(s, savegameVersion); + s->saveLoadArrayOf(_arraySlot, _numArray, sizeof(_arraySlot[0]), sleByte); +} + +void ScummEngine_v70he::saveOrLoad(Serializer *s, uint32 savegameVersion) { + ScummEngine_v60he::saveOrLoad(s, savegameVersion); + + const SaveLoadEntry HE70Entries[] = { + MKLINE(ScummEngine_v70he, _heSndSoundId, sleInt32, VER(51)), + MKLINE(ScummEngine_v70he, _heSndOffset, sleInt32, VER(51)), + MKLINE(ScummEngine_v70he, _heSndChannel, sleInt32, VER(51)), + MKLINE(ScummEngine_v70he, _heSndFlags, sleInt32, VER(51)), + MKEND() + }; + + s->saveLoadEntries(this, HE70Entries); +} + +void ScummEngine_v71he::saveOrLoad(Serializer *s, uint32 savegameVersion) { + ScummEngine_v70he::saveOrLoad(s, savegameVersion); + const SaveLoadEntry polygonEntries[] = { MKLINE(WizPolygon, vert[0].x, sleInt16, VER(40)), MKLINE(WizPolygon, vert[0].y, sleInt16, VER(40)), @@ -1218,23 +1238,11 @@ void ScummEngine_v70he::saveOrLoad(Serializer *s, uint32 savegameVersion) { MKEND() }; - const SaveLoadEntry HE70Entries[] = { - MKLINE(ScummEngine_v70he, _heSndSoundId, sleInt32, VER(51)), - MKLINE(ScummEngine_v70he, _heSndOffset, sleInt32, VER(51)), - MKLINE(ScummEngine_v70he, _heSndChannel, sleInt32, VER(51)), - MKLINE(ScummEngine_v70he, _heSndFlags, sleInt32, VER(51)), - MKEND() - }; - - if (_heversion >= 71) { - s->saveLoadArrayOf(_wiz->_polygons, ARRAYSIZE(_wiz->_polygons), sizeof(_wiz->_polygons[0]), polygonEntries); - } - - s->saveLoadEntries(this, HE70Entries); + s->saveLoadArrayOf(_wiz->_polygons, ARRAYSIZE(_wiz->_polygons), sizeof(_wiz->_polygons[0]), polygonEntries); } void ScummEngine_v90he::saveOrLoad(Serializer *s, uint32 savegameVersion) { - ScummEngine_v70he::saveOrLoad(s, savegameVersion); + ScummEngine_v71he::saveOrLoad(s, savegameVersion); const SaveLoadEntry floodFillEntries[] = { MKLINE(FloodFillParameters, box.left, sleInt32, VER(51)), @@ -1266,14 +1274,16 @@ void ScummEngine_v90he::saveOrLoad(Serializer *s, uint32 savegameVersion) { _numSpritesToProcess = _sprite->_numSpritesToProcess; s->saveLoadEntries(this, HE90Entries); _sprite->_numSpritesToProcess = _numSpritesToProcess; +} - if (_heversion >= 99) { - s->saveLoadArrayOf(_hePalettes, _numPalettes, sizeof(_hePalettes[0]), sleUint8); - } +void ScummEngine_v99he::saveOrLoad(Serializer *s, uint32 savegameVersion) { + ScummEngine_v90he::saveOrLoad(s, savegameVersion); + + s->saveLoadArrayOf(_hePalettes, _numPalettes, sizeof(_hePalettes[0]), sleUint8); } void ScummEngine_v100he::saveOrLoad(Serializer *s, uint32 savegameVersion) { - ScummEngine_v90he::saveOrLoad(s, savegameVersion); + ScummEngine_v99he::saveOrLoad(s, savegameVersion); const SaveLoadEntry HE100Entries[] = { MKLINE(ScummEngine_v100he, _heResId, sleInt32, VER(51)), @@ -1342,7 +1352,7 @@ void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) { void ScummEngine::saveResource(Serializer *ser, int type, int idx) { assert(res.address[type][idx]); - if (res.mode[type] == 0) { + if ((res.mode[type] == 0) || (_heversion >= 60 && res.mode[type] == 2 && idx == 1)) { byte *ptr = res.address[type][idx]; uint32 size = ((MemBlkHeader *)ptr)->size; @@ -1359,7 +1369,7 @@ void ScummEngine::saveResource(Serializer *ser, int type, int idx) { } void ScummEngine::loadResource(Serializer *ser, int type, int idx) { - if (res.mode[type] == 0) { + if ((res.mode[type] == 0) || (_heversion >= 60 && res.mode[type] == 2 && idx == 1)) { uint32 size = ser->loadUint32(); assert(size); res.createResource(type, idx, size); diff --git a/scumm/saveload.h b/scumm/saveload.h index aeeaebf589..9d0bce31b7 100644 --- a/scumm/saveload.h +++ b/scumm/saveload.h @@ -45,7 +45,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 56 +#define CURRENT_VER 57 /** * An auxillary macro, used to specify savegame versions. We use this instead |