[Scummvm-cvs-logs] SF.net SVN: scummvm:[55604] scummvm/trunk/engines/parallaction/dialogue.cpp

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Jan 29 08:21:13 CET 2011


Revision: 55604
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55604&view=rev
Author:   peres001
Date:     2011-01-29 07:21:13 +0000 (Sat, 29 Jan 2011)

Log Message:
-----------
PARALLACTION: Clarify strategy for choosing (answer) dialogue paths.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/dialogue.cpp

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2011-01-29 07:20:57 UTC (rev 55603)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2011-01-29 07:21:13 UTC (rev 55604)
@@ -110,7 +110,7 @@
 	void transitionToState(DialogueState newState);
 	
 	bool displayQuestion();
-	bool displayAnswers();
+	void displayAnswers();
 	bool testAnswerFlags(Answer *a);
 	virtual void addVisibleAnswers(Question *q) = 0;
 	virtual int16 selectAnswer() = 0;
@@ -187,13 +187,8 @@
 	return ((a->_yesFlags & flags) == a->_yesFlags) && ((a->_noFlags & ~flags) == a->_noFlags);
 }
 
-bool DialogueManager::displayAnswers() {
+void DialogueManager::displayAnswers() {
 
-	addVisibleAnswers(_q);
-	if (_numVisAnswers == 0) {
-		return false;
-	}
-
 	// create balloons
 	int id;
 	for (int i = 0; i < _numVisAnswers; ++i) {
@@ -216,8 +211,6 @@
 
 	_faceId = _vm->_gfx->setItem(_answerer, _ballonPos._answerChar.x, _ballonPos._answerChar.y);
 	_vm->_gfx->setItemFrame(_faceId, mood);
-
-	return true;
 }
 
 int16 DialogueManager::selectAnswer1() {
@@ -282,18 +275,24 @@
 	}
 
 	// try and check if there are any suitable answers, 
-	// given the current game state
+	// given the current game state.
 	addVisibleAnswers(_q);
 	if (!_numVisAnswers) {
+		// if there are no answers, then chicken out
 		transitionToState(DIALOGUE_OVER);
 		return;
 	}
 	
 	if (!_visAnswers[0]._a->_text.compareToIgnoreCase("NULL")) {
+		// if the first answer is null (it's implied that it's the 
+		// only one because we already called addVisibleAnswers),
+		// then jump to the next question
 		_answerId = _visAnswers[0]._index;
 		transitionToState(NEXT_QUESTION);
 	} else {
-		transitionToState(displayAnswers() ? RUN_ANSWER : DIALOGUE_OVER);
+		// at this point we are sure there are non-null answers to show
+		displayAnswers();
+		transitionToState(RUN_ANSWER);
 	}
 }
 


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