[Scummvm-cvs-logs] SF.net SVN: scummvm: [27264] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Jun 10 02:36:03 CEST 2007


Revision: 27264
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27264&view=rev
Author:   thebluegr
Date:     2007-06-09 17:36:01 -0700 (Sat, 09 Jun 2007)

Log Message:
-----------
Fixed conversations in IHNM. Now, when a dialog option is selected, the protagonist will say it out properly before we hear the other character's reply. Also, added some more code for sfScriptFade and made it a stub for now, as it still needs work

Modified Paths:
--------------
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/interface.h
    scummvm/trunk/engines/saga/puzzle.cpp
    scummvm/trunk/engines/saga/script.h
    scummvm/trunk/engines/saga/sfuncs.cpp
    scummvm/trunk/engines/saga/sthread.cpp

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2007-06-09 22:45:03 UTC (rev 27263)
+++ scummvm/trunk/engines/saga/interface.cpp	2007-06-10 00:36:01 UTC (rev 27264)
@@ -2027,7 +2027,7 @@
 	_conversePos = -1;
 }
 
-bool Interface::converseAddText(const char *text, int replyId, byte replyFlags, int replyBit) {
+bool Interface::converseAddText(const char *text, int strId, int replyId, byte replyFlags, int replyBit) {
 	int count = 0;	// count how many pieces of text per string
 	int i;
 	int len;
@@ -2058,6 +2058,7 @@
 		_converseText[_converseTextCount].text = (char *)malloc(i + 1);
 		strncpy(_converseText[_converseTextCount].text, _converseWorkString, i);
 
+		_converseText[_converseTextCount].strId = strId;
 		_converseText[_converseTextCount].text[i] = 0;
 		_converseText[_converseTextCount].textNum = count;
 		_converseText[_converseTextCount].stringNum = _converseStrCount;
@@ -2187,7 +2188,7 @@
 
 	ct = &_converseText[_conversePos];
 
-	_vm->_script->finishDialog(ct->replyId, ct->replyFlags, ct->replyBit);
+	_vm->_script->finishDialog(ct->strId, ct->replyId, ct->replyFlags, ct->replyBit);
 
 	if (_vm->_puzzle->isActive())
 		_vm->_puzzle->handleReply(ct->replyId);

Modified: scummvm/trunk/engines/saga/interface.h
===================================================================
--- scummvm/trunk/engines/saga/interface.h	2007-06-09 22:45:03 UTC (rev 27263)
+++ scummvm/trunk/engines/saga/interface.h	2007-06-10 00:36:01 UTC (rev 27264)
@@ -157,6 +157,7 @@
 
 struct Converse {
 	char *text;
+	int strId;
 	int stringNum;
 	int textNum;
 	int replyId;
@@ -346,7 +347,7 @@
 public:
 	void converseInit(void);
 	void converseClear(void);
-	bool converseAddText(const char *text, int replyId, byte replyFlags, int replyBit);
+	bool converseAddText(const char *text, int strId, int replyId, byte replyFlags, int replyBit);
 	void converseDisplayText();
 	void converseSetTextLines(int row);
 	void converseChangePos(int chg);

Modified: scummvm/trunk/engines/saga/puzzle.cpp
===================================================================
--- scummvm/trunk/engines/saga/puzzle.cpp	2007-06-09 22:45:03 UTC (rev 27263)
+++ scummvm/trunk/engines/saga/puzzle.cpp	2007-06-10 00:36:01 UTC (rev 27264)
@@ -439,9 +439,9 @@
 		_vm->_timer->installTimerProc(&hintTimerCallback, 50000, this);
 
 		_vm->_interface->converseClear();
-		_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 1, 0, 0 );
-		_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 2, 0, 0 );
-		_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0 );
+		_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 0, 1, 0, 0 );
+		_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 0, 2, 0, 0 );
+		_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0 );
 		_vm->_interface->converseDisplayText();
 		break;
 
@@ -458,9 +458,9 @@
 
 	case kRQSakkaDenies:
 		_vm->_interface->converseClear();
-		_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 1, 0, 0);
-		_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 2, 0, 0);
-		_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
+		_vm->_interface->converseAddText(optionsStr[_lang][kROAccept], 0, 1, 0, 0);
+		_vm->_interface->converseAddText(optionsStr[_lang][kRODecline], 0, 2, 0, 0);
+		_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0);
 		_vm->_interface->converseDisplayText();
 
 		_vm->_timer->installTimerProc(&hintTimerCallback, kPuzzleHintTime, this);
@@ -546,7 +546,7 @@
 
 	_hintRqState = kRQNoHint;
 
-	_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
+	_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0);
 	_vm->_interface->converseDisplayText();
 
 	_vm->_timer->removeTimerProc(&hintTimerCallback);
@@ -555,7 +555,7 @@
 
 void Puzzle::clearHint(void) {
 	_vm->_interface->converseClear();
-	_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0);
+	_vm->_interface->converseAddText(optionsStr[_lang][kROLater], 0, 0, 0, 0);
 	_vm->_interface->converseDisplayText();
 	_vm->_interface->setStatusText(" ");
 }

Modified: scummvm/trunk/engines/saga/script.h
===================================================================
--- scummvm/trunk/engines/saga/script.h	2007-06-09 22:45:03 UTC (rev 27263)
+++ scummvm/trunk/engines/saga/script.h	2007-06-10 00:36:01 UTC (rev 27264)
@@ -474,7 +474,7 @@
 	void setThreadEntrypoint(ScriptThread *thread, int entrypointNumber);
 
 public:
-	void finishDialog(int replyID, int flags, int bitOffset);
+	void finishDialog(int strID, int replyID, int flags, int bitOffset);
 
 private:
 

Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp	2007-06-09 22:45:03 UTC (rev 27263)
+++ scummvm/trunk/engines/saga/sfuncs.cpp	2007-06-10 00:36:01 UTC (rev 27264)
@@ -1830,12 +1830,25 @@
 	}
 }
 
-void Script::finishDialog(int replyID, int flags, int bitOffset) {
+void Script::finishDialog(int strID, int replyID, int flags, int bitOffset) {
 	byte *addr;
+	const char *str;
 
 	if (_conversingThread) {
 		_vm->_interface->setMode(kPanelNull);
 
+		if (_vm->getGameType() == GType_IHNM) {
+			str = _conversingThread->_strings->getString(strID);
+			if (strcmp(str, "[") != 0) {
+				int sampleResourceId = -1;
+				sampleResourceId = _conversingThread->_voiceLUT->voices[strID];
+				if (sampleResourceId < 0 || sampleResourceId > 4000)
+					sampleResourceId = -1;
+
+				_vm->_actor->actorSpeech(_vm->_actor->_protagonist->_id, &str, 1, sampleResourceId, 0);
+			}
+		}
+
 		_conversingThread->_flags &= ~kTFlagWaiting;
 
 		_conversingThread->push(replyID);
@@ -1911,17 +1924,30 @@
 	int16 startingBrightness = thread->pop();
 	int16 endingBrightness = thread->pop();
 	// delay between pal changes is always 10 (not used)
-
+	static PalEntry cur_pal[PAL_ENTRIES];
 	Event event;
-	static PalEntry cur_pal[PAL_ENTRIES];
+	short delta = (startingBrightness < endingBrightness) ? +1 : -1;
 
 	_vm->_gfx->getCurrentPal(cur_pal);
 
+	// TODO: This is still wrong, probably a new event type needs to be added (kEventPalFade)
+	warning("TODO: sfScriptFade");
+	return;
+
+	if (startingBrightness > 255) 
+		startingBrightness = 255;
+	if (startingBrightness < 0 ) 
+		startingBrightness = 0;
+	if (endingBrightness > 255) 
+		endingBrightness = 255;
+	if (endingBrightness < 0) 
+		endingBrightness = 0;
+
 	event.type = kEvTImmediate;
 	event.code = kPalEvent;
 	event.op = kEventPalToBlack;
 	event.time = 0;
-	event.duration = endingBrightness - startingBrightness;
+	event.duration = kNormalFadeDuration - ((endingBrightness - startingBrightness) * delta);
 	event.data = cur_pal;
 
 	_vm->_events->queue(&event);	

Modified: scummvm/trunk/engines/saga/sthread.cpp
===================================================================
--- scummvm/trunk/engines/saga/sthread.cpp	2007-06-09 22:45:03 UTC (rev 27263)
+++ scummvm/trunk/engines/saga/sthread.cpp	2007-06-10 00:36:01 UTC (rev 27264)
@@ -700,6 +700,7 @@
 				replyNum = scriptS.readByte();
 				flags = scriptS.readByte();
 				iparam1 = 0;
+				int strID = thread->pop();
 
 				if (flags & kReplyOnce) {
 					iparam1 = scriptS.readSint16LE();
@@ -709,8 +710,8 @@
 					}
 				}
 
-				str = thread->_strings->getString(thread->pop());
-				if (_vm->_interface->converseAddText(str, replyNum, flags, iparam1))
+				str = thread->_strings->getString(strID);
+				if (_vm->_interface->converseAddText(str, strID, replyNum, flags, iparam1))
 					warning("Error adding ConverseText (%s, %d, %d, %d)", str, replyNum, flags, iparam1);
 			}
 			break;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list