[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.529.2.2,2.529.2.3 resource.cpp,1.339.2.1,1.339.2.2 saveload.cpp,1.239.2.2,1.239.2.3 saveload.h,1.64.2.1,1.64.2.2

kirben kirben at users.sourceforge.net
Wed Oct 19 05:12:26 CEST 2005


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

Modified Files:
      Tag: branch-0-8-0
	intern.h resource.cpp saveload.cpp saveload.h 
Log Message:

HE games require _arraysSlots and sound resource 1 to be saved.
Breaks all old saved games for HE games only.


Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.529.2.2
retrieving revision 2.529.2.3
diff -u -d -r2.529.2.2 -r2.529.2.3
--- intern.h	19 Oct 2005 07:42:58 -0000	2.529.2.2
+++ intern.h	19 Oct 2005 12:11:31 -0000	2.529.2.3
@@ -784,6 +784,8 @@
 	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);
@@ -903,6 +905,8 @@
 	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();
@@ -1237,6 +1241,8 @@
 
 	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);

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.339.2.1
retrieving revision 1.339.2.2
diff -u -d -r1.339.2.1 -r1.339.2.2
--- resource.cpp	18 Oct 2005 02:11:21 -0000	1.339.2.1
+++ resource.cpp	19 Oct 2005 12:11:31 -0000	1.339.2.2
@@ -1257,6 +1257,8 @@
 	_bitVars = (byte *)calloc(_numBitVariables >> 3, 1);
 	if (_heversion >= 60) {
 		_arraySlot = (byte *)calloc(_numArray, 1);
+	}
+	if (_heversion >= 70) {
 		_storedFlObjects = (ObjectData *)calloc(100, sizeof(ObjectData));
 	}
 

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.239.2.2
retrieving revision 1.239.2.3
diff -u -d -r1.239.2.2 -r1.239.2.3
--- saveload.cpp	19 Oct 2005 07:42:58 -0000	1.239.2.2
+++ saveload.cpp	19 Oct 2005 12:11:31 -0000	1.239.2.3
@@ -447,7 +447,7 @@
 	}
 
 	// 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;
 	}
@@ -1195,9 +1195,29 @@
 #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)),
@@ -1219,23 +1239,11 @@
 		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)),
@@ -1267,14 +1275,16 @@
 	_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)),
@@ -1343,7 +1353,7 @@
 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;
 
@@ -1360,7 +1370,7 @@
 }
 
 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);

Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.64.2.1
retrieving revision 1.64.2.2
diff -u -d -r1.64.2.1 -r1.64.2.2
--- saveload.h	18 Oct 2005 02:11:21 -0000	1.64.2.1
+++ saveload.h	19 Oct 2005 12:11:31 -0000	1.64.2.2
@@ -45,7 +45,7 @@
  * 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





More information about the Scummvm-git-logs mailing list