[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.297,1.298 resource.h,1.15,1.16 scumm.cpp,1.393,1.394

Max Horn fingolfin at users.sourceforge.net
Thu Mar 31 15:12:34 CEST 2005


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

Modified Files:
	resource.cpp resource.h scumm.cpp 
Log Message:
Made findResourceSmall local to resource.cpp; simplified _EPAL_offs (since we don't use it nor save it at this time, this is harmless); added a comment about _CLUT_offs ugliness

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.297
retrieving revision 1.298
diff -u -d -r1.297 -r1.298
--- resource.cpp	31 Mar 2005 21:38:34 -0000	1.297
+++ resource.cpp	31 Mar 2005 23:11:38 -0000	1.298
@@ -36,6 +36,7 @@
 
 static uint16 newTag2Old(uint32 newTag);
 static const char *resTypeFromId(int id);
+static const byte *findResourceSmall(uint32 tag, const byte *searchin);
 
 
 /* Open a room */
@@ -909,11 +910,11 @@
 		return 0;
 
 	if (_features & GF_OLD_BUNDLE)
-		return READ_LE_UINT16(ptr) - 4;
+		return READ_LE_UINT16(ptr) - _resourceHeaderSize;
 	else if (_features & GF_SMALL_HEADER)
-		return READ_LE_UINT32(ptr) - 6;
+		return READ_LE_UINT32(ptr) - _resourceHeaderSize;
 	else
-		return READ_BE_UINT32(ptr - 4) - 8;
+		return READ_BE_UINT32(ptr - 4) - _resourceHeaderSize;
 }
 
 void ResourceManager::lock(int type, int i) {

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- resource.h	1 Jan 2005 16:09:15 -0000	1.15
+++ resource.h	31 Mar 2005 23:11:39 -0000	1.16
@@ -37,8 +37,6 @@
 };
 
 
-const byte *findResourceSmall(uint32 tag, const byte *searchin);
-
 class ResourceIterator {
 	uint32 _size;
 	uint32 _pos;

Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.393
retrieving revision 1.394
diff -u -d -r1.393 -r1.394
--- scumm.cpp	31 Mar 2005 21:39:01 -0000	1.393
+++ scumm.cpp	31 Mar 2005 23:11:39 -0000	1.394
@@ -2421,7 +2421,7 @@
 				// FIXME. This is an evil HACK!!!
 				size = (READ_LE_UINT16(roomptr + 0x0A) - READ_LE_UINT16(roomptr + 0x15)) - size;
 			else
-				size = getResourceDataSize(ptr - size - 6) - size;
+				size = getResourceDataSize(ptr - size - _resourceHeaderSize) - size;
 
 			if (size > 0) {					// do this :)
 				createResource(rtMatrix, 1, size);
@@ -2611,10 +2611,9 @@
 		}
 	}
 
+	// Locate the EGA palette (currently unused).
 	if (_features & GF_OLD_BUNDLE)
 		ptr = 0;
-	else if (_features & GF_SMALL_HEADER)
-		ptr = findResourceSmall(MKID('EPAL'), roomptr);
 	else
 		ptr = findResourceData(MKID('EPAL'), roomptr);
 
@@ -2622,17 +2621,26 @@
 		_EPAL_offs = ptr - roomptr;
 	}
 
+	// Locate the standard room palette (for V3-V5 games).
+	// Note: We used to use findResourceSmall instead of findResourceData;
+	// in the small header case. That means we have to do some ugly trickery
+	// in order to emulate the old behaviour. It would be very nice to get
+	// rid of that. That would require some changes to the palette code.
+	//
+	// And of course this would break savegame compatibility unless extra code
+	// were added to the save/load system to cope with this.
 	if (_features & GF_OLD_BUNDLE)
 		ptr = 0;
-	else if (_features & GF_SMALL_HEADER)
-		ptr = findResourceSmall(MKID('CLUT'), roomptr);
 	else
 		ptr = findResourceData(MKID('CLUT'), roomptr);
 
 	if (ptr) {
+		if ((_features & GF_SMALL_HEADER) && ptr)
+			ptr -= _resourceHeaderSize;
 		_CLUT_offs = ptr - roomptr;
 	}
 
+	// Locate the standard room palettes (for V6+ games).
 	if (_version >= 6) {
 		ptr = findResource(MKID('PALS'), roomptr);
 		if (ptr) {





More information about the Scummvm-git-logs mailing list