[Scummvm-cvs-logs] CVS: scummvm/sword2 maketext.cpp,1.52,1.53 resman.cpp,1.119,1.120 resman.h,1.29,1.30 sound.h,1.25,1.26

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed Dec 21 02:58:03 CET 2005


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

Modified Files:
	maketext.cpp resman.cpp resman.h sound.h 
Log Message:
Added debugging messages to track which CD (1 or 2) the game thinks it's
supposed to be reading data from. Maybe this will help track down the
mysterious missing speech problem reported on the forum.


Index: maketext.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/maketext.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- maketext.cpp	29 Oct 2005 21:24:53 -0000	1.52
+++ maketext.cpp	21 Dec 2005 10:57:48 -0000	1.53
@@ -73,7 +73,7 @@
  */
 
 byte *FontRenderer::makeTextSprite(byte *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes, uint8 border) {
-	debug(3, "makeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth);
+	debug(5, "makeTextSprite(\"%s\", maxWidth=%u)", sentence, maxWidth);
 
 	_borderPen = border;
 

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- resman.cpp	11 Dec 2005 13:15:03 -0000	1.119
+++ resman.cpp	21 Dec 2005 10:57:48 -0000	1.120
@@ -53,7 +53,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.
-	_curCd = 1;
+	setCD(CD1);
 
 	// We read in the resource info which tells us the names of the
 	// resource cluster files ultimately, although there might be groups
@@ -217,10 +217,9 @@
 
 		// If we're loading a cluster that's only available from one
 		// of the CDs, remember which one so that we can play the
-		// correct music.
+		// correct speech and music.
 
-		if ((_resFiles[cluFileNum].cd == CD1) || (_resFiles[cluFileNum].cd == CD2))
-			_curCd = _resFiles[cluFileNum].cd;
+		setCD(_resFiles[cluFileNum].cd);
 
 		// Actually, as long as the file can be found we don't really
 		// care which CD it's on. But if we can't find it, keep asking
@@ -247,6 +246,8 @@
 
 		file->read(_resList[res].ptr, len);
 
+		debug(3, "Loaded resource '%s' from CD %d", fetchName(_resList[res].ptr), getCD());
+
 		if (dump) {
 			char buf[256];
 			const char *tag;
@@ -390,7 +391,7 @@
 		if ((_vm->_features & GF_DEMO) || (_resFiles[fileNum].cd & LOCAL_PERM))
 			error("Could not find '%s'", _resFiles[fileNum].fileName);
 
-		getCd(_resFiles[fileNum].cd & 3);
+		askForCD(_resFiles[fileNum].cd & 3);
 	}
 	return file;
 }
@@ -579,11 +580,7 @@
 		Debug_Printf("Expelled %d resources\n", nuked);
 }
 
-int ResourceManager::whichCd() {
-	return _curCd;
-}
-
-void ResourceManager::getCd(int cd) {
+void ResourceManager::askForCD(int cd) {
 	byte *textRes;
 
 	// Stop any music from playing - so the system no longer needs the

Index: resman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- resman.h	29 Oct 2005 21:24:53 -0000	1.29
+++ resman.h	21 Dec 2005 10:57:48 -0000	1.30
@@ -64,7 +64,7 @@
 
 	Sword2Engine *_vm;
 
-	int _curCd;
+	int _curCD;
 	uint32 _totalResFiles;
 	uint32 _totalClusters;
 
@@ -116,9 +116,18 @@
 	}
 
 	// Prompts the user for the specified CD.
-	void getCd(int cd);
+	void askForCD(int cd);
 
-	int whichCd();
+	void setCD(int cd) {
+		if (cd == CD1)
+			_curCD = 1;
+		else if (cd == CD2)
+			_curCD = 2;
+	}
+
+	int getCD() {
+		return _curCD;
+	}
 
 	void remove(int res);
 	void removeAll();

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sound.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- sound.h	11 Dec 2005 08:30:47 -0000	1.25
+++ sound.h	21 Dec 2005 10:57:48 -0000	1.26
@@ -152,7 +152,7 @@
 	bool isStereo() const	{ return _decoder->isStereo(); }
 	int getRate() const	{ return _decoder->getRate(); }
 
-	int whichCd()		{ return _cd; }
+	int getCD()		{ return _cd; }
 
 	void fadeUp();
 	void fadeDown();





More information about the Scummvm-git-logs mailing list