[Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.139,1.140 talk.cpp,1.111,1.112

Gregory Montoir cyx at users.sourceforge.net
Mon Dec 6 12:43:08 CET 2004


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

Modified Files:
	cutaway.cpp talk.cpp 
Log Message:
Cutaway code also handles some talking stuff... Updated this part too, to fix 'bug' #1034715

Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -d -r1.139 -r1.140
--- cutaway.cpp	3 Dec 2004 22:39:54 -0000	1.139
+++ cutaway.cpp	6 Dec 2004 20:42:10 -0000	1.140
@@ -1165,30 +1165,12 @@
 	} // for()
 }
 
-static char *right(char *str, int count) {
-	// This function does _not_ use static data (the implementation in talk.c does!)
-	int length = strlen(str);
-	if (count > length)
-		return str;
-	else
-		return str + length - count;
-}
-
 void Cutaway::talk(char *nextFilename) {
-	// Lines 2119-2131 in cutaway.c
-	
-	if (0 == scumm_stricmp(right(_talkFile, 4), ".dog")) {
+	const char *p = strrchr(_talkFile, '.');
+	if (p && 0 == scumm_stricmp(p, ".dog")) {
 		nextFilename[0] = '\0';
-
-		int personInRoom;
-
-		if (_talkTo > 0)
-			personInRoom = _talkTo - _vm->logic()->roomData(_vm->logic()->currentRoom());
-		else {
-			warning("_talkTo is 0!");
-			personInRoom = 0; 			// XXX is this correct?
-		}
-
+		assert(_talkTo > 0);
+		int personInRoom = _talkTo - _vm->logic()->roomData(_vm->logic()->currentRoom());
 		_vm->logic()->startDialogue(_talkFile, personInRoom, nextFilename);
 	}
 }
@@ -1269,14 +1251,9 @@
 			_vm->display()->clearTexts(0, 150);
 	}
 
-	int i;
-	for (i = 0; i < spaces; i++) {
+	while (1) {
 		_vm->update();
 
-		if (OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) {
-			// XXX: see if speaking is finished
-		}
-
 		if (_vm->input()->cutawayQuit())
 			return;
 
@@ -1284,9 +1261,20 @@
 			_vm->input()->clearKeyVerb();
 			break;
 		}
+
+		if ((OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) && _vm->sound()->speechOn()) {
+			if (!_vm->sound()->isSpeechActive()) {
+				break;
+			}
+		} else {
+			--spaces;
+			if (spaces <= 0) {
+				break;
+			}
+		}
 	}
 
-	_vm->display()->clearTexts(0,198);
+	_vm->display()->clearTexts(0, 198);
 	_vm->update();
 }
 		

Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- talk.cpp	3 Dec 2004 22:39:55 -0000	1.111
+++ talk.cpp	6 Dec 2004 20:42:11 -0000	1.112
@@ -792,7 +792,7 @@
 	segment[length] = '\0';
 	
 	char voiceFileName[MAX_STRING_SIZE];
-	snprintf(voiceFileName, sizeof(voiceFileName), "%s%1x", voiceFilePrefix, index + 1);
+	sprintf(voiceFileName, "%s%1x", voiceFilePrefix, index + 1);
 
 	// FIXME - it seems the french talkie version has a useless voice file ; 
 	// the c30e_102 file is very similar to c30e_101, so there is no need to 
@@ -1044,6 +1044,10 @@
 			str[length] = '\0';
 		}
 		offset = (offset + length + (align - 1)) & ~(align - 1);
+	} else {
+		if (str) {
+			str[0] = '\0';
+		}
 	}
 }
 





More information about the Scummvm-git-logs mailing list