aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2011-01-29 07:22:04 +0000
committerNicola Mettifogo2011-01-29 07:22:04 +0000
commit2856e959be74d7ec062d48f6560d33c227c6a6b3 (patch)
treef05ec241a225e368e7262c5c7d7b9228115f48d6
parentbcd18232ad80097f45181594628eb193700b93e0 (diff)
downloadscummvm-rg350-2856e959be74d7ec062d48f6560d33c227c6a6b3.tar.gz
scummvm-rg350-2856e959be74d7ec062d48f6560d33c227c6a6b3.tar.bz2
scummvm-rg350-2856e959be74d7ec062d48f6560d33c227c6a6b3.zip
PARALLACTION: Cleanup dialogue code.
Turned 'no answer selected' into a constant. svn-id: r55607
-rw-r--r--engines/parallaction/dialogue.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index fc39286b7e..4ce060c31d 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -107,6 +107,8 @@ protected:
DIALOGUE_OVER
} _state;
+ static const int NO_ANSWER_SELECTED = -1;
+
void transitionToState(DialogueState newState);
bool displayQuestion();
@@ -205,7 +207,7 @@ void DialogueManager::displayAnswers() {
} else
if (_numVisAnswers > 1) {
mood = _visAnswers[0]._a->speakerMood();
- _oldSelection = -1;
+ _oldSelection = NO_ANSWER_SELECTED;
_selection = 0;
}
@@ -222,7 +224,7 @@ int16 DialogueManager::selectAnswer1() {
return _visAnswers[0]._index;
}
- return -1;
+ return NO_ANSWER_SELECTED;
}
int16 DialogueManager::selectAnswerN() {
@@ -230,11 +232,11 @@ int16 DialogueManager::selectAnswerN() {
_selection = _vm->_balloonMan->hitTestDialogueBalloon(_mousePos.x, _mousePos.y);
if (_selection != _oldSelection) {
- if (_oldSelection != -1) {
+ if (_oldSelection != NO_ANSWER_SELECTED) {
_vm->_balloonMan->setBalloonText(_visAnswers[_oldSelection]._balloon, _visAnswers[_oldSelection]._a->_text, BalloonManager::kUnselectedColor);
}
- if (_selection != -1) {
+ if (_selection != NO_ANSWER_SELECTED) {
_vm->_balloonMan->setBalloonText(_visAnswers[_selection]._balloon, _visAnswers[_selection]._a->_text, BalloonManager::kSelectedColor);
_vm->_gfx->setItemFrame(_faceId, _visAnswers[_selection]._a->speakerMood());
}
@@ -242,11 +244,11 @@ int16 DialogueManager::selectAnswerN() {
_oldSelection = _selection;
- if ((_mouseButtons == kMouseLeftUp) && (_selection != -1)) {
+ if ((_mouseButtons == kMouseLeftUp) && (_selection != NO_ANSWER_SELECTED)) {
return _visAnswers[_selection]._index;
}
- return -1;
+ return NO_ANSWER_SELECTED;
}
bool DialogueManager::displayQuestion() {
@@ -298,7 +300,7 @@ void DialogueManager::nextAnswer() {
void DialogueManager::runAnswer() {
_answerId = selectAnswer();
- if (_answerId != -1) {
+ if (_answerId != NO_ANSWER_SELECTED) {
_cmdList = &_q->_answers[_answerId]->_commands;
_vm->_gfx->freeDialogueObjects();
transitionToState(NEXT_QUESTION);
@@ -396,7 +398,7 @@ protected:
}
}
- return -1;
+ return NO_ANSWER_SELECTED;
}
public:
@@ -432,7 +434,7 @@ public:
}
virtual int16 selectAnswer() {
- int ans = -1;
+ int ans = NO_ANSWER_SELECTED;
if (_askPassword) {
ans = askPassword();
} else
@@ -481,7 +483,7 @@ public:
}
virtual int16 selectAnswer() {
- int16 ans = -1;
+ int16 ans = NO_ANSWER_SELECTED;
if (_numVisAnswers == 1) {
ans = selectAnswer1();
} else {