aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2005-04-26 14:01:38 +0000
committerMax Horn2005-04-26 14:01:38 +0000
commitaa330e827cf3d288c6599216846df0415ec08daf (patch)
tree5bbdb314f2cabfc18183d442a3e86fd56cce5535 /scumm
parent9d07432375681bc99627a595ed4d259898a607e6 (diff)
downloadscummvm-rg350-aa330e827cf3d288c6599216846df0415ec08daf.tar.gz
scummvm-rg350-aa330e827cf3d288c6599216846df0415ec08daf.tar.bz2
scummvm-rg350-aa330e827cf3d288c6599216846df0415ec08daf.zip
Clean up HE save/load code, at the cost of savegame compatibility (v71he and upwards)
svn-id: r17821
Diffstat (limited to 'scumm')
-rw-r--r--scumm/intern.h6
-rw-r--r--scumm/saveload.cpp76
-rw-r--r--scumm/saveload.h2
3 files changed, 54 insertions, 30 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 449701d1cc..a78983b03d 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -709,6 +709,8 @@ protected:
virtual void setupScummVars();
virtual void initScummVars();
+ virtual void saveOrLoad(Serializer *s, uint32 savegameVersion);
+
virtual void readRoomsOffsets();
virtual void readGlobalObjects();
virtual void readIndexBlock(uint32 blocktype, uint32 itemsize);
@@ -988,7 +990,9 @@ protected:
virtual const char *getOpcodeDesc(byte i);
virtual void initScummVars();
-
+
+ virtual void saveOrLoad(Serializer *s, uint32 savegameVersion);
+
virtual void readMAXS(int blockSize);
void createWizEmptyImage(const WizParameters *params);
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 9254c8d3c6..fc80fcb117 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -121,6 +121,13 @@ bool ScummEngine::loadState(int slot, bool compat) {
return false;
}
+ // We (deliberately) broke HE savegame compatibility at some point.
+ if (hdr.ver < VER(50) && _heversion >= 71) {
+ warning("Unsupported version of '%s'", filename);
+ delete in;
+ return false;
+ }
+
// Due to a bug in scummvm up to and including 0.3.0, save games could be saved
// in the V8/V9 format but were tagged with a V7 mark. Ouch. So we just pretend V7 == V8 here
if (hdr.ver == VER(7))
@@ -383,33 +390,18 @@ bool ScummEngine::getSavegameName(int slot, char *desc) {
return false;
}
+ // We (deliberately) broke HE savegame compatibility at some point.
+ if (hdr.ver < VER(50) && _heversion >= 71) {
+ strcpy(desc, "Unsupported version");
+ return false;
+ }
+
memcpy(desc, hdr.name, sizeof(hdr.name));
desc[sizeof(hdr.name) - 1] = 0;
return true;
}
void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
- const SaveLoadEntry polygonEntries[] = {
- MKLINE(WizPolygon, vert[0].x, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[0].y, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[1].x, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[1].y, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[2].x, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[2].y, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[3].x, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[3].y, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[4].x, sleInt16, VER(40)),
- MKLINE(WizPolygon, vert[4].y, sleInt16, VER(40)),
- MKLINE(WizPolygon, bound.left, sleInt16, VER(40)),
- MKLINE(WizPolygon, bound.top, sleInt16, VER(40)),
- MKLINE(WizPolygon, bound.right, sleInt16, VER(40)),
- MKLINE(WizPolygon, bound.bottom, sleInt16, VER(40)),
- MKLINE(WizPolygon, id, sleInt16, VER(40)),
- MKLINE(WizPolygon, numVerts, sleInt16, VER(40)),
- MKLINE(WizPolygon, flag, sleByte, VER(40)),
- MKEND()
- };
-
const SaveLoadEntry objectEntries[] = {
MKLINE(ObjectData, OBIMoffset, sleUint32, VER(8)),
MKLINE(ObjectData, OBCDoffset, sleUint32, VER(8)),
@@ -778,13 +770,6 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
}
}
- if (_heversion >= 90) {
- ((ScummEngine_v90he *)this)->saveOrLoadSpriteData(&*s, savegameVersion);
- }
- if (_heversion >= 71) {
- Wiz *wiz = &((ScummEngine_v70he *)this)->_wiz;
- s->saveLoadArrayOf(wiz->_polygons, ARRAYSIZE(wiz->_polygons), sizeof(wiz->_polygons[0]), polygonEntries);
- }
s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
if (s->isLoading() && savegameVersion < VER(13)) {
// Since roughly v13 of the save games, the objs storage has changed a bit
@@ -963,6 +948,41 @@ void ScummEngine_v7::saveOrLoad(Serializer *s, uint32 savegameVersion) {
_imuseDigital->saveOrLoad(s);
}
+void ScummEngine_v70he::saveOrLoad(Serializer *s, uint32 savegameVersion) {
+ ScummEngine::saveOrLoad(s, savegameVersion);
+
+ const SaveLoadEntry polygonEntries[] = {
+ MKLINE(WizPolygon, vert[0].x, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[0].y, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[1].x, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[1].y, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[2].x, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[2].y, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[3].x, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[3].y, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[4].x, sleInt16, VER(40)),
+ MKLINE(WizPolygon, vert[4].y, sleInt16, VER(40)),
+ MKLINE(WizPolygon, bound.left, sleInt16, VER(40)),
+ MKLINE(WizPolygon, bound.top, sleInt16, VER(40)),
+ MKLINE(WizPolygon, bound.right, sleInt16, VER(40)),
+ MKLINE(WizPolygon, bound.bottom, sleInt16, VER(40)),
+ MKLINE(WizPolygon, id, sleInt16, VER(40)),
+ MKLINE(WizPolygon, numVerts, sleInt16, VER(40)),
+ MKLINE(WizPolygon, flag, sleByte, VER(40)),
+ MKEND()
+ };
+
+ if (_heversion >= 71) {
+ 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);
+
+ saveOrLoadSpriteData(&*s, savegameVersion);
+}
+
void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) {
byte *ptr;
uint32 size;
diff --git a/scumm/saveload.h b/scumm/saveload.h
index 21ead099eb..6c81eab176 100644
--- a/scumm/saveload.h
+++ b/scumm/saveload.h
@@ -43,7 +43,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 49
+#define CURRENT_VER 50
/**
* An auxillary macro, used to specify savegame versions. We use this instead