aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula/converse.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2008-09-09 11:20:34 +0000
committerFilippos Karapetis2008-09-09 11:20:34 +0000
commitdc304dbde22772eb52644e05f58407f2fa60b6e5 (patch)
tree3c52366c31a5a61f7cb0b7871507ebcb43111d05 /engines/drascula/converse.cpp
parent726e7e7ef9b82850b2d8923a029a4c4e40f0eed0 (diff)
downloadscummvm-rg350-dc304dbde22772eb52644e05f58407f2fa60b6e5.tar.gz
scummvm-rg350-dc304dbde22772eb52644e05f58407f2fa60b6e5.tar.bz2
scummvm-rg350-dc304dbde22772eb52644e05f58407f2fa60b6e5.zip
Cleanup. Simplified converse()
svn-id: r34460
Diffstat (limited to 'engines/drascula/converse.cpp')
-rw-r--r--engines/drascula/converse.cpp209
1 files changed, 86 insertions, 123 deletions
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);
}
}