diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/dialogue.cpp | 71 | ||||
-rw-r--r-- | engines/parallaction/disk.cpp | 5 | ||||
-rw-r--r-- | engines/parallaction/disk.h | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 11 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 8 |
6 files changed, 55 insertions, 48 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 1fe9aeaa79..fccf61a4c2 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -219,7 +219,7 @@ void freeDialogue(Dialogue *d) { } -uint16 askDialoguePassword(Dialogue *v60, StaticCnv *v48) { +uint16 askDialoguePassword(Dialogue *q, StaticCnv *face) { debugC(1, kDebugDialogue, "checkDialoguePassword()"); char password[100]; @@ -233,8 +233,8 @@ uint16 askDialoguePassword(Dialogue *v60, StaticCnv *v48) { r.moveTo(_answerBalloonX[0], _answerBalloonY[0]); _vm->_gfx->drawBalloon(r, 1); - _vm->_gfx->displayWrappedString(v60->_answers[0], _answerBalloonX[0], _answerBalloonY[0], MAX_BALLOON_WIDTH, 3); - _vm->_gfx->flatBlitCnv(v48, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); + _vm->_gfx->displayWrappedString(q->_answers[0], _answerBalloonX[0], _answerBalloonY[0], MAX_BALLOON_WIDTH, 3); + _vm->_gfx->flatBlitCnv(face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); _vm->_gfx->displayBalloonString(_answerBalloonX[0] + 5, _answerBalloonY[0] + _answerBalloonH[0] - 15, "> ", 0); Common::Event e; @@ -350,19 +350,19 @@ void displayQuestion(Dialogue *q, StaticCnv *face) { return; } -uint16 getDialogueAnswer(Dialogue *v60, StaticCnv *v48) { +uint16 getDialogueAnswer(Dialogue *q, StaticCnv *face) { uint16 answer = 0; - debugC(1, kDebugDialogue, "runDialogue: showing answering face (%p)", (const void*)v48->_data0); - _vm->_gfx->flatBlitCnv(v48, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); + debugC(1, kDebugDialogue, "runDialogue: showing answering face (%p)", (const void*)face->_data0); + _vm->_gfx->flatBlitCnv(face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); debugC(1, kDebugDialogue, "runDialogue: answering face shown"); if (_askPassword == false) { debugC(1, kDebugDialogue, "runDialogue: waiting for user to select answer"); - answer = selectAnswer(v60, v48); + answer = selectAnswer(q, face); } else { - answer = askDialoguePassword(v60, v48); + answer = askDialoguePassword(q, face); } _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); // erase answer screen @@ -380,68 +380,69 @@ void runDialogue(SpeakData *data) { _vm->_gfx->setFont("comic"); - Cnv v6E; + Cnv* v6E; if (!scumm_stricmp(data->_name, "yourself") || data->_name[0] == '\0') { - memcpy(&v6E, &_vm->_char._talk, sizeof(Cnv)); + v6E = _vm->_char._talk; debugC(1, kDebugDialogue, "runDialogue: using default character head"); } else { debugC(1, kDebugDialogue, "runDialogue: loading 2nd character head '%s'", _vm->_characterName); - _vm->_disk->loadTalk(data->_name, &v6E); + v6E = _vm->_disk->loadTalk(data->_name); debugC(1, kDebugDialogue, "runDialogue: 2nd character head loaded"); } StaticCnv questioner; - questioner._width = v6E._width; - questioner._height = v6E._height; + questioner._width = v6E->_width; + questioner._height = v6E->_height; StaticCnv answerer; - answerer._width = _vm->_char._talk._width; - answerer._height = _vm->_char._talk._height; + answerer._width = _vm->_char._talk->_width; + answerer._height = _vm->_char._talk->_height; bool displayedAnswers = false; _askPassword = false; uint16 answer = 0; Command *v34 = NULL; - Dialogue *v60 = data->_dialogue; - while (v60) { + Dialogue *q = data->_dialogue; + while (q) { - questioner._data0 = v6E._array[v60->_mood & 0xF]; + questioner._data0 = v6E->_array[q->_mood & 0xF]; questioner._data1 = NULL; // v6E.field_8[v60->_mood & 0xF]; - answerer._data0 = _vm->_char._talk._array[0]; + answerer._data0 = _vm->_char._talk->_array[0]; answerer._data1 = NULL; // _talk.field_8[0]; - displayQuestion(v60, &questioner); + displayQuestion(q, &questioner); - if (v60->_answers[0] == NULL) break; + if (q->_answers[0] == NULL) break; _answerBalloonY[0] = 10; displayedAnswers = false; - if (scumm_stricmp(v60->_answers[0], "NULL")) { + if (scumm_stricmp(q->_answers[0], "NULL")) { - displayedAnswers = displayAnswers(v60); + displayedAnswers = displayAnswers(q); if (displayedAnswers == true) { - answer = getDialogueAnswer(v60, &answerer); - v34 = v60->_commands[answer]; - v60 = (Dialogue*)v60->_following._questions[answer]; + answer = getDialogueAnswer(q, &answerer); + v34 = q->_commands[answer]; + q = (Dialogue*)q->_following._questions[answer]; } else { debugC(1, kDebugDialogue, "runDialogue: no suitable answers found"); - v60 = NULL; + q = NULL; } } else { - v60 = (Dialogue*)v60->_following._questions[answer]; + q = (Dialogue*)q->_following._questions[answer]; } } debugC(1, kDebugDialogue, "runDialogue: out of dialogue loop"); _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); - if (scumm_stricmp(data->_name, "yourself") || data->_name[0] == '\0') - _vm->_gfx->freeCnv(&v6E); - + if (scumm_stricmp(data->_name, "yourself") || data->_name[0] == '\0') { + _vm->_gfx->freeCnv(v6E); + delete v6E; + } exitDialogue(); debugC(1, kDebugDialogue, "runDialogue: exit dialogue ok"); @@ -472,8 +473,8 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) { if (numAvailableAnswers == 1) { _vm->_gfx->displayWrappedString(q->_answers[_di], _answerBalloonX[_di], _answerBalloonY[_di], MAX_BALLOON_WIDTH, 0); - cnv->_data0 = _vm->_char._talk._array[q->_answer_moods[_di] & 0xF]; -// cnv->_data1 = _vm->_char._talk.field_8[q->_answer_moods[_di] & 0xF]; + cnv->_data0 = _vm->_char._talk->_array[q->_answer_moods[_di] & 0xF]; +// cnv->_data1 = _vm->_char._talk->field_8[q->_answer_moods[_di] & 0xF]; _vm->_gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); waitUntilLeftClick(); return _di; @@ -492,8 +493,8 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) { _vm->_gfx->displayWrappedString(q->_answers[v2], _answerBalloonX[v2], _answerBalloonY[v2], MAX_BALLOON_WIDTH, 3); _vm->_gfx->displayWrappedString(q->_answers[_si], _answerBalloonX[_si], _answerBalloonY[_si], MAX_BALLOON_WIDTH, 0); - cnv->_data0 = _vm->_char._talk._array[q->_answer_moods[_si] & 0xF]; -// cnv->_data1 = _vm->_char._talk.field_8[q->_answer_moods[_si] & 0xF]; + cnv->_data0 = _vm->_char._talk->_array[q->_answer_moods[_si] & 0xF]; +// cnv->_data1 = _vm->_char._talk->field_8[q->_answer_moods[_si] & 0xF]; _vm->_gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); } diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index 49d80215cc..cbda89f8bf 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -197,7 +197,9 @@ void Disk::loadCnv(const char *filename, Cnv *cnv) { return; } -void Disk::loadTalk(const char *name, Cnv *cnv) { +Cnv* Disk::loadTalk(const char *name) { + + Cnv *cnv = new Cnv; const char *ext = strstr(name, ".talk"); if (ext != NULL) { @@ -228,6 +230,7 @@ void Disk::loadTalk(const char *name, Cnv *cnv) { } + return cnv; } Script* Disk::loadLocation(const char *name) { diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index d5bac325a1..a4c8aa6125 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -105,7 +105,7 @@ public: Script* loadLocation(const char *name); Script* loadScript(const char* name); - void loadTalk(const char *name, Cnv *cnv); + Cnv* loadTalk(const char *name); void loadObjects(const char *name, Cnv *cnv); void loadPointer(StaticCnv* cnv); void loadHead(const char* name, StaticCnv* cnv); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 35c7ba0bc3..80da5e730c 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -725,7 +725,9 @@ void freeCharacter() { if (!IS_DUMMY_CHARACTER(_vm->_characterName)) { _vm->_gfx->freeCnv(&_vm->_char._miniFrames); _vm->freeTable(_objectsNames); - _vm->_gfx->freeCnv(&_vm->_char._talk); + _vm->_gfx->freeCnv(_vm->_char._talk); + if (_vm->_char._talk) delete _vm->_char._talk; + _vm->_gfx->freeStaticCnv(&_vm->_char._head); _vm->_gfx->freeCnv(&_vm->_char._objs); } @@ -805,7 +807,7 @@ void Parallaction::changeCharacter(const char *name) { if (!IS_DUMMY_CHARACTER(name)) { _disk->loadHead(path, &_vm->_char._head); - _disk->loadTalk(path, &_vm->_char._talk); + _vm->_char._talk = _disk->loadTalk(path); _disk->loadObjects(name, &_vm->_char._objs); sprintf(path, "mini%s", v32); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 1818b2cbe6..53838d7323 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -237,16 +237,17 @@ struct Location { struct Character { Animation _ani; StaticCnv _head; - Cnv _talk; + Cnv *_talk; Cnv _normalFrames; Cnv _miniFrames; Cnv _objs; Character() { - _talk._width = 0; - _talk._height = 0; - _talk._count = 0; - _talk._array = NULL; + _talk = NULL; +// ._width = 0; +// _talk._height = 0; +// _talk._count = 0; +// _talk._array = NULL; _head._width = 0; _head._height = 0; diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index 00e94140fd..44d0f9d2a3 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -366,10 +366,10 @@ void displayCharacterComment(ExamineData *data) { if (data->_description == NULL) return; StaticCnv v3C; - v3C._width = _vm->_char._talk._width; - v3C._height = _vm->_char._talk._height; - v3C._data0 = _vm->_char._talk._array[0]; - v3C._data1 = NULL; //_talk.field_8[0]; + v3C._width = _vm->_char._talk->_width; + v3C._height = _vm->_char._talk->_height; + v3C._data0 = _vm->_char._talk->_array[0]; + v3C._data1 = NULL; //_talk->field_8[0]; _vm->_gfx->setFont("comic"); _vm->_gfx->flatBlitCnv(&v3C, 190, 80, Gfx::kBitFront); |