[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.534,2.535 resource.cpp,1.342,1.343 saveload.cpp,1.242,1.243 saveload.h,1.65,1.66

kirben kirben at users.sourceforge.net
Wed Oct 19 05:17:32 CEST 2005


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

Modified Files:
	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.534
retrieving revision 2.535
diff -u -d -r2.534 -r2.535
--- intern.h	19 Oct 2005 09:43:13 -0000	2.534
+++ intern.h	19 Oct 2005 12:15:36 -0000	2.535
@@ -790,6 +790,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);
@@ -909,6 +911,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();
@@ -1243,6 +1247,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.342
retrieving revision 1.343
diff -u -d -r1.342 -r1.343
--- resource.cpp	18 Oct 2005 08:56:14 -0000	1.342
+++ resource.cpp	19 Oct 2005 12:15:36 -0000	1.343
@@ -1272,6 +1272,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.242
retrieving revision 1.243
diff -u -d -r1.242 -r1.243
--- saveload.cpp	18 Oct 2005 19:17:21 -0000	1.242
+++ saveload.cpp	19 Oct 2005 12:15:36 -0000	1.243
@@ -446,7 +446,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;
 	}
@@ -1194,9 +1194,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)),
@@ -1218,23 +1238,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)),
@@ -1266,14 +1274,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)),
@@ -1342,7 +1352,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;
 
@@ -1359,7 +1369,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.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- saveload.h	18 Oct 2005 01:30:21 -0000	1.65
+++ saveload.h	19 Oct 2005 12:15:36 -0000	1.66
@@ -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