[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.302,1.303 resource_v3.cpp,1.34,1.35 resource_v4.cpp,1.14,1.15 scumm.h,1.561,1.562

Max Horn fingolfin at users.sourceforge.net
Sun Apr 3 17:13:25 CEST 2005


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

Modified Files:
	resource.cpp resource_v3.cpp resource_v4.cpp scumm.h 
Log Message:
Cleaning up the charset loading code some more

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.302
retrieving revision 1.303
diff -u -d -r1.302 -r1.303
--- resource.cpp	3 Apr 2005 23:53:33 -0000	1.302
+++ resource.cpp	4 Apr 2005 00:12:40 -0000	1.303
@@ -42,7 +42,7 @@
 
 /* Open a room */
 void ScummEngine::openRoom(int room) {
-	int room_offs, roomlimit;
+	int room_offs;
 	bool result;
 	char buf[128];
 	char buf2[128] = "";
@@ -65,14 +65,7 @@
 
 	/* Either xxx.lfl or monkey.xxx file name */
 	while (1) {
-		if (_features & GF_SMALL_NAMES)
-			roomlimit = 98;
-		else
-			roomlimit = 900;
-		if (_features & GF_EXTERNAL_CHARSET && room >= roomlimit)
-			room_offs = 0;
-		else
-			room_offs = room ? res.roomoffs[rtRoom][room] : 0;
+		room_offs = room ? res.roomoffs[rtRoom][room] : 0;
 
 		if (room_offs == -1)
 			break;
@@ -81,7 +74,26 @@
 			_fileOffset = res.roomoffs[rtRoom][room];
 			return;
 		}
-		if (!(_features & GF_SMALL_HEADER)) {
+		if (_version <= 3) {
+			sprintf(buf, "%.2d.lfl", room);
+			// Maniac Mansion demo has .man instead of .lfl
+			if (_gameId == GID_MANIAC)
+				sprintf(buf2, "%.2d.man", room);
+			encByte = (_features & GF_USE_KEY) ? 0xFF : 0;
+		} else if (_features & GF_SMALL_HEADER) {
+			if (room == 0 || room >= 900) {
+				sprintf(buf, "%.3d.lfl", room);
+				encByte = 0;
+				if (openResourceFile(buf, encByte)) {
+					return;
+				}
+				askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
+
+			} else {
+				sprintf(buf, "disk%.2d.lec", room == 0 ? 0 : res.roomno[rtRoom][room]);
+				encByte = 0x69;
+			}
+		} else {
 
 			if (_heversion >= 70) { // Windows titles
 				if (_heversion >= 98) {
@@ -107,34 +119,15 @@
 				sprintf(buf, "%s.la%d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
 
 				sprintf(buf2, "%s.%.3d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
-			} else if (_features & GF_HUMONGOUS)
+			} else if (_features & GF_HUMONGOUS) {
 				sprintf(buf, "%s.he%.1d", _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
-			else {
+			} else {
 				sprintf(buf, "%s.%.3d",  _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
 				if (_gameId == GID_SAMNMAX)
 					sprintf(buf2, "%s.sm%.1d",  _gameName.c_str(), room == 0 ? 0 : res.roomno[rtRoom][room]);
 			}
 
 			encByte = (_features & GF_USE_KEY) ? 0x69 : 0;
-		} else if (!(_features & GF_SMALL_NAMES)) {
-			if (room == 0 || room >= 900) {
-				sprintf(buf, "%.3d.lfl", room);
-				encByte = 0;
-				if (openResourceFile(buf, encByte)) {
-					return;
-				}
-				askForDisk(buf, room == 0 ? 0 : res.roomno[rtRoom][room]);
-
-			} else {
-				sprintf(buf, "disk%.2d.lec", room == 0 ? 0 : res.roomno[rtRoom][room]);
-				encByte = 0x69;
-			}
-		} else {
-			sprintf(buf, "%.2d.lfl", room);
-			// Maniac Mansion demo has .man instead of .lfl
-			if (_gameId == GID_MANIAC)
-				sprintf(buf2, "%.2d.man", room);
-			encByte = (_features & GF_USE_KEY) ? 0xFF : 0;
 		}
 
 		// If we have substitute
@@ -158,8 +151,6 @@
 		if (result) {
 			if (room == 0)
 				return;
-			if (_features & GF_EXTERNAL_CHARSET && room >= roomlimit)
-				return;
 			deleteRoomOffsets();
 			readRoomsOffsets();
 			_fileOffset = res.roomoffs[rtRoom][room];
@@ -633,7 +624,7 @@
 			_fileHandle->seek(-2, SEEK_CUR);
 		}
 	} else if (_features & GF_SMALL_HEADER) {
-		if (!(_features & GF_SMALL_NAMES))
+		if (_version == 4)
 			_fileHandle->seek(8, SEEK_CUR);
 		size = _fileHandle->readUint32LE();
 		tag = _fileHandle->readUint16LE();

Index: resource_v3.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v3.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- resource_v3.cpp	3 Apr 2005 23:53:34 -0000	1.34
+++ resource_v3.cpp	4 Apr 2005 00:12:41 -0000	1.35
@@ -104,27 +104,21 @@
 	uint32 size;
 	memset(_charsetData, 0, sizeof(_charsetData));
 
-	if (_gameId == GID_ZAK256)
-		checkRange(2, 0, no, "Loading illegal charset %d");
-	else
-		checkRange(4, 0, no, "Loading illegal charset %d");
+	checkRange(2, 0, no, "Loading illegal charset %d");
 	closeRoom();
 
 	File file;
 	char buf[20];
 
 	sprintf(buf, "%02d.LFL", 99 - no);
-	
 	file.open(buf);
-		
+
 	if (file.isOpen() == false) {
 		error("loadCharset(%d): Missing file charset: %s", no, buf);
 	}
-		
+
 	size = file.readUint16LE();
 	file.read(createResource(rtCharset, no, size), size);
-		
-	file.close();
 }
 
 } // End of namespace Scumm

Index: resource_v4.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource_v4.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- resource_v4.cpp	3 Apr 2005 23:53:34 -0000	1.14
+++ resource_v4.cpp	4 Apr 2005 00:12:41 -0000	1.15
@@ -130,12 +130,18 @@
 	checkRange(4, 0, no, "Loading illegal charset %d");
 	closeRoom();
 
-	openRoom(900 + no);
+	File file;
+	char buf[20];
 
-	size = _fileHandle->readUint32LE() + 11;
+	sprintf(buf, "%03d.LFL", 900 + no);
+	file.open(buf);
 
-	_fileHandle->read(createResource(rtCharset, no, size), size);
-	closeRoom();
+	if (file.isOpen() == false) {
+		error("loadCharset(%d): Missing file charset: %s", no, buf);
+	}
+
+	size = file.readUint32LE() + 11;
+	file.read(createResource(rtCharset, no, size), size);
 }
 
 void ScummEngine_v4::readMAXS(int blockSize) {

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.561
retrieving revision 1.562
diff -u -d -r1.561 -r1.562
--- scumm.h	3 Apr 2005 23:53:34 -0000	1.561
+++ scumm.h	4 Apr 2005 00:12:41 -0000	1.562
@@ -132,8 +132,6 @@
 	GF_PC                  = 1 << 22,
 	GF_WINDOWS             = 1 << 23,
 	GF_DEMO                = 1 << 24,
-	
-	GF_EXTERNAL_CHARSET    = GF_SMALL_HEADER
 };
 
 /* SCUMM Debug Channels */





More information about the Scummvm-git-logs mailing list