[Scummvm-git-logs] scummvm master -> b1105a6686215a965e8580af84d16d7732ce5b49

dreammaster dreammaster at scummvm.org
Sat Sep 3 00:17:09 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b1105a6686 TITANIC: Fixes to building NPC response chain


Commit: b1105a6686215a965e8580af84d16d7732ce5b49
    https://github.com/scummvm/scummvm/commit/b1105a6686215a965e8580af84d16d7732ce5b49
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-02T18:17:00-04:00

Commit Message:
TITANIC: Fixes to building NPC response chain

Changed paths:
    engines/titanic/game/computer_screen.cpp
    engines/titanic/true_talk/tt_script_base.cpp
    engines/titanic/true_talk/tt_script_base.h



diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp
index 3e51722..0572258 100644
--- a/engines/titanic/game/computer_screen.cpp
+++ b/engines/titanic/game/computer_screen.cpp
@@ -111,7 +111,7 @@ bool CComputerScreen::TimerMsg(CTimerMsg *msg) {
 		playSound("a#29.wav");
 		stopSound(handle);
 
-		playSound("y#662.wav");
+		handle = playSound("y#662.wav");
 		setSoundVolume(handle, 10, 2);
 		playClip(392, 450);
 		startTalking("Doorbot", 0x3611A);
diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp
index 4109134..2f58ad1 100644
--- a/engines/titanic/true_talk/tt_script_base.cpp
+++ b/engines/titanic/true_talk/tt_script_base.cpp
@@ -118,37 +118,41 @@ void TTscriptBase::applyResponse() {
 }
 
 void TTscriptBase::deleteResponses() {
-	while (_respTailP) {
-		_respHeadP = _respTailP;
-		_respTailP = _respHeadP->getLink();
-		delete _respHeadP;
+	while (_respHeadP) {
+		_respTailP = _respHeadP;
+		_respHeadP = _respTailP->getLink();
+		delete _respTailP;
 	}
 }
 
-void TTscriptBase::appendResponse(int val1, int *val2, int val3) {
-	if (!val2 || val1 <= *val2) {
-		if (_respHeadP) {
-			_respHeadP = new TTresponse(_respHeadP);
+void TTscriptBase::appendResponse(int index, int *maxP, int id) {
+	if (id && (!maxP || index <= *maxP)) {
+		if (_respTailP) {
+			// Prior fragments already exist, so append to end of chain
+			_respTailP = new TTresponse(_respTailP);
 		} else {
-			_respHeadP = new TTresponse(val3, 3);
-			if (_respTailP)
-				_respTailP->addLink(_respHeadP);
+			// Currently no tail
+			_respTailP = new TTresponse(id, 3);
+			if (_respHeadP)
+				_respHeadP->addLink(_respTailP);
 			else
-				_respTailP = _respHeadP;
+				_respHeadP = _respTailP;
 		}
 	}
 }
 
-void TTscriptBase::appendResponse(int val1, int *val2, const TTstring &str) {
-	if (!val2 || val1 <= *val2) {
-		if (_respHeadP) {
-			_respHeadP = new TTresponse(str);
+void TTscriptBase::appendResponse(int index, int *maxP, const TTstring &str) {
+	if (!maxP || index <= *maxP) {
+		if (_respTailP) {
+			// Prior fragments already exist, so append to end of chain
+			_respTailP = new TTresponse(str);
 		} else {
-			_respHeadP = new TTresponse(str);
-			if (_respTailP)
-				_respTailP->addLink(_respHeadP);
+			// Currently no tail
+			_respTailP = new TTresponse(str);
+			if (_respHeadP)
+				_respHeadP->addLink(_respTailP);
 			else
-				_respTailP = _respHeadP;
+				_respHeadP = _respTailP;
 		}
 	}
 }
diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h
index c489dcb..869b0be 100644
--- a/engines/titanic/true_talk/tt_script_base.h
+++ b/engines/titanic/true_talk/tt_script_base.h
@@ -51,8 +51,8 @@ protected:
 	int _state;
 	TThist *_hist2P;
 	int _field3C;
-	TTresponse *_respHeadP;
 	TTresponse *_respTailP;
+	TTresponse *_respHeadP;
 	TTresponse *_oldResponseP;
 	int _status;
 protected:
@@ -62,14 +62,21 @@ protected:
 	void deleteResponses();
 	
 	/**
-	 * Creates and appends a new response to the script
+	 * Creates and appends a new response fragment to the script specified by
+	 * the given conversation Id
 	 */
-	void appendResponse(int val1, int *val2, int val3);
+	void appendResponse(int index, int *maxP, int id);
 
-	void appendResponse(int val1, int *val2, const TTstring &str);
+	/**
+	 * Creates and appends a new response fragment string to the script
+	 */
+	void appendResponse(int index, int *maxP, const TTstring &str);
 
-	void appendResponse2(int val1, int *val2, const TTstring &str) {
-		appendResponse(val1, val2, str);
+	/**
+	 * Creates and appends a new response fragment string to the script
+	 */
+	void appendResponse2(int index, int *maxP, const TTstring &str) {
+		appendResponse(index, maxP, str);
 	}
 
 	/**





More information about the Scummvm-git-logs mailing list