aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-19 22:21:10 +0000
committerNicola Mettifogo2007-03-19 22:21:10 +0000
commit8f69bae8eca8da9c6473c832386527051113c364 (patch)
tree9a58491e0061875ba5aa3d9437b10ab2e2bd70d8 /engines/parallaction
parentd5e26cf261c0fab2d83f71c68a5ea2d4f99de396 (diff)
downloadscummvm-rg350-8f69bae8eca8da9c6473c832386527051113c364.tar.gz
scummvm-rg350-8f69bae8eca8da9c6473c832386527051113c364.tar.bz2
scummvm-rg350-8f69bae8eca8da9c6473c832386527051113c364.zip
a bit of refactoring for dialogue code
svn-id: r26246
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/dialogue.cpp43
1 files changed, 20 insertions, 23 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index 1b1099ca73..596be3b262 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -315,13 +315,19 @@ bool displayAnswers(Dialogue *q) {
return displayed;
}
-void displayQuestion(Dialogue *q, StaticCnv *face) {
+void displayQuestion(Dialogue *q, Cnv *cnv) {
int16 w = 0, h = 0;
if (!scumm_stricmp(q->_text, "NULL")) return;
- _vm->_gfx->flatBlitCnv(face, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y, Gfx::kBitFront);
+ StaticCnv face;
+ face._width = cnv->_width;
+ face._height = cnv->_height;
+ face._data0 = cnv->_array[q->_mood & 0xF];
+ face._data1 = NULL; // cnv->field_8[v60->_mood & 0xF];
+
+ _vm->_gfx->flatBlitCnv(&face, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y, Gfx::kBitFront);
_vm->_gfx->getStringExtent(q->_text, MAX_BALLOON_WIDTH, &w, &h);
Common::Rect r(w, h);
@@ -337,16 +343,22 @@ void displayQuestion(Dialogue *q, StaticCnv *face) {
return;
}
-uint16 getDialogueAnswer(Dialogue *q, StaticCnv *face) {
+uint16 getDialogueAnswer(Dialogue *q, Cnv *cnv) {
uint16 answer = 0;
- _vm->_gfx->flatBlitCnv(face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront);
+ StaticCnv face;
+ face._width = cnv->_width;
+ face._height = cnv->_height;
+ face._data0 = cnv->_array[0];
+ face._data1 = NULL; // cnv->field_8[0];
+
+ _vm->_gfx->flatBlitCnv(&face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront);
if (_askPassword == false) {
- answer = selectAnswer(q, face);
+ answer = selectAnswer(q, &face);
} else {
- answer = askDialoguePassword(q, face);
+ answer = askDialoguePassword(q, &face);
}
_vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); // erase answer screen
@@ -371,14 +383,6 @@ void runDialogue(SpeakData *data) {
v6E = _vm->_disk->loadTalk(data->_name);
}
- StaticCnv questioner;
- questioner._width = v6E->_width;
- questioner._height = v6E->_height;
-
- StaticCnv answerer;
- answerer._width = _vm->_char._talk->_width;
- answerer._height = _vm->_char._talk->_height;
-
bool displayedAnswers = false;
_askPassword = false;
uint16 answer = 0;
@@ -387,13 +391,7 @@ void runDialogue(SpeakData *data) {
Dialogue *q = data->_dialogue;
while (q) {
- questioner._data0 = v6E->_array[q->_mood & 0xF];
- questioner._data1 = NULL; // v6E.field_8[v60->_mood & 0xF];
- answerer._data0 = _vm->_char._talk->_array[0];
- answerer._data1 = NULL; // _talk.field_8[0];
-
- displayQuestion(q, &questioner);
-
+ displayQuestion(q, v6E);
if (q->_answers[0] == NULL) break;
_answerBalloonY[0] = 10;
@@ -402,9 +400,8 @@ void runDialogue(SpeakData *data) {
if (scumm_stricmp(q->_answers[0], "NULL")) {
displayedAnswers = displayAnswers(q);
-
if (displayedAnswers == true) {
- answer = getDialogueAnswer(q, &answerer);
+ answer = getDialogueAnswer(q, _vm->_char._talk);
v34 = q->_commands[answer];
q = (Dialogue*)q->_following._questions[answer];
} else {