[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.462,2.463 saveload.cpp,1.211,1.212 saveload.h,1.55,1.56

Max Horn fingolfin at users.sourceforge.net
Tue Apr 26 07:15:16 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14039/scumm

Modified Files:
	intern.h saveload.cpp saveload.h 
Log Message:
Clean up HE save/load code, at the cost of savegame compatibility (v71he and upwards)

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.462
retrieving revision 2.463
diff -u -d -r2.462 -r2.463
--- intern.h	26 Apr 2005 13:33:10 -0000	2.462
+++ intern.h	26 Apr 2005 14:01:31 -0000	2.463
@@ -709,6 +709,8 @@
 	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 @@
 	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);

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -d -r1.211 -r1.212
--- saveload.cpp	26 Apr 2005 13:47:47 -0000	1.211
+++ saveload.cpp	26 Apr 2005 14:01:34 -0000	1.212
@@ -121,6 +121,13 @@
 		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 @@
 		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 @@
 		}
 	}
 
-	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 @@
 	_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;

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- saveload.h	26 Apr 2005 11:10:27 -0000	1.55
+++ saveload.h	26 Apr 2005 14:01:38 -0000	1.56
@@ -43,7 +43,7 @@
  * 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





More information about the Scummvm-git-logs mailing list