From bcd18232ad80097f45181594628eb193700b93e0 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sat, 29 Jan 2011 07:21:48 +0000 Subject: PARALLACTION: Cleanup dialogue code. Hide mood and balloon winding extraction into Question and Answer objects. svn-id: r55606 --- engines/parallaction/dialogue.cpp | 10 +++++----- engines/parallaction/objects.cpp | 13 +++++++++++++ engines/parallaction/objects.h | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'engines') 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 { -- cgit v1.2.3