diff options
author | Filippos Karapetis | 2008-09-09 11:20:34 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-09-09 11:20:34 +0000 |
commit | dc304dbde22772eb52644e05f58407f2fa60b6e5 (patch) | |
tree | 3c52366c31a5a61f7cb0b7871507ebcb43111d05 /engines | |
parent | 726e7e7ef9b82850b2d8923a029a4c4e40f0eed0 (diff) | |
download | scummvm-rg350-dc304dbde22772eb52644e05f58407f2fa60b6e5.tar.gz scummvm-rg350-dc304dbde22772eb52644e05f58407f2fa60b6e5.tar.bz2 scummvm-rg350-dc304dbde22772eb52644e05f58407f2fa60b6e5.zip |
Cleanup. Simplified converse()
svn-id: r34460
Diffstat (limited to 'engines')
-rw-r--r-- | engines/drascula/animation.cpp | 40 | ||||
-rw-r--r-- | engines/drascula/converse.cpp | 209 | ||||
-rw-r--r-- | engines/drascula/drascula.h | 19 | ||||
-rw-r--r-- | engines/drascula/graphics.cpp | 4 | ||||
-rw-r--r-- | engines/drascula/palette.cpp | 22 |
5 files changed, 108 insertions, 186 deletions
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 954181d327..720506add1 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -1010,10 +1010,6 @@ void DrasculaEngine::animation_17_2() { flags[40] = 1; } -void DrasculaEngine::animation_19_2() { - talk_vonBraun(5, kVonBraunDoor); -} - void DrasculaEngine::animation_20_2() { talk_vonBraun(7, kVonBraunDoor); talk_vonBraun(8, kVonBraunDoor); @@ -1044,10 +1040,6 @@ void DrasculaEngine::animation_20_2() { } } -void DrasculaEngine::animation_21_2() { - talk_vonBraun(6, kVonBraunDoor); -} - void DrasculaEngine::animation_23_2() { loadPic("an24.alg", frontSurface); @@ -1514,10 +1506,6 @@ void DrasculaEngine::animation_1_5() { converse(8); } -void DrasculaEngine::animation_2_5() { - talk_bj(22); -} - void DrasculaEngine::animation_3_5() { talk_bj(23); pickObject(10); @@ -1837,14 +1825,6 @@ void DrasculaEngine::animation_15_5() { talk_mus(7); } -void DrasculaEngine::animation_16_5() { - talk_mus(8); -} - -void DrasculaEngine::animation_17_5() { - talk_mus(9); -} - void DrasculaEngine::animation_1_6() { trackProtagonist = 0; curX = 103; @@ -1919,18 +1899,6 @@ void DrasculaEngine::animation_1_6() { activatePendulum(); } -void DrasculaEngine::animation_2_6() { - talk_drascula(24, 1); -} - -void DrasculaEngine::animation_3_6() { - talk_drascula(24, 1); -} - -void DrasculaEngine::animation_4_6() { - talk_drascula(25, 1); -} - void DrasculaEngine::animation_5_6() { int pos_pen[6] = { 1, 29, 204, -125, 18, 125 }; @@ -2080,10 +2048,6 @@ void DrasculaEngine::animation_12_6() { talk_bartender(14, 1); } -void DrasculaEngine::animation_13_6() { - talk_bartender(15, 1); -} - void DrasculaEngine::animation_14_6() { talk_bartender(24, 1); addObject(21); @@ -2091,10 +2055,6 @@ void DrasculaEngine::animation_14_6() { breakOut = 1; } -void DrasculaEngine::animation_15_6() { - talk_bartender(16, 1); -} - void DrasculaEngine::animation_18_6() { flags[6] = 1; withoutVerb(); diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index 1c3831e4ca..da24ffd55a 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -27,38 +27,32 @@ namespace Drascula { +void DrasculaEngine::cleanupString(char *string) { + uint len = strlen(string); + for (uint h = 0; h < len; h++) + if (string[h] == (char)0xa7) + string[h] = ' '; +} + void DrasculaEngine::converse(int index) { char fileName[20]; sprintf(fileName, "op_%d.cal", index); - uint h; - int game1 = 1, game2 = 1, game3 = 1, game4 = 1; - char phrase1[78]; - char phrase2[78]; - char phrase3[87]; - char phrase4[78]; - char sound1[13]; - char sound2[13]; - char sound3[13]; - char sound4[13]; - int answer1; - int answer2; - int answer3; - int used1 = 0; - int used2 = 0; - int used3 = 0; + _arj.open(fileName); + if (!_arj.isOpen()) + error("missing data file %s", fileName); + + int size = _arj.size(); + int game1 = kDialogOptionUnselected, + game2 = kDialogOptionUnselected, + game3 = kDialogOptionUnselected; + char phrase1[78], phrase2[78], phrase3[78], phrase4[78]; + char sound1[13], sound2[13], sound3[13], sound4[13]; + int answer1, answer2, answer3; char buffer[256]; - uint len; breakOut = 0; - if (currentChapter == 5) - withoutVerb(); - - _arj.open(fileName); - if (!_arj.isOpen()) { - error("missing data file %s", fileName); - } - int size = _arj.size(); + withoutVerb(); getStringFromLine(buffer, size, phrase1); getStringFromLine(buffer, size, phrase2); @@ -92,129 +86,96 @@ void DrasculaEngine::converse(int index) { answer3 = 15; } - len = strlen(phrase1); - for (h = 0; h < len; h++) - if (phrase1[h] == (char)0xa7) - phrase1[h] = ' '; - - len = strlen(phrase2); - for (h = 0; h < len; h++) - if (phrase2[h] == (char)0xa7) - phrase2[h] = ' '; - - len = strlen(phrase3); - for (h = 0; h < len; h++) - if (phrase3[h] == (char)0xa7) - phrase3[h] = ' '; - - len = strlen(phrase4); - for (h = 0; h < len; h++) - if (phrase4[h] == (char)0xa7) - phrase4[h] = ' '; + cleanupString(phrase1); + cleanupString(phrase2); + cleanupString(phrase3); + cleanupString(phrase4); loadPic("car.alg", backSurface); // TODO code here should limit y position for mouse in dialog menu, - // but we can't implement this due lack backend functionality + // but we can't implement this as there is lack in backend functionality // from 1(top) to 31 color_abc(kColorLightGreen); while (breakOut == 0) { updateRoom(); - if (currentChapter == 1 || currentChapter == 4 || currentChapter == 6) { - if (musicStatus() == 0 && flags[11] == 0) - playMusic(roomMusic); - } else if (currentChapter == 2) { - if (musicStatus() == 0 && flags[11] == 0 && roomMusic != 0) - playMusic(roomMusic); - } else if (currentChapter == 3 || currentChapter == 5) { - if (musicStatus() == 0) + if (musicStatus() == 0 && roomMusic != 0) { + if (currentChapter == 3 || currentChapter == 5) { playMusic(roomMusic); + } else { // chapters 1, 2, 4, 6 + if (flags[11] == 0) + playMusic(roomMusic); + } } updateEvents(); + print_abc_opc(phrase1, 2, game1); + print_abc_opc(phrase2, 10, game2); + print_abc_opc(phrase3, 18, game3); + print_abc_opc(phrase4, 26, kDialogOptionUnselected); + if (mouseY > 0 && mouseY < 9) { - if (used1 == 1 && _color != kColorWhite) + if (game1 == kDialogOptionClicked && _color != kColorWhite) color_abc(kColorWhite); - else if (used1 == 0 && _color != kColorLightGreen) + else if (game1 != kDialogOptionClicked && _color != kColorLightGreen) color_abc(kColorLightGreen); + + print_abc_opc(phrase1, 2, kDialogOptionSelected); + + if (leftMouseButton == 1) { + delay(100); + game1 = kDialogOptionClicked; + talk(phrase1, sound1); + response(answer1); + } } else if (mouseY > 8 && mouseY < 17) { - if (used2 == 1 && _color != kColorWhite) + if (game2 == kDialogOptionClicked && _color != kColorWhite) color_abc(kColorWhite); - else if (used2 == 0 && _color != kColorLightGreen) + else if (game2 != kDialogOptionClicked && _color != kColorLightGreen) color_abc(kColorLightGreen); + + print_abc_opc(phrase2, 10, kDialogOptionSelected); + + if (leftMouseButton == 1) { + delay(100); + game2 = kDialogOptionClicked; + talk(phrase2, sound2); + response(answer2); + } } else if (mouseY > 16 && mouseY < 25) { - if (used3 == 1 && _color != kColorWhite) + if (game3 == kDialogOptionClicked && _color != kColorWhite) color_abc(kColorWhite); - else if (used3 == 0 && _color != kColorLightGreen) + else if (game3 != kDialogOptionClicked && _color != kColorLightGreen) color_abc(kColorLightGreen); - } else if (_color != kColorLightGreen) - color_abc(kColorLightGreen); - - if (mouseY > 0 && mouseY < 9) - game1 = 2; - else if (mouseY > 8 && mouseY < 17) - game2 = 2; - else if (mouseY > 16 && mouseY < 25) - game3 = 2; - else if (mouseY > 24 && mouseY < 33) - game4 = 2; - print_abc_opc(phrase1, 1, 2, game1); - print_abc_opc(phrase2, 1, 10, game2); - print_abc_opc(phrase3, 1, 18, game3); - print_abc_opc(phrase4, 1, 26, game4); + print_abc_opc(phrase3, 18, kDialogOptionSelected); - updateScreen(); - - if ((leftMouseButton == 1) && (game1 == 2)) { - delay(100); - used1 = 1; - talk(phrase1, sound1); - if (currentChapter == 3) - grr(); - else - response(answer1); - } else if ((leftMouseButton == 1) && (game2 == 2)) { - delay(100); - used2 = 1; - talk(phrase2, sound2); - if (currentChapter == 3) - grr(); - else - response(answer2); - } else if ((leftMouseButton == 1) && (game3 == 2)) { - delay(100); - used3 = 1; - talk(phrase3, sound3); - if (currentChapter == 3) - grr(); - else + if (leftMouseButton == 1) { + delay(100); + game3 = kDialogOptionClicked; + talk(phrase3, sound3); response(answer3); - } else if ((leftMouseButton == 1) && (game4 == 2)) { - delay(100); - talk(phrase4, sound4); - breakOut = 1; - } + } + } else if (mouseY > 24 && mouseY < 33) { + print_abc_opc(phrase4, 26, kDialogOptionSelected); - if (leftMouseButton == 1) { - delay(100); + if (leftMouseButton == 1) { + delay(100); + talk(phrase4, sound4); + breakOut = 1; + } + } else if (_color != kColorLightGreen) color_abc(kColorLightGreen); - } - game1 = (used1 == 0) ? 1 : 3; - game2 = (used2 == 0) ? 1 : 3; - game3 = (used3 == 0) ? 1 : 3; - game4 = 1; + updateScreen(); } // while (breakOut == 0) if (currentChapter == 2) loadPic(menuBackground, backSurface); else loadPic(99, backSurface); - if (currentChapter != 5) - withoutVerb(); } void DrasculaEngine::response(int function) { @@ -235,11 +196,11 @@ void DrasculaEngine::response(int function) { else if (function == 17) animation_17_2(); else if (function == 19) - animation_19_2(); + talk_vonBraun(5, kVonBraunDoor); else if (function == 20) animation_20_2(); else if (function == 21) - animation_21_2(); + talk_vonBraun(6, kVonBraunDoor); else if (function == 23) animation_23_2(); else if (function == 28) @@ -250,6 +211,8 @@ void DrasculaEngine::response(int function) { animation_30_2(); else if (function == 31) animation_31_2(); + } else if (currentChapter == 3) { + grr(); } else if (currentChapter == 4) { if (function == 2) animation_2_4(); @@ -259,7 +222,7 @@ void DrasculaEngine::response(int function) { animation_4_4(); } else if (currentChapter == 5) { if (function == 2) - animation_2_5(); + talk_bj(22); else if (function == 3) animation_3_5(); else if (function == 6) @@ -271,26 +234,26 @@ void DrasculaEngine::response(int function) { else if (function == 15) animation_15_5(); else if (function == 16) - animation_16_5(); + talk_mus(8); else if (function == 17) - animation_17_5(); + talk_mus(9); } else if (currentChapter == 6) { if (function == 2) - animation_2_6(); + talk_drascula(24, 1); else if (function == 3) - animation_3_6(); + talk_drascula(24, 1); else if (function == 4) - animation_4_6(); + talk_drascula(25, 1); else if (function == 11) animation_11_6(); else if (function == 12) animation_12_6(); else if (function == 13) - animation_13_6(); + talk_bartender(15, 1); else if (function == 14) animation_14_6(); else if (function == 15) - animation_15_6(); + talk_bartender(16, 1); } } diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 2eb7a19559..417674e8c3 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -151,6 +151,12 @@ enum AnimFrameTypes { kFramePendulum = 7 }; +enum DialogOptionStatus { + kDialogOptionUnselected = 1, + kDialogOptionSelected = 2, + kDialogOptionClicked = 3 +}; + #define TEXTD_START 68 struct DrasculaGameDescription; @@ -499,8 +505,9 @@ public: bool checkMenuFlags(); void setupRoomsTable(); bool roomParse(int, int); + void cleanupString(char *string); void converse(int); - void print_abc_opc(const char *, int, int, int); + void print_abc_opc(const char *, int, int); void response(int); void activatePendulum(); @@ -578,9 +585,7 @@ public: void animation_16_2(); void animation_17_2(); void animation_18_2(); - void animation_19_2(); void animation_20_2(); - void animation_21_2(); void animation_22_2(); void animation_23_2(); void animation_23_joined(); @@ -618,7 +623,6 @@ public: void animation_9_4(); // void animation_1_5(); - void animation_2_5(); void animation_3_5(); void animation_4_5(); void animation_5_5(); @@ -632,13 +636,8 @@ public: void animation_13_5(); void animation_14_5(); void animation_15_5(); - void animation_16_5(); - void animation_17_5(); // void animation_1_6(); - void animation_2_6(); - void animation_3_6(); - void animation_4_6(); void animation_5_6(); void animation_6_6(); void animation_7_6(); @@ -646,9 +645,7 @@ public: void animation_10_6(); void animation_11_6(); void animation_12_6(); - void animation_13_6(); void animation_14_6(); - void animation_15_6(); void animation_18_6(); void animation_19_6(); diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index cde9dcca4d..6fc7e54bc4 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -254,10 +254,12 @@ void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) { } // for } -void DrasculaEngine::print_abc_opc(const char *said, int screenX, int screenY, int game) { +void DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) { int signY, letterY, letterX = 0; uint len = strlen(said); + int screenX = 1; + for (uint h = 0; h < len; h++) { if (game == 1) { letterY = 6; diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp index 6a93f21e55..3dd2a779e8 100644 --- a/engines/drascula/palette.cpp +++ b/engines/drascula/palette.cpp @@ -27,6 +27,17 @@ namespace Drascula { +const char colorTable[][3] = { + { 0, 0, 0 }, { 0x10, 0x3E, 0x28 }, + { 0, 0, 0 }, // unused + { 0x16, 0x3F, 0x16 }, { 0x09, 0x3F, 0x12 }, + { 0x3F, 0x3F, 0x15 }, + { 0, 0, 0 }, // unused + { 0x38, 0, 0 }, { 0x3F, 0x27, 0x0B }, + { 0x2A, 0, 0x2A }, { 0x30, 0x30, 0x30 }, + { 98, 91, 100 } +}; + void DrasculaEngine::setRGB(byte *pal, int colorCount) { int x, cnt = 0; @@ -70,17 +81,6 @@ void DrasculaEngine::setPalette(byte *PalBuf) { void DrasculaEngine::color_abc(int cl) { _color = cl; - char colorTable[][3] = { - { 0, 0, 0 }, { 0x10, 0x3E, 0x28 }, - { 0, 0, 0 }, // unused - { 0x16, 0x3F, 0x16 }, { 0x09, 0x3F, 0x12 }, - { 0x3F, 0x3F, 0x15 }, - { 0, 0, 0 }, // unused - { 0x38, 0, 0 }, { 0x3F, 0x27, 0x0B }, - { 0x2A, 0, 0x2A }, { 0x30, 0x30, 0x30 }, - { 98, 91, 100 } - }; - for (int i = 0; i <= 2; i++) gamePalette[254][i] = colorTable[cl][i]; |