aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2011-01-29 07:21:48 +0000
committerNicola Mettifogo2011-01-29 07:21:48 +0000
commitbcd18232ad80097f45181594628eb193700b93e0 (patch)
tree1a9cd37a3d709c4007a7b685c3a11da02c604b0c /engines
parente1046d3eae8207bc3c65cd6a558dd20191aede3c (diff)
downloadscummvm-rg350-bcd18232ad80097f45181594628eb193700b93e0.tar.gz
scummvm-rg350-bcd18232ad80097f45181594628eb193700b93e0.tar.bz2
scummvm-rg350-bcd18232ad80097f45181594628eb193700b93e0.zip
PARALLACTION: Cleanup dialogue code.
Hide mood and balloon winding extraction into Question and Answer objects. svn-id: r55606
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/dialogue.cpp10
-rw-r--r--engines/parallaction/objects.cpp13
-rw-r--r--engines/parallaction/objects.h3
3 files changed, 21 insertions, 5 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index 098ca90ef9..fc39286b7e 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -200,11 +200,11 @@ void DialogueManager::displayAnswers() {
int mood = 0;
if (_numVisAnswers == 1) {
- mood = _visAnswers[0]._a->_mood & 0xF;
+ mood = _visAnswers[0]._a->speakerMood();
_vm->_balloonMan->setBalloonText(_visAnswers[0]._balloon, _visAnswers[0]._a->_text, BalloonManager::kNormalColor);
} else
if (_numVisAnswers > 1) {
- mood = _visAnswers[0]._a->_mood & 0xF;
+ mood = _visAnswers[0]._a->speakerMood();
_oldSelection = -1;
_selection = 0;
}
@@ -236,7 +236,7 @@ int16 DialogueManager::selectAnswerN() {
if (_selection != -1) {
_vm->_balloonMan->setBalloonText(_visAnswers[_selection]._balloon, _visAnswers[_selection]._a->_text, BalloonManager::kSelectedColor);
- _vm->_gfx->setItemFrame(_faceId, _visAnswers[_selection]._a->_mood & 0xF);
+ _vm->_gfx->setItemFrame(_faceId, _visAnswers[_selection]._a->speakerMood());
}
}
@@ -252,9 +252,9 @@ int16 DialogueManager::selectAnswerN() {
bool DialogueManager::displayQuestion() {
if (_q->textIsNull()) return false;
- _vm->_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->_mood & 0x10, BalloonManager::kNormalColor);
+ _vm->_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->balloonWinding(), BalloonManager::kNormalColor);
_faceId = _vm->_gfx->setItem(_questioner, _ballonPos._questionChar.x, _ballonPos._questionChar.y);
- _vm->_gfx->setItemFrame(_faceId, _q->_mood & 0xF);
+ _vm->_gfx->setItemFrame(_faceId, _q->speakerMood());
return true;
}
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index ecdb0683f4..c345b92ffb 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -261,6 +261,10 @@ Answer::Answer() {
bool Answer::textIsNull() {
return (_text.equalsIgnoreCase("NULL"));
}
+
+int Answer::speakerMood() {
+ return _mood & 0xF;
+}
Question::Question(const Common::String &name) : _name(name), _mood(0) {
memset(_answers, 0, sizeof(_answers));
@@ -276,6 +280,15 @@ bool Question::textIsNull() {
return (_text.equalsIgnoreCase("NULL"));
}
+int Question::speakerMood() {
+ return _mood & 0xF;
+}
+
+int Question::balloonWinding() {
+ return _mood & 0x10;
+}
+
+
Instruction::Instruction() {
_index = 0;
_flags = 0;
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 50a188e91b..5260dcbfe8 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -164,6 +164,7 @@ struct Answer {
Answer();
bool textIsNull();
+ int speakerMood();
};
struct Question {
@@ -175,6 +176,8 @@ struct Question {
Question(const Common::String &name);
~Question();
bool textIsNull();
+ int speakerMood();
+ int balloonWinding();
};
struct Dialogue {