[Scummvm-cvs-logs] CVS: scummvm/sword1 sword1.cpp,1.54,1.55

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Oct 13 23:38:03 CEST 2004


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

Modified Files:
	sword1.cpp 
Log Message:
The checkCdFiles() function still looked only for SPEECH1.CLU and
SPEECH2.CLU. Now it also looks for the corresponding CL3 and CLV files.


Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- sword1.cpp	12 Oct 2004 15:50:00 -0000	1.54
+++ sword1.cpp	14 Oct 2004 06:36:05 -0000	1.55
@@ -1070,20 +1070,37 @@
 }
 
 void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or what...
+	const char *speechFiles[] = {
+#ifdef USE_MAD
+		"SPEECH%d.CL3",
+#endif
+#ifdef USE_VORBIS
+		"SPEECH%d.CLV",
+#endif
+		"SPEECH%d.CLU"
+	};
+	int numFiles = 0;
 	File test;
 
 	_systemVars.playSpeech = true;
-	if (test.open("SPEECH1.CLU")) {
-		test.close();
-		if (test.open("SPEECH2.CLU")) {
-			// both files exist, assume running from HDD and everything's fine.
-			test.close();
-			_systemVars.runningFromCd = false;
-			_systemVars.playSpeech = true;
-			return ;
-		} else {
+
+	for (int i = 1; i <= 2; i++) {
+		for (int j = 0; j < ARRAYSIZE(speechFiles); j++) {
+			char fileName[12];
+			sprintf(fileName, speechFiles[j], i);
+			if (test.open(fileName)) {
+				test.close();
+				numFiles++;
+				break;
+			}
 		}
-	} else { // speech1.clu & speech2.clu not present. are we running from cd?
+	}
+
+	if (numFiles == 2) {
+		// both files exist, assume running from HDD and everything's fine.
+		_systemVars.runningFromCd = false;
+		_systemVars.playSpeech = true;
+	} else { // speech1 & speech2 not present. are we running from cd?
 		if (test.open("cd1.id")) {
 			_systemVars.runningFromCd = true;
 			_systemVars.currentCD = 1;





More information about the Scummvm-git-logs mailing list