[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.212,1.213 scumm.h,1.404,1.405

Eugene Sandulenko sev at users.sourceforge.net
Tue Jun 22 06:53:05 CEST 2004


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

Modified Files:
	resource.cpp scumm.h 
Log Message:
HE v7.0+ resources finally fixed


Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- resource.cpp	21 Jun 2004 10:06:52 -0000	1.212
+++ resource.cpp	22 Jun 2004 13:52:38 -0000	1.213
@@ -504,6 +504,9 @@
 		}
 		for (i = 0; i < num; i++) {
 			res.roomoffs[id][i] = _fileHandle.readUint32LE();
+
+			if (id == rtRoom && _heversion >= 70)
+				_HEV7RoomIntOffsets[i] = res.roomoffs[id][i];
 		}
 
 		if (_heversion >= 70) {
@@ -534,8 +537,12 @@
 		res.roomoffs[id] = (uint32 *)calloc(num, sizeof(uint32));
 	}
 
-	if (_heversion >= 70)
+	if (_heversion >= 70) {
 		res.globsize[id] = (uint32 *)calloc(num, sizeof(uint32));
+
+		if (id == rtRoom)
+			_HEV7RoomIntOffsets = (uint32 *)calloc(num, sizeof(uint32));
+	}
 }
 
 void ScummEngine::loadCharset(int no) {
@@ -622,9 +629,11 @@
 	if (roomNr == 0)
 		roomNr = _roomResource;
 
-	if (type == rtRoom && _heversion < 70) {
+	if (type == rtRoom) {
 		if (_version == 8)
 			fileOffs = 8;
+		if (_heversion >= 70)
+			fileOffs = _HEV7RoomIntOffsets[idx];
 		else
 			fileOffs = 0;
 	} else {
@@ -653,11 +662,6 @@
 		if ((type == rtSound) && !(_features & GF_AMIGA) && !(_features & GF_FMTOWNS)) {
 			return readSoundResourceSmallHeader(type, idx);
 		}
-	} else if (_heversion >= 70) {
-		tag = _fileHandle.readUint32LE();
-		size = _fileHandle.readUint32BE() + 8;
-
-		_fileHandle.seek(-8, SEEK_CUR);
 	} else {
 		if (type == rtSound) {
 			return readSoundResource(type, idx);
@@ -665,7 +669,7 @@
 
 		tag = fileReadDword();
 
-		if (tag != res.tags[type]) {
+		if (tag != res.tags[type] && _heversion < 70) {
 			error("%s %d not in room %d at %d+%d in file %s",
 					res.name[type], idx, roomNr,
 					_fileOffset, fileOffs, _fileHandle.name());
@@ -1970,6 +1974,10 @@
 		if (_heversion >= 70)
 			free(res.globsize[i]);
 	}
+	if (_heversion >= 70) {
+		free(_HEV7RoomIntOffsets);
+		free(_HEV7RoomOffsets);
+	}
 }
 
 void ScummEngine::loadPtrToResource(int type, int resindex, const byte *source) {
@@ -2278,6 +2286,8 @@
 const byte *findResource(uint32 tag, const byte *searchin) {
 	uint32 curpos, totalsize, size;
 
+	// It seems that in HE games if searchin == NULL, it continues
+	// search from last position
 	assert(searchin);
 
 	searchin += 4;

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.404
retrieving revision 1.405
diff -u -d -r1.404 -r1.405
--- scumm.h	21 Jun 2004 02:33:23 -0000	1.404
+++ scumm.h	22 Jun 2004 13:52:39 -0000	1.405
@@ -625,6 +625,7 @@
 	uint32 _allocatedSize;
 	byte _expire_counter;
 	byte *_HEV7RoomOffsets;
+	uint32 *_HEV7RoomIntOffsets;
 
 	void allocateArrays();
 	void openRoom(int room);





More information about the Scummvm-git-logs mailing list