[Scummvm-cvs-logs] CVS: scummvm/queen talk.cpp,1.5,1.6 talk.h,1.3,1.4

David Eriksson twogood at users.sourceforge.net
Fri Oct 10 02:46:07 CEST 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv16255

Modified Files:
	talk.cpp talk.h 
Log Message:
Improved Talk class.


Index: talk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- talk.cpp	9 Oct 2003 16:33:00 -0000	1.5
+++ talk.cpp	10 Oct 2003 09:45:22 -0000	1.6
@@ -66,6 +66,24 @@
 	debug(0, "----- talk(\"%s\") -----", filename);
 	
 	cutawayFilename[0] = '\0';
+
+	// XXX S=SUBJECT[1];
+	// XXX R=ROOM_DATA[ROOM];
+	// XXX if(OBJECT_DATA[NOUN2+R][0]<=0) return;
+	// XXX if(OBJECT_DATA[NOUN2+R][4]>0) return;
+	// XXX strcpy(Pstr,FIND_STATE(OBJECT_DATA[NOUN2+R][6],"TALK"));
+
+	// I cant talk to that.
+
+	// XXX if(seq(Pstr,"MUTE")) {
+	// XXX 	k=24+Rnd(2);
+	// XXX 	SPEAK(JOE_RESPstr[k],"JOE",find_cd_desc(k));
+	// XXX 	return;
+	// XXX }
+	// XXX panelflag=0;
+
+
+	
 	load(filename);
 
 	char personName[MAX_STRING_SIZE];
@@ -107,7 +125,6 @@
 		// debug(0, "retval = %i", retval);
 		
 		char otherVoiceFilePrefix    [MAX_STRING_SIZE];
-		char joeVoiceFilePrefix   [5][MAX_STRING_SIZE];
 
 		_talkString[0][0] = '\0';
 
@@ -136,7 +153,7 @@
 			if (index < 0 && _logic->gameState(abs(index)) != _dialogueTree[level][i].gameStateValue)
 				_talkString[i][0] = '\0';
 
-			sprintf(joeVoiceFilePrefix[i], "%2d%4xJ", _talkKey, _dialogueTree[level][i].head);
+			sprintf(_joeVoiceFilePrefix[i], "%2d%4xJ", _talkKey, _dialogueTree[level][i].head);
 		}
 
 		// Check to see if(all the dialogue options have been selected.
@@ -163,7 +180,7 @@
 			if (_quit)
 				break;
 
-			speak(_talkString[selectedSentence], personName, joeVoiceFilePrefix[selectedSentence]);
+			speak(_talkString[selectedSentence], personName, _joeVoiceFilePrefix[selectedSentence]);
 		}
 		else {
 			if (bobNum > 0) {
@@ -461,14 +478,6 @@
 	return str;
 }
 
-static void text(int x, int y, const char *str) {
-	
-	// This function is just for debugging, the caller should really use some
-	// method in Queen::Graphics.
-	
-	debug(0, "Write '%s' at (%i,%i)", str, x, y);
-}
-
 int16 Talk::selectSentence() {
 	// Function TALK_BOB (lines 577-739) in talk.c
 	int selectedSentence = 0;
@@ -478,6 +487,10 @@
 	int optionLines = 0;
 	char optionText[5][MAX_STRING_SIZE];
 
+	// Change NORMAL_INK -> TALK_NORMAL_INK
+
+	_graphics->textCurrentColor(INK_TALK_NORMAL);
+
 	// These bobs are up and down arrows
 
 	BobSlot *bob1 = _graphics->bob(SENTENCE_BOB_1);
@@ -508,7 +521,7 @@
 			// XXX SetZone(1,6,MAXTEXTLEN+1,25,319,49);
 		}
 
-		// blanktexts(151,199);
+		_graphics->textClear(151,199);
 
 		int sentenceCount = 0;
 		int yOffset = 1;
@@ -517,27 +530,32 @@
 			// XXX TALK_ZONE[I] = 0;
 			if (_talkString[i][0] != '\0') {
 				sentenceCount++;
-				
+
 				char temp[MAX_STRING_SIZE];
 				strcpy(temp, _talkString[i]);
 				optionLines = splitOption(removeStar(temp), optionText);
 
 				if (yOffset < 5)
 					/* XXX SetZone(
-							1, 
-							I, 
-							0, 
-							(yofs * 10) - PUSHUP, 
-							(VersionStr[1] =='E') ? 319 : MAX_TEXT_WIDTH,
-							10 * optionLines + (yOffset * 10) - PUSHUP) */;
+						 1, 
+						 I, 
+						 0, 
+						 (yofs * 10) - PUSHUP, 
+						 (VersionStr[1] =='E') ? 319 : MAX_TEXT_WIDTH,
+						 10 * optionLines + (yOffset * 10) - PUSHUP) */;
 
-				for (int j = 0; j < optionLines; j++) {
-					if (yOffset < 5)
-						text((j == 0) ? 0 : 24, 150 - PUSHUP + yOffset * 10, optionText[j]);
-					yOffset++;
-				}
-				
-			// XXX TALK_ZONE[i] = sentenceCount;
+					for (int j = 0; j < optionLines; j++) {
+						if (yOffset < 5) {
+							debug(0, "Draw text '%s'", optionText[j]);
+							_graphics->textSet(
+									(j == 0) ? 0 : 24, 
+									150 - PUSHUP + yOffset * 10, 
+									optionText[j]);
+						}
+						yOffset++;
+					}
+
+				// XXX TALK_ZONE[i] = sentenceCount;
 			}
 		}
 
@@ -552,15 +570,44 @@
 
 		// XXX KEYVERB=0;
 		if (sentenceCount > 0) {
-			// XXX CH=0, S=0, OLDS=0;
-      // XXX while(CH==0) 
+			int zone = 0;
+			int oldZone = 0;
 
-			if (_quit)
-				break;
+			while (0 == selectedSentence) {
 
-			// XXX update();
+				if (_quit)
+					break;
 
-			// XXX manage input 
+				_graphics->update();
+
+				// XXX zone = zone(1, mouseX, mouseY);
+
+				if (5 == zone || 6 == zone) {
+					// XXX Arrow zones
+				}
+				else {
+					if (oldZone != zone) {
+						// Changed zone, change text colors
+
+						if (zone > 0) {
+
+							// XXX for (int i = zones[1][zone].y1; i < zones[1][zone].y2; i += 10)
+							// XXX 	texts[i + 150].col = INK_JOE;
+						}
+
+						if (oldZone > 0) {
+							// XXX 	for (i = zones[1][oldZone].y1; i < zones[1][oldZone].y2; i += 10)
+							// XXX 		texts[i + 150].col = INK_TALK_NORMAL;
+						}
+
+						oldZone = zone;
+					}
+
+				}
+
+				// XXX make the loop exit as we can't get any input yet
+				selectedSentence = 1;
+			} // while()
 		}
 	}
 
@@ -576,10 +623,20 @@
 	}
 	// XXX End debug stuff
 
+
+	debug(0, "Selected sentence %i", selectedSentence);
+
 	bob1->active = false;
 	bob2->active = false;
 
-	debug(0, "Selected sentence %i", selectedSentence);
+	if (selectedSentence > 0) {
+		_graphics->textClear(0,198);
+
+		speak(_talkString[selectedSentence], "JOE", _joeVoiceFilePrefix[selectedSentence]);
+	}
+	
+	_graphics->textClear(151,151);
+
 	return selectedSentence;
 }
 

Index: talk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/talk.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- talk.h	7 Oct 2003 12:20:31 -0000	1.3
+++ talk.h	10 Oct 2003 09:45:22 -0000	1.4
@@ -123,6 +123,7 @@
 		int _oldSelectedSentenceValue;
 
 		char _talkString[5][MAX_STRING_SIZE];
+		char _joeVoiceFilePrefix[5][MAX_STRING_SIZE];
 
 		Talk(Graphics *graphics, Logic *logic, Resource *resource);
 		~Talk();





More information about the Scummvm-git-logs mailing list