[Scummvm-cvs-logs] CVS: scummvm/sword2 console.cpp,1.59,1.60 resman.cpp,1.122,1.123 resman.h,1.30,1.31

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun Jan 1 08:30:01 CET 2006


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

Modified Files:
	console.cpp resman.cpp resman.h 
Log Message:
Some cleanup/paranoia fixes to the previous missing voices/music fix. Treat
files marked as being on both CDs (I haven't seen any such file -- ever),
treat it as if it's on the hard disk.

Also, the "cd" field of the ResourceFile struct now holds 0, 1 or 2, not
the bit flags from the data file. (This last change is not in the 0.8
branch.)


Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/console.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- console.cpp	29 Oct 2005 21:24:53 -0000	1.59
+++ console.cpp	1 Jan 2006 16:29:23 -0000	1.60
@@ -284,24 +284,9 @@
 	ResourceFile *resFiles = _vm->_resman->getResFiles();
 
 	for (uint i = 0; i < numClusters; i++) {
-		DebugPrintf("%-20s ", resFiles[i].fileName);
-		if (!(resFiles[i].cd & LOCAL_PERM)) {
-			switch (resFiles[i].cd & 3) {
-			case BOTH:
-				DebugPrintf("CD 1 & 2\n");
-				break;
-			case CD1:
-				DebugPrintf("CD 1\n");
-				break;
-			case CD2:
-				DebugPrintf("CD 2\n");
-				break;
-			default:
-				DebugPrintf("CD 3? Huh?!\n");
-				break;
-			}
-		} else
-			DebugPrintf("HD\n");
+		const char *locStr[3] = { "HDD", "CD1", "CD2" };
+
+		DebugPrintf("%-20s %d\n", resFiles[i].fileName, locStr[resFiles[i].cd]);
 	}
 
 	DebugPrintf("%d resources\n", _vm->_resman->getNumResFiles());

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.cpp,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- resman.cpp	1 Jan 2006 13:46:42 -0000	1.122
+++ resman.cpp	1 Jan 2006 16:29:23 -0000	1.123
@@ -43,6 +43,14 @@
 //	resource.tab which is a table which tells us which cluster a resource
 //	is located in and the number within the cluster
 
+enum {
+	BOTH		= 0x0,		// Cluster is on both CDs
+	CD1		= 0x1,		// Cluster is on CD1 only
+	CD2		= 0x2,		// Cluster is on CD2 only
+	LOCAL_CACHE	= 0x4,		// Cluster is cached on HDD
+	LOCAL_PERM	= 0x8		// Cluster is on HDD.
+};
+
 struct CdInf {
 	uint8 clusterName[20];	// Null terminated cluster name.
 	uint8 cd;		// Cd cluster is on and whether it is on the local drive or not.
@@ -53,7 +61,7 @@
 
 	// Until proven differently, assume we're on CD 1. This is so the start
 	// dialog will be able to play any music at all.
-	setCD(CD1);
+	setCD(1);
 
 	// We read in the resource info which tells us the names of the
 	// resource cluster files ultimately, although there might be groups
@@ -158,11 +166,13 @@
 		// all here.
 
 		if (cdInf[i].cd & LOCAL_PERM)
-			cdInf[i].cd = LOCAL_PERM;
+			cdInf[i].cd = 0;
+		else if (cdInf[i].cd & CD1)
+			cdInf[i].cd = 1;
 		else if (cdInf[i].cd & CD2)
-			cdInf[i].cd = CD2;
+			cdInf[i].cd = 2;
 		else
-			cdInf[i].cd = CD1;
+			cdInf[i].cd = 0;
 	}
 
 	file.close();
@@ -402,10 +412,10 @@
 		// playing a demo, then we're in trouble if the file
 		// can't be found!
 
-		if ((_vm->_features & GF_DEMO) || (_resFiles[fileNum].cd & LOCAL_PERM))
+		if ((_vm->_features & GF_DEMO) || _resFiles[fileNum].cd == 0)
 			error("Could not find '%s'", _resFiles[fileNum].fileName);
 
-		askForCD(_resFiles[fileNum].cd & 3);
+		askForCD(_resFiles[fileNum].cd);
 	}
 	return file;
 }

Index: resman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- resman.h	21 Dec 2005 10:57:48 -0000	1.30
+++ resman.h	1 Jan 2006 16:29:23 -0000	1.31
@@ -32,14 +32,6 @@
 
 class Sword2Engine;
 
-enum {
-	BOTH		= 0x0,		// Cluster is on both CDs
-	CD1		= 0x1,		// Cluster is on CD1 only
-	CD2		= 0x2,		// Cluster is on CD2 only
-	LOCAL_CACHE	= 0x4,		// Cluster is cached on HDD
-	LOCAL_PERM	= 0x8		// Cluster is on HDD.
-};
-
 struct Resource {
 	byte *ptr;
 	uint32 size;
@@ -119,10 +111,8 @@
 	void askForCD(int cd);
 
 	void setCD(int cd) {
-		if (cd == CD1)
-			_curCD = 1;
-		else if (cd == CD2)
-			_curCD = 2;
+		if (cd)
+			_curCD = cd;
 	}
 
 	int getCD() {





More information about the Scummvm-git-logs mailing list