aboutsummaryrefslogtreecommitdiff
path: root/engines/drascula
diff options
context:
space:
mode:
Diffstat (limited to 'engines/drascula')
-rw-r--r--engines/drascula/actors.cpp87
-rw-r--r--engines/drascula/animation.cpp800
-rw-r--r--engines/drascula/converse.cpp359
-rw-r--r--engines/drascula/detection.cpp32
-rw-r--r--engines/drascula/drascula.cpp196
-rw-r--r--engines/drascula/drascula.h195
-rw-r--r--engines/drascula/graphics.cpp201
-rw-r--r--engines/drascula/interface.cpp88
-rw-r--r--engines/drascula/objects.cpp30
-rw-r--r--engines/drascula/palette.cpp69
-rw-r--r--engines/drascula/rooms.cpp563
-rw-r--r--engines/drascula/saveload.cpp25
-rw-r--r--engines/drascula/sound.cpp59
-rw-r--r--engines/drascula/talk.cpp314
14 files changed, 1258 insertions, 1760 deletions
diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp
index 10ce415c2c..ff46d8201a 100644
--- a/engines/drascula/actors.cpp
+++ b/engines/drascula/actors.cpp
@@ -28,45 +28,45 @@
namespace Drascula {
void DrasculaEngine::placeIgor() {
- int pos_igor[6] = { 1, 0, igorX, igorY, 54, 61 };
+ int igY = 0;
if (currentChapter == 4) {
- pos_igor[1] = 138;
+ igY = 138;
} else {
if (trackIgor == 3)
- pos_igor[1] = 138;
+ igY = 138;
else if (trackIgor == 1)
- pos_igor[1] = 76;
+ igY = 76;
}
- copyRectClip(pos_igor, frontSurface, screenSurface);
+ copyRect(1, igY, igorX, igorY, 54, 61, frontSurface, screenSurface);
}
void DrasculaEngine::placeDrascula() {
- int pos_dr[6] = { 0, 122, drasculaX, drasculaY, 45, 77 };
+ int drX = 0;
if (trackDrascula == 1)
- pos_dr[0] = 47;
+ drX = 47;
else if (trackDrascula == 0)
- pos_dr[0] = 1;
+ drX = 1;
else if (trackDrascula == 3 && currentChapter == 1)
- pos_dr[0] = 93;
+ drX = 93;
if (currentChapter == 6)
- copyRectClip(pos_dr, drawSurface2, screenSurface);
+ copyRect(drX, 122, drasculaX, drasculaY, 45, 77, drawSurface2, screenSurface);
else
- copyRectClip(pos_dr, backSurface, screenSurface);
+ copyRect(drX, 122, drasculaX, drasculaY, 45, 77, backSurface, screenSurface);
}
void DrasculaEngine::placeBJ() {
- int pos_bj[6] = { 0, 99, bjX, bjY, 26, 76 };
+ int bX = 0;
if (trackBJ == 3)
- pos_bj[0] = 10;
+ bX = 10;
else if (trackBJ == 0)
- pos_bj[0] = 37;
+ bX = 37;
- copyRectClip(pos_bj, drawSurface3, screenSurface);
+ copyRect(bX, 99, bjX, bjY, 26, 76, drawSurface3, screenSurface);
}
void DrasculaEngine::hiccup(int counter) {
@@ -189,7 +189,7 @@ void DrasculaEngine::moveCharacters() {
}
}
- if (currentChapter == 1 || currentChapter == 4 || currentChapter == 5 || currentChapter == 6) {
+ if (currentChapter != 2 && currentChapter != 3) {
if (hare_se_ve == 0) {
increaseFrameNum();
return;
@@ -212,25 +212,29 @@ void DrasculaEngine::moveCharacters() {
if (trackProtagonist == 0) {
curPos[1] = 0;
if (currentChapter == 2)
- copyRectClip(curPos, extraSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ extraSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], extraSurface, screenSurface);
} else if (trackProtagonist == 1) {
if (currentChapter == 2)
- copyRectClip(curPos, extraSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ extraSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], extraSurface, screenSurface);
} else if (trackProtagonist == 2) {
if (currentChapter == 2)
- copyRectClip(curPos, backSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ backSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], backSurface, screenSurface);
} else {
if (currentChapter == 2)
- copyRectClip(curPos, frontSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ frontSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], frontSurface, screenSurface);
@@ -250,25 +254,29 @@ void DrasculaEngine::moveCharacters() {
if (trackProtagonist == 0) {
curPos[1] = 0;
if (currentChapter == 2)
- copyRectClip(curPos, extraSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ extraSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], extraSurface, screenSurface);
} else if (trackProtagonist == 1) {
if (currentChapter == 2)
- copyRectClip(curPos, extraSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ extraSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], extraSurface, screenSurface);
} else if (trackProtagonist == 2) {
if (currentChapter == 2)
- copyRectClip(curPos, backSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ backSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], backSurface, screenSurface);
} else {
if (currentChapter == 2)
- copyRectClip(curPos, frontSurface, screenSurface);
+ copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+ frontSurface, screenSurface);
else
reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
factor_red[curY + curHeight], frontSurface, screenSurface);
@@ -288,11 +296,11 @@ void DrasculaEngine::quadrant_1() {
distanceY = (curY + curHeight) - roomY;
if (distanceX < distanceY) {
- curDirection = 0;
+ curDirection = kDirectionUp;
trackProtagonist = 2;
stepX = (int)(distanceX / (distanceY / STEP_Y));
} else {
- curDirection = 7;
+ curDirection = kDirectionUp;
trackProtagonist = 0;
stepY = (int)(distanceY / (distanceX / STEP_X));
}
@@ -309,11 +317,11 @@ void DrasculaEngine::quadrant_2() {
distanceY = (curY + curHeight) - roomY;
if (distanceX < distanceY) {
- curDirection = 1;
+ curDirection = kDirectionRight;
trackProtagonist = 2;
stepX = (int)(distanceX / (distanceY / STEP_Y));
} else {
- curDirection = 2;
+ curDirection = kDirectionRight;
trackProtagonist = 1;
stepY = (int)(distanceY / (distanceX / STEP_X));
}
@@ -330,11 +338,11 @@ void DrasculaEngine::quadrant_3() {
distanceY = roomY - (curY + curHeight);
if (distanceX < distanceY) {
- curDirection = 5;
+ curDirection = kDirectionLeft;
trackProtagonist = 3;
stepX = (int)(distanceX / (distanceY / STEP_Y));
} else {
- curDirection = 6;
+ curDirection = kDirectionLeft;
trackProtagonist = 0;
stepY = (int)(distanceY / (distanceX / STEP_X));
}
@@ -351,11 +359,11 @@ void DrasculaEngine::quadrant_4() {
distanceY = roomY - (curY + curHeight);
if (distanceX < distanceY) {
- curDirection = 4;
+ curDirection = kDirectionDown;
trackProtagonist = 3;
stepX = (int)(distanceX / (distanceY / STEP_Y));
} else {
- curDirection = 3;
+ curDirection = kDirectionDown;
trackProtagonist = 1;
stepY = (int)(distanceY / (distanceX / STEP_X));
}
@@ -370,16 +378,16 @@ void DrasculaEngine::increaseFrameNum() {
if (num_frame == 6)
num_frame = 0;
- if (curDirection == 0 || curDirection == 7) {
+ if (curDirection == kDirectionUp) {
curX -= stepX;
curY -= stepY;
- } else if (curDirection == 1 || curDirection == 2) {
+ } else if (curDirection == kDirectionRight) {
curX += stepX;
curY -= stepY;
- } else if (curDirection == 3 || curDirection == 4) {
+ } else if (curDirection == kDirectionDown) {
curX += stepX;
curY += stepY;
- } else if (curDirection == 5 || curDirection == 6) {
+ } else if (curDirection == kDirectionLeft) {
curX -= stepX;
curY += stepY;
}
@@ -394,13 +402,13 @@ void DrasculaEngine::increaseFrameNum() {
}
void DrasculaEngine::walkDown() {
- curDirection = 4;
+ curDirection = kDirectionDown;
trackProtagonist = 3;
stepX = 0;
}
void DrasculaEngine::walkUp() {
- curDirection = 0;
+ curDirection = kDirectionUp;
trackProtagonist = 2;
stepX = 0;
}
@@ -432,7 +440,8 @@ void DrasculaEngine::moveVonBraun() {
actorFrames[kFrameVonBraun] = 1;
}
- copyRectClip(pos_vb, frontSurface, screenSurface);
+ copyRect(pos_vb[0], pos_vb[1], pos_vb[2], pos_vb[3], pos_vb[4], pos_vb[5],
+ frontSurface, screenSurface);
}
void DrasculaEngine::placeVonBraun(int pointX) {
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index 06868494b5..ad7fe64d0e 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -55,7 +55,7 @@ void DrasculaEngine::updateAnim2(int y, int px, int py, int width, int height, i
// This is the game's introduction sequence
void DrasculaEngine::animation_1_1() {
int l, l2, p;
- int pixelPos[6];
+ //int pixelPos[6];
while (term_int == 0) {
playMusic(29);
@@ -87,7 +87,7 @@ void DrasculaEngine::animation_1_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
color_abc(kColorRed);
- centerText(_textmisc[_lang][1], 160, 100);
+ centerText(_textmisc[1], 160, 100);
updateScreen();
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
@@ -134,7 +134,7 @@ void DrasculaEngine::animation_1_1() {
for (l2 = 0; l2 < 3; l2++)
for (l = 0; l < 7; l++) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
copyBackground(interf_x[l], interf_y[l], 156, 45, 63, 31, drawSurface2, screenSurface);
updateScreen();
if (getScan() == Common::KEYCODE_ESCAPE) {
@@ -147,19 +147,13 @@ void DrasculaEngine::animation_1_1() {
break;
l2 = 0; p = 0;
- pixelPos[3] = 45;
- pixelPos[4] = 63;
- pixelPos[5] = 31;
for (l = 0; l < 180; l++) {
copyBackground(0, 0, 320 - l, 0, l, 200, drawSurface3, screenSurface);
copyBackground(l, 0, 0, 0, 320 - l, 200, bgSurface, screenSurface);
- pixelPos[0] = interf_x[l2];
- pixelPos[1] = interf_y[l2];
- pixelPos[2] = 156 - l;
-
- copyRectClip(pixelPos, drawSurface2, screenSurface);
+ copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31,
+ drawSurface2, screenSurface);
updateScreen();
p++;
if (p == 6) {
@@ -177,7 +171,7 @@ void DrasculaEngine::animation_1_1() {
break;
copyBackground(0, 0, 0, 0, 320, 200, screenSurface, bgSurface);
- talk_dr_grande(1);
+ talk_drascula_big(1);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
@@ -193,14 +187,14 @@ void DrasculaEngine::animation_1_1() {
igorX = 66;
igorY = 97;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
talk_igor(8, kIgorDch);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
@@ -219,12 +213,12 @@ void DrasculaEngine::animation_1_1() {
loadPic("plan1.alg", screenSurface, HALF_PAL);
updateScreen();
pause(10);
- talk_solo(_textd[_lang][4],"d4.als");
+ talk_solo(_textd[4],"d4.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
loadPic("plan1.alg", screenSurface, HALF_PAL);
updateScreen();
- talk_solo(_textd[_lang][5], "d5.als");
+ talk_solo(_textd[5], "d5.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
if (animate("lib2.bin", 16))
@@ -233,7 +227,7 @@ void DrasculaEngine::animation_1_1() {
loadPic("plan2.alg", screenSurface, HALF_PAL);
updateScreen();
pause(20);
- talk_solo(_textd[_lang][6], "d6.als");
+ talk_solo(_textd[6], "d6.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
if (animate("lib2.bin", 16))
@@ -244,12 +238,12 @@ void DrasculaEngine::animation_1_1() {
pause(20);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
- talk_solo(_textd[_lang][7], "d7.als");
+ talk_solo(_textd[7], "d7.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
loadPic("plan3.alg", screenSurface, HALF_PAL);
updateScreen();
- talk_solo(_textd[_lang][8], "d8.als");
+ talk_solo(_textd[8], "d8.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
clearRoom();
@@ -297,13 +291,13 @@ void DrasculaEngine::animation_1_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
trackDrascula = 3;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
pause(1);
trackDrascula = 0;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
@@ -311,13 +305,13 @@ void DrasculaEngine::animation_1_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
trackDrascula = 3;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
pause(1);
trackDrascula = 1;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
@@ -329,13 +323,13 @@ void DrasculaEngine::animation_1_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
trackDrascula = 3;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
pause(1);
trackDrascula = 0;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
updateScreen();
@@ -402,9 +396,6 @@ void DrasculaEngine::animation_2_1() {
if (animate("ag.bin", 14))
break;
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
loadPic("an11y13.alg", extraSurface);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
@@ -413,9 +404,6 @@ void DrasculaEngine::animation_2_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
- if (_lang == kSpanish)
- textSurface = extraSurface;
-
loadPic(97, extraSurface);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
@@ -436,7 +424,7 @@ void DrasculaEngine::animation_2_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
- talk_solo(_textbj[_lang][1], "BJ1.als");
+ talk_solo(_textbj[1], "BJ1.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
clearRoom();
@@ -449,7 +437,7 @@ void DrasculaEngine::animation_2_1() {
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
color_solo = kColorYellow;
- talk_solo(_text[_lang][214], "214.als");
+ talk_solo(_text[214], "214.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
clearRoom();
@@ -491,23 +479,8 @@ void DrasculaEngine::animation_2_1() {
curX = 100;
curY = 95;
- talk_bj(2);
- talk(215);
- talk_bj(3);
- talk(216);
- talk_bj(4);
- talk_bj(5);
- talk_bj(6);
- talk(217);
- talk_bj(7);
- talk(218);
- talk_bj(8);
- talk(219);
- talk_bj(9);
- talk(220);
- talk(221);
- talk_bj(10);
- talk(222);
+ playTalkSequence(2); // sequence 2, chapter 1
+
if (animate("gaf.bin", 15))
break;
if (animate("bjb.bin", 14))
@@ -523,7 +496,7 @@ void DrasculaEngine::animation_2_1() {
pause(120);
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
- talk_solo(_text[_lang][223], "223.als");
+ talk_solo(_text[223], "223.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
color_solo = kColorWhite;
@@ -532,7 +505,7 @@ void DrasculaEngine::animation_2_1() {
break;
updateScreen();
pause(110);
- talk_solo(_textbj[_lang][11], "BJ11.als");
+ talk_solo(_textbj[11], "BJ11.als");
if ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE))
break;
updateRoom();
@@ -596,45 +569,17 @@ void DrasculaEngine::animation_2_1() {
}
}
+// John Hacker talks with the bartender to book a room
void DrasculaEngine::animation_3_1() {
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
loadPic("an11y13.alg", extraSurface);
- talk(192);
- talk_bartender(1);
- talk(193);
- talk_bartender(2);
- talk(194);
- talk_bartender(3);
- talk(195);
- talk_bartender(4);
- talk(196);
- talk_bartender(5);
- talk_bartender(6);
- talk(197);
- talk_bartender(7);
- talk(198);
- talk_bartender(8);
- talk(199);
- talk_bartender(9);
- talk(200);
- talk(201);
- talk(202);
-
- flags[0] = 1;
-
- if (_lang == kSpanish)
- textSurface = extraSurface;
+ playTalkSequence(3); // sequence 3, chapter 1
loadPic(97, extraSurface);
}
+// John Hacker talks with the pianist
void DrasculaEngine::animation_4_1() {
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
loadPic("an12.alg", extraSurface);
talk(205);
@@ -666,28 +611,20 @@ void DrasculaEngine::animation_4_1() {
talk_pianist(4);
talk(209);
- if (_lang == kSpanish)
- textSurface = extraSurface;
-
flags[11] = 0;
loadPic(97, extraSurface);
}
-void DrasculaEngine::animation_1_2() {
- gotoObject(178, 121);
- gotoObject(169, 135);
-}
-
void DrasculaEngine::animation_2_2() {
trackProtagonist = 0;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
moveCharacters();
updateRefresh();
updateScreen();
loadPic("an2_1.alg", frontSurface);
loadPic("an2_2.alg", extraSurface);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
copyBackground(1, 1, 201, 87, 50, 52, frontSurface, screenSurface);
updateScreen();
@@ -701,7 +638,7 @@ void DrasculaEngine::animation_2_2() {
updateAnim(55, 201, 87, 50, 52, 6, extraSurface);
updateAnim(109, 201, 87, 50, 52, 2, extraSurface);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
finishSound();
@@ -713,18 +650,12 @@ void DrasculaEngine::animation_2_2() {
finishSound();
}
-void DrasculaEngine::animation_3_2() {
- gotoObject(163, 106);
- gotoObject(287, 101);
- trackProtagonist = 0;
-}
-
void DrasculaEngine::animation_4_2() {
stopMusic();
flags[9] = 1;
pause(12);
- talk(56);
+ talk(60);
pause(8);
clearRoom();
@@ -734,10 +665,7 @@ void DrasculaEngine::animation_4_2() {
loadPic("ciego4.alg", backSurface);
loadPic("ciego5.alg", frontSurface);
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
pause(10);
@@ -761,13 +689,13 @@ void DrasculaEngine::animation_4_2() {
talk_blind(7);
talk_hacker(63);
talk_blind(8);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
_system->delayMillis(1000);
talk_hacker(64);
talk_blind(9);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
pause(14);
@@ -780,54 +708,25 @@ void DrasculaEngine::animation_4_2() {
loadPic(96, frontSurface);
loadPic(97, extraSurface);
loadPic(99, backSurface);
- withoutVerb();
-
- if (_lang == kSpanish)
- textSurface = extraSurface;
+ selectVerb(0);
flags[9] = 0;
flags[4] = 1;
}
-void DrasculaEngine::animation_8_2() {
- talk_pianist(6);
- talk(358);
- talk_pianist(7);
- talk_pianist(8);
-}
-
-void DrasculaEngine::animation_9_2() {
- talk_pianist(9);
- talk_pianist(10);
- talk_pianist(11);
-}
-
-void DrasculaEngine::animation_10_2() {
- talk_pianist(12);
- talk(361);
- pause(40);
- talk_pianist(13);
- talk(362);
- talk_pianist(14);
- talk(363);
- talk_pianist(15);
- talk(364);
- talk_pianist(16);
-}
-
void DrasculaEngine::animation_14_2() {
- int cabinPos[6] = { 150, 6, 69, -160, 158, 161 };
+ int cY = -160;
int l = 0;
loadPic("an14_2.alg", backSurface);
for (int n = -160; n <= 0; n = n + 5 + l) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
moveCharacters();
moveVonBraun();
- cabinPos[3] = n;
- copyRectClip(cabinPos, backSurface, screenSurface);
+ cY = n;
+ copyRect(150, 6, 69, cY, 158, 161, backSurface, screenSurface);
updateRefresh();
updateScreen();
l++;
@@ -845,143 +744,64 @@ void DrasculaEngine::animation_14_2() {
loadPic(99, backSurface);
}
-void DrasculaEngine::animation_15_2() {
- talk_drunk(8);
- pause(7);
- talk_drunk(9);
- talk_drunk(10);
- talk_drunk(11);
-}
-
+// The drunk tells us about Von Braun
void DrasculaEngine::animation_16_2() {
+ char curPic[20];
talk_drunk(12);
talk(371);
clearRoom();
+ // FIXME: Track 31 is missing from the soundtrack available
+ // from ScummVM's downloads page, so for now we're using the
+ // Spanish track 29
+#if 1
+ playMusic(30);
+#else
if (_lang == kSpanish)
playMusic(30);
else
playMusic(32);
+#endif
- int key = getScan();
- if (key != 0)
- goto asco;
-
- if (_lang != kSpanish)
- color_abc(kColorDarkGreen);
-
- loadPic("his1.alg", bgSurface, HALF_PAL);
-
- if (_lang == kSpanish)
- black();
-
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
-
- if (_lang != kSpanish)
- centerText(_texthis[_lang][1], 180, 180);
-
- updateScreen();
-
- if (_lang == kSpanish)
- fadeFromBlack(1);
-
- key = getScan();
- if (key != 0)
+ if (getScan() != 0)
goto asco;
- if (_lang == kSpanish)
- _system->delayMillis(3000);
- else
- _system->delayMillis(4000);
-
- key = getScan();
- if (key != 0)
- goto asco;
-
- fadeToBlack(1);
- key = getScan();
- if (key != 0)
- goto asco;
+ color_abc(kColorDarkGreen);
- clearRoom();
- loadPic("his2.alg", bgSurface, HALF_PAL);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
-
- if (_lang != kSpanish)
- centerText(_texthis[_lang][2], 180, 180);
-
- updateScreen();
- key = getScan();
- if (key != 0)
- goto asco;
-
- if (_lang == kSpanish)
- _system->delayMillis(3000);
- else
- _system->delayMillis(4000);
-
- key = getScan();
- if (key != 0)
- goto asco;
-
- fadeToBlack(1);
- key = getScan();
- if (key != 0)
- goto asco;
+ for (int i = 1; i <= 4; i++) {
+ if (i < 4)
+ sprintf(curPic, "his%i.alg", i);
+ else
+ strcpy(curPic, "his4_2.alg");
- clearRoom();
- loadPic("his3.alg", bgSurface, HALF_PAL);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ loadPic(curPic, screenSurface, HALF_PAL);
+ centerText(_texthis[i], 180, 180);
+ updateScreen();
- if (_lang != kSpanish)
- centerText(_texthis[_lang][3], 180, 180);
+ if (getScan() != 0)
+ goto asco;
- updateScreen();
- key = getScan();
- if (key != 0)
- goto asco;
+ delay(3000);
- if (_lang == kSpanish)
- _system->delayMillis(3000);
- else
- _system->delayMillis(4000);
+ if (i < 4) {
+ fadeToBlack(1);
- key = getScan();
- if (key != 0)
- goto asco;
+ if (getScan() != 0)
+ goto asco;
- fadeToBlack(1);
+ clearRoom();
+ }
+ }
- clearRoom();
loadPic("his4_1.alg", bgSurface, HALF_PAL);
loadPic("his4_2.alg", drawSurface3);
- copyBackground(0, 0, 0, 0, 320, 200, drawSurface3, screenSurface);
-
- if (_lang != kSpanish)
- centerText(_texthis[_lang][1], 180, 180);
-
- updateScreen();
- key = getScan();
- if (key != 0)
- goto asco;
-
- if (_lang == kSpanish)
- _system->delayMillis(2000);
- else
- _system->delayMillis(4000);
-
- key = getScan();
- if (key != 0)
- goto asco;
-
for (int l = 1; l < 200; l++) {
copyBackground(0, 0, 0, l, 320, 200 - l, drawSurface3, screenSurface);
copyBackground(0, 200 - l, 0, 0, 320, l, bgSurface, screenSurface);
updateScreen();
- key = getScan();
- if (key != 0)
+ if (getScan() != 0)
goto asco;
}
@@ -1002,34 +822,24 @@ asco:
stopMusic();
}
-void DrasculaEngine::animation_17_2() {
- talk_drunk(13);
- talk_drunk(14);
- flags[40] = 1;
-}
-
-void DrasculaEngine::animation_19_2() {
- talk_vonBraunpuerta(5);
-}
-
void DrasculaEngine::animation_20_2() {
- talk_vonBraunpuerta(7);
- talk_vonBraunpuerta(8);
+ talk_vonBraun(7, kVonBraunDoor);
+ talk_vonBraun(8, kVonBraunDoor);
talk(383);
- talk_vonBraunpuerta(9);
+ talk_vonBraun(9, kVonBraunDoor);
talk(384);
- talk_vonBraunpuerta(10);
+ talk_vonBraun(10, kVonBraunDoor);
talk(385);
- talk_vonBraunpuerta(11);
+ talk_vonBraun(11, kVonBraunDoor);
if (flags[23] == 0) {
talk(350);
- talk_vonBraunpuerta(57);
+ talk_vonBraun(57, kVonBraunDoor);
} else {
talk(386);
- talk_vonBraunpuerta(12);
+ talk_vonBraun(12, kVonBraunDoor);
flags[18] = 0;
flags[14] = 1;
- openDoor(15, 1);
+ toggleDoor(15, 1, kOpenDoor);
exitRoom(1);
animation_23_2();
exitRoom(0);
@@ -1042,36 +852,32 @@ void DrasculaEngine::animation_20_2() {
}
}
-void DrasculaEngine::animation_21_2() {
- talk_vonBraunpuerta(6);
-}
-
void DrasculaEngine::animation_23_2() {
loadPic("an24.alg", frontSurface);
flags[21] = 1;
if (flags[25] == 0) {
- talk_vonBraun(13);
- talk_vonBraun(14);
+ talk_vonBraun(13, kVonBraunDoor);
+ talk_vonBraun(14, kVonBraunDoor);
pause(10);
talk(387);
}
- talk_vonBraun(15);
+ talk_vonBraun(15, kVonBraunNormal);
placeVonBraun(42);
trackVonBraun = 1;
- talk_vonBraun(16);
+ talk_vonBraun(16, kVonBraunNormal);
trackVonBraun = 2;
gotoObject(157, 147);
gotoObject(131, 149);
trackProtagonist = 0;
animation_14_2();
if (flags[25] == 0)
- talk_vonBraun(17);
+ talk_vonBraun(17, kVonBraunNormal);
pause(8);
trackVonBraun = 1;
- talk_vonBraun(18);
+ talk_vonBraun(18, kVonBraunNormal);
if (flags[29] == 0)
animation_23_joined();
@@ -1083,9 +889,9 @@ void DrasculaEngine::animation_23_2() {
placeVonBraun(99);
if (flags[29] == 0) {
- talk_vonBraun(19);
+ talk_vonBraun(19, kVonBraunNormal);
if (flags[25] == 0) {
- talk_vonBraun(20);
+ talk_vonBraun(20, kVonBraunNormal);
if (removeObject(kItemMoney) == 0)
flags[30] = 1;
if (removeObject(kItemTwoCoins) == 0)
@@ -1093,7 +899,7 @@ void DrasculaEngine::animation_23_2() {
if (removeObject(kItemOneCoin) == 0)
flags[32] = 1;
}
- talk_vonBraun(21);
+ talk_vonBraun(21, kVonBraunNormal);
} else
animation_27_2();
@@ -1142,7 +948,7 @@ void DrasculaEngine::animation_23_joined2() {
}
void DrasculaEngine::animation_25_2() {
- int cabinPos[6] = { 150, 6, 69, 0, 158, 161 };
+ int cY = 0;
loadPic("an14_2.alg", backSurface);
loadPic(18, bgSurface);
@@ -1152,15 +958,15 @@ void DrasculaEngine::animation_25_2() {
playSound(6);
for (int n = 0; n >= -160; n = n - 8) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
moveCharacters();
moveVonBraun();
- cabinPos[3] = n;
+ cY = n;
- copyRectClip(cabinPos, backSurface, screenSurface);
+ copyRect(150, 6, 69, cY, 158, 161, backSurface, screenSurface);
updateRefresh();
updateScreen();
@@ -1174,50 +980,30 @@ void DrasculaEngine::animation_25_2() {
void DrasculaEngine::animation_27_2() {
flags[22] = 1;
- withoutVerb();
+ selectVerb(0);
removeObject(kItemEarWithEarPlug);
addObject(kItemEarplugs);
- talk_vonBraun(23);
- talk_vonBraun(24);
+ talk_vonBraun(23, kVonBraunNormal);
+ talk_vonBraun(24, kVonBraunNormal);
if (flags[30] == 1)
addObject(kItemMoney);
if (flags[31] == 1)
addObject(kItemTwoCoins);
if (flags[32] == 1)
addObject(kItemOneCoin);
- talk_vonBraun(25);
- talk_vonBraun(26);
-}
-
-void DrasculaEngine::animation_28_2() {
- for(int i = 27; i <= 30; i++)
- talk_vonBraun(i);
+ talk_vonBraun(25, kVonBraunNormal);
+ talk_vonBraun(26, kVonBraunNormal);
}
void DrasculaEngine::animation_29_2() {
if (flags[33] == 0) {
- talk_vonBraun(32);
- talk(398);
- talk_vonBraun(33);
- talk(399);
- talk_vonBraun(34);
- talk_vonBraun(35);
- talk(400);
- talk_vonBraun(36);
- talk_vonBraun(37);
- talk(386);
- talk_vonBraun(38);
- talk_vonBraun(39);
- talk(401);
- talk_vonBraun(40);
- talk_vonBraun(41);
- flags[33] = 1;
+ playTalkSequence(29); // sequence 29, chapter 2
} else
- talk_vonBraun(43);
+ talk_vonBraun(43, kVonBraunNormal);
talk(402);
- talk_vonBraun(42);
+ talk_vonBraun(42, kVonBraunNormal);
if (flags[38] == 0) {
talk(403);
@@ -1226,50 +1012,16 @@ void DrasculaEngine::animation_29_2() {
talk(386);
}
-void DrasculaEngine::animation_30_2() {
- talk_vonBraun(31);
- talk(396);
-}
-
void DrasculaEngine::animation_31_2() {
- talk_vonBraun(44);
+ talk_vonBraun(44, kVonBraunNormal);
placeVonBraun(-50);
pause(15);
gotoObject(159, 140);
loadPic(99, backSurface);
- trackProtagonist = 2;
- updateRoom();
- updateScreen();
- pause(78);
- trackProtagonist = 0;
- updateRoom();
- updateScreen();
- pause(22);
- talk(406);
- placeVonBraun(98);
- talk_vonBraun(45);
- talk_vonBraun(46);
- talk_vonBraun(47);
- talk(407);
- talk_vonBraun(48);
- talk_vonBraun(49);
- talk(408);
- talk_vonBraun(50);
- talk_vonBraun(51);
- talk(409);
- talk_vonBraun(52);
- talk_vonBraun(53);
- pause(12);
- talk_vonBraun(54);
- talk_vonBraun(55);
- talk(410);
- talk_vonBraun(56);
- breakOut = 1;
+ playTalkSequence(31); // sequence 31, chapter 2
- flags[38] = 0;
- flags[36] = 1;
- withoutVerb();
+ selectVerb(0);
removeObject(kItemLeaves);
removeObject(kItemBubbleGum);
removeObject(kItemTissues);
@@ -1293,7 +1045,7 @@ void DrasculaEngine::animation_35_2() {
updateAnim(1, 70, 90, 46, 80, 6, frontSurface);
updateAnim(82, 70, 90, 46, 80, 2, frontSurface);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
@@ -1308,13 +1060,6 @@ void DrasculaEngine::animation_35_2() {
fadeToBlack(2);
}
-void DrasculaEngine::animation_1_3() {
- talk(413);
- grr();
- pause(50);
- talk(414);
-}
-
void DrasculaEngine::animation_2_3() {
flags[0] = 1;
playMusic(13);
@@ -1396,7 +1141,7 @@ void DrasculaEngine::animation_6_3() {
for (frame = 0; frame < 6; frame++) {
pause(3);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
copyRect(yoda_x[frame], yoda_y[frame], px, py, 78, 90, frontSurface, screenSurface);
updateScreen(px, py, px, py, 78, 90, screenSurface);
}
@@ -1436,29 +1181,6 @@ void DrasculaEngine::animation_ray() {
finishSound();
}
-void DrasculaEngine::animation_2_4() {
- talk_igor(16, kIgorSeated);
- talk(278);
- talk_igor(17, kIgorSeated);
- talk(279);
- talk_igor(18, kIgorSeated);
-}
-
-void DrasculaEngine::animation_3_4() {
- talk_igor(19, kIgorSeated);
- talk_igor(20, kIgorSeated);
- talk(281);
-}
-
-void DrasculaEngine::animation_4_4() {
- talk(287);
- talk_igor(21, kIgorSeated);
- talk(284);
- talk_igor(22, kIgorSeated);
- talk(285);
- talk_igor(23, kIgorSeated);
-}
-
void DrasculaEngine::animation_7_4() {
black();
talk(427);
@@ -1512,37 +1234,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);
- breakOut = 1;
-}
-
-void DrasculaEngine::animation_4_5() {
- flags[7] = 1;
- updateRoom();
- updateScreen();
- talk(228);
- talk_werewolf(1);
- talk_werewolf(2);
- pause(23);
- talk(229);
- talk_werewolf(3);
- talk_werewolf(4);
- talk(230);
- talk_werewolf(5);
- talk(231);
- talk_werewolf(6);
- talk_werewolf(7);
- pause(33);
- talk(232);
- talk_werewolf(8);
-}
-
void DrasculaEngine::animation_5_5(){
int h;
int frame = 0;
@@ -1551,7 +1242,7 @@ void DrasculaEngine::animation_5_5(){
int flyX[] = {1, 63, 125, 187, 249};
int pixelX = curX - 53, pixelY = curY - 9;
- withoutVerb();
+ selectVerb(0);
removeObject(8);
gotoObject(curX - 19, curY + curHeight);
@@ -1564,7 +1255,7 @@ void DrasculaEngine::animation_5_5(){
for (frame = 0; frame < 9; frame++) {
pause(3);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, backSurface, screenSurface);
updateScreen(pixelX, pixelY, pixelX,pixelY, 97,64, screenSurface);
}
@@ -1574,7 +1265,7 @@ void DrasculaEngine::animation_5_5(){
for (frame = 0; frame < 9; frame++) {
pause(3);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, frontSurface, screenSurface);
updateScreen(pixelX, pixelY, pixelX,pixelY, 97, 64, screenSurface);
}
@@ -1618,41 +1309,6 @@ void DrasculaEngine::animation_5_5(){
loadPic(49, bgSurface, HALF_PAL);
}
-void DrasculaEngine::animation_6_5() {
- talk_werewolf(9);
- talk(234);
-}
-
-void DrasculaEngine::animation_7_5() {
- talk_werewolf(10);
- talk(236);
- talk_werewolf(11);
- talk_werewolf(12);
- talk_werewolf(13);
- pause(34);
- talk_werewolf(14);
-}
-
-void DrasculaEngine::animation_8_5() {
- talk_werewolf(15);
- talk(238);
- talk_werewolf(16);
-}
-
-void DrasculaEngine::animation_9_5() {
- flags[4] = 1;
- talk(401);
- withoutVerb();
- removeObject(15);
-}
-
-void DrasculaEngine::animation_10_5() {
- flags[3] = 1;
- talk(401);
- withoutVerb();
- removeObject(12);
-}
-
void DrasculaEngine::animation_11_5() {
flags[9] = 1;
if (flags[2] == 1 && flags[3] == 1 && flags[4] == 1)
@@ -1686,7 +1342,7 @@ void DrasculaEngine::animation_12_5() {
updateRoom();
updateScreen();
- setDarkPalette();
+ setDefaultPalette(darkPalette);
for (color = 0; color < 255; color++)
for (component = 0; component < 3; component++) {
@@ -1742,7 +1398,7 @@ void DrasculaEngine::animation_12_5() {
animate("frel.bin", 16);
clearRoom();
- setBrightPalette();
+ setDefaultPalette(brightPalette);
setPalette((byte *)&gamePalette);
flags[1] = 1;
@@ -1765,7 +1421,7 @@ void DrasculaEngine::animation_12_5() {
characterMoved = 0;
curX = -1;
objExit = 104;
- withoutVerb();
+ selectVerb(0);
enterRoom(57);
}
@@ -1774,12 +1430,11 @@ void DrasculaEngine::animation_13_5() {
int frame = 0;
int frus_x[] = {1, 46, 91, 136, 181, 226, 271};
int frus_y[] = {1, 1, 1, 1, 1, 1, 1, 89};
- int pos_frusky[6] = { 1, 1, frank_x, 81, 44, 87 };
loadPic("auxfr.alg", backSurface);
updateRoom();
- copyRectClip(pos_frusky, backSurface, screenSurface);
+ copyRect(1, 1, frank_x, 81, 44, 87, backSurface, screenSurface);
updateScreen();
pause(15);
@@ -1787,10 +1442,7 @@ void DrasculaEngine::animation_13_5() {
for (;;) {
updateRoom();
- pos_frusky[0] = frus_x[frame];
- pos_frusky[1] = frus_y[frame];
- pos_frusky[2] = frank_x;
- copyRectClip( pos_frusky, backSurface, screenSurface);
+ copyRect(frus_x[frame], frus_y[frame], frank_x, 81, 44, 87, backSurface, screenSurface);
updateScreen();
frank_x -= 5;
frame++;
@@ -1823,26 +1475,10 @@ void DrasculaEngine::animation_14_5() {
trackProtagonist = 3;
updateRoom();
updateScreen();
- talk_solo(_textd[_lang][18], "d18.als");
+ talk_solo(_textd[18], "d18.als");
fadeToBlack(1);
}
-void DrasculaEngine::animation_15_5() {
- talk_mus(4);
- talk_mus(5);
- talk_mus(6);
- talk(291);
- 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;
@@ -1909,36 +1545,21 @@ void DrasculaEngine::animation_1_6() {
trackDrascula = 0;
talk_drascula(35);
- if (_lang == kSpanish)
- textSurface = extraSurface;
-
clearRoom();
enterRoom(102);
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 };
+ int pY = -125;
animate("man.bin", 14);
for (int n = -125; n <= 0; n = n + 2) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
- pos_pen[3] = n;
- copyRectClip(pos_pen, drawSurface3, screenSurface);
+ pY = n;
+ copyRect(1, 29, 204, pY, 18, 125, drawSurface3, screenSurface);
updateRefresh();
@@ -1952,7 +1573,7 @@ void DrasculaEngine::animation_5_6() {
void DrasculaEngine::animation_6_6() {
animate("rct.bin", 11);
clearRoom();
- withoutVerb();
+ selectVerb(0);
removeObject(20);
loadPic(96, frontSurface);
loadPic(97, frontSurface);
@@ -1961,7 +1582,7 @@ void DrasculaEngine::animation_6_6() {
doBreak = 1;
objExit = 104;
curX = -1;
- withoutVerb();
+ selectVerb(0);
enterRoom(58);
hare_se_ve = 1;
trackProtagonist = 1;
@@ -1973,11 +1594,6 @@ void DrasculaEngine::animation_6_6() {
flags[2] = 1;
}
-void DrasculaEngine::animation_7_6() {
- flags[8] = 1;
- updateVisible();
-}
-
void DrasculaEngine::animation_9_6() {
int v_cd;
@@ -2014,11 +1630,11 @@ void DrasculaEngine::animation_9_6() {
clearRoom();
loadPic("nota.alg", bgSurface, COMPLETE_PAL);
color_abc(kColorWhite);
- talk_solo(_textbj[_lang][24], "bj24.als");
- talk_solo(_textbj[_lang][25], "bj25.als");
- talk_solo(_textbj[_lang][26], "bj26.als");
- talk_solo(_textbj[_lang][27], "bj27.als");
- talk_solo(_textbj[_lang][28], "bj28.als");
+ talk_solo(_textbj[24], "bj24.als");
+ talk_solo(_textbj[25], "bj25.als");
+ talk_solo(_textbj[26], "bj26.als");
+ talk_solo(_textbj[27], "bj27.als");
+ talk_solo(_textbj[28], "bj28.als");
trackProtagonist = 3;
clearRoom();
loadPic(96, frontSurface, COMPLETE_PAL);
@@ -2033,7 +1649,7 @@ void DrasculaEngine::animation_9_6() {
copyBackground(0, 0, 0, 0, 320, 200, screenSurface, bgSurface);
updateScreen();
color_abc(kColorLightGreen);
- talk_solo(_textmisc[_lang][2], "s15.als");
+ talk_solo(_textmisc[2], "s15.als");
loadPic("nota2.alg", bgSurface);
trackProtagonist = 0;
updateRoom();
@@ -2054,54 +1670,8 @@ void DrasculaEngine::animation_9_6() {
stopMusic();
}
-void DrasculaEngine::animation_10_6() {
- playSound(14);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
- updateRefresh_pre();
- copyBackground(164, 85, 155, 48, 113, 114, drawSurface3, screenSurface);
- updateScreen();
- finishSound();
- talk_bartender(23, 1);
- flags[7] = 1;
-}
-
-void DrasculaEngine::animation_11_6() {
- talk_bartender(10, 1);
- talk(268);
- talk_bartender(11, 1);
-}
-
-void DrasculaEngine::animation_12_6() {
- talk_bartender(12, 1);
- talk(270);
- talk_bartender(13, 1);
- talk_bartender(14, 1);
-}
-
-void DrasculaEngine::animation_13_6() {
- talk_bartender(15, 1);
-}
-
-void DrasculaEngine::animation_14_6() {
- talk_bartender(24, 1);
- addObject(21);
- flags[10] = 1;
- breakOut = 1;
-}
-
-void DrasculaEngine::animation_15_6() {
- talk_bartender(16, 1);
-}
-
-void DrasculaEngine::animation_18_6() {
- flags[6] = 1;
- withoutVerb();
- removeObject(21);
- animate("beb.bin", 10);
-}
-
void DrasculaEngine::animation_19_6() {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
copyBackground(140, 23, 161, 69, 35, 80, drawSurface3, screenSurface);
updateRefresh_pre();
@@ -2116,9 +1686,6 @@ void DrasculaEngine::animation_19_6() {
}
void DrasculaEngine::animation_12_2() {
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
loadPic("an12.alg", extraSurface);
talk(356);
@@ -2144,17 +1711,11 @@ void DrasculaEngine::animation_12_2() {
talk_pianist(5);
converse(1);
- if (_lang == kSpanish)
- textSurface = extraSurface;
-
flags[11] = 0;
loadPic(974, extraSurface);
}
void DrasculaEngine::animation_26_2() {
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
loadPic("an12.alg", extraSurface);
talk(392);
@@ -2205,9 +1766,6 @@ void DrasculaEngine::animation_26_2() {
pickObject(11);
removeObject(kItemBook);
- if (_lang == kSpanish)
- textSurface = extraSurface;
-
flags[11] = 0;
flags[39] = 1;
loadPic(974, extraSurface);
@@ -2215,23 +1773,9 @@ void DrasculaEngine::animation_26_2() {
}
void DrasculaEngine::animation_11_2() {
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
loadPic("an11y13.alg", extraSurface);
- talk(352);
- talk_bartender(1);
- talk(353);
- talk_bartender(17);
- talk(354);
- talk_bartender(18);
- talk(355);
- pause(40);
- talk_bartender(82);
-
- if (_lang == kSpanish)
- textSurface = extraSurface;
+ playTalkSequence(11); // sequence 11, chapter 2
loadPic(974, extraSurface);
}
@@ -2240,47 +1784,12 @@ void DrasculaEngine::animation_13_2() {
loadPic("an11y13.alg", frontSurface);
if (flags[41] == 0) {
- talk(103);
- talk_drunk(4);
- flags[12] = 1;
- talk(367);
- talk_drunk(5);
- flags[12] = 1;
- talk(368);
- talk_drunk(6);
- talk_drunk(7);
- flags[41] = 1;
+ playTalkSequence(13); // sequence 13, chapter 2
}
- converse(2);
loadPic(964, frontSurface);
}
-void DrasculaEngine::animation_18_2() {
- talk(378);
- talk_vonBraunpuerta(4);
- converse(3);
-}
-
-void DrasculaEngine::animation_22_2() {
- talk(374);
-
- trackProtagonist=2;
- updateRoom();
- updateScreen();
- playSound(13);
- finishSound();
- trackProtagonist = 1;
-
- talk_vonBraunpuerta(1);
- talk(375);
- talk_vonBraunpuerta(2);
- talk(376);
- talk_vonBraunpuerta(3);
-
- flags[18] = 1;
-}
-
void DrasculaEngine::animation_24_2() {
if (curX < 178)
gotoObject(208, 136);
@@ -2297,7 +1806,7 @@ void DrasculaEngine::animation_24_2() {
flags[21] = 1;
- talk_vonBraun(22);
+ talk_vonBraun(22, kVonBraunNormal);
if (flags[22] == 0)
converse(4);
@@ -2360,9 +1869,6 @@ void DrasculaEngine::animation_34_2() {
}
void DrasculaEngine::animation_36_2() {
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
loadPic("an11y13.alg", extraSurface);
talk(404);
@@ -2373,9 +1879,6 @@ void DrasculaEngine::animation_36_2() {
pause(40);
talk_bartender(82);
- if (_lang == kSpanish)
- textSurface = extraSurface;
-
loadPic(974, extraSurface);
}
@@ -2387,7 +1890,7 @@ void DrasculaEngine::animation_7_2() {
if (flags[3] == 1)
copyBackground(258, 110, 85, 44, 23, 53, drawSurface3, bgSurface);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
@@ -2467,17 +1970,14 @@ void DrasculaEngine::animation_5_2() {
loadPic("aux5.alg", drawSurface3);
flags[8] = 1;
curX = curX - 4;
- talk_sync(_text[_lang][46], "46.als", "4442444244244");
- withoutVerb();
+ talk_sync(_text[46], "46.als", "4442444244244");
+ selectVerb(0);
}
void DrasculaEngine::animation_6_2() {
stopMusic();
flags[9] = 1;
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
clearRoom();
loadPic("ciego1.alg", bgSurface, HALF_PAL); // ciego = blind
loadPic("ciego2.alg", drawSurface3);
@@ -2485,7 +1985,7 @@ void DrasculaEngine::animation_6_2() {
loadPic("ciego4.alg", backSurface);
loadPic("ciego5.alg", frontSurface);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
pause(1);
@@ -2497,7 +1997,7 @@ void DrasculaEngine::animation_6_2() {
pause(4);
talk_hacker(67);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
pause(10);
@@ -2510,10 +2010,7 @@ void DrasculaEngine::animation_6_2() {
loadPic(96, frontSurface);
loadPic(97, extraSurface);
loadPic(99, backSurface);
- withoutVerb();
-
- if (_lang == kSpanish)
- textSurface = extraSurface;
+ selectVerb(0);
flags[9] = 0;
}
@@ -2523,7 +2020,7 @@ void DrasculaEngine::animation_33_2() {
flags[9] = 1;
pause(12);
- talk(56);
+ talk(60);
pause(8);
clearRoom();
@@ -2533,10 +2030,7 @@ void DrasculaEngine::animation_33_2() {
loadPic("ciego4.alg", backSurface);
loadPic("ciego5.alg", frontSurface);
- if (_lang == kSpanish)
- textSurface = frontSurface;
-
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
pause(10);
@@ -2549,7 +2043,7 @@ void DrasculaEngine::animation_33_2() {
talk_blind(10);
talk_hacker(65);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
pause(14);
@@ -2562,10 +2056,7 @@ void DrasculaEngine::animation_33_2() {
loadPic(96, frontSurface);
loadPic(97, extraSurface);
loadPic(99, backSurface);
- withoutVerb();
-
- if (_lang == kSpanish)
- textSurface = extraSurface;
+ selectVerb(0);
flags[33] = 1;
flags[9] = 0;
@@ -2642,7 +2133,7 @@ void DrasculaEngine::animation_5_4(){
curY = 82;
updateRoom();
updateScreen();
- openDoor(2, 0);
+ toggleDoor(2, 0, kOpenDoor);
loadPic("auxigor.alg", frontSurface);
igorX = 100;
igorY = 65;
@@ -2663,7 +2154,7 @@ void DrasculaEngine::animation_6_4() {
loadPic(26, bgSurface, HALF_PAL);
loadPic("aux26.alg", drawSurface3);
loadPic("auxigor.alg", frontSurface);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
update_26_pre();
igorX = 104;
igorY = 71;
@@ -2676,7 +2167,7 @@ void DrasculaEngine::animation_6_4() {
loadPic(96, frontSurface);
loadPic(roomDisk, drawSurface3);
loadPic(roomNumber, bgSurface, HALF_PAL);
- withoutVerb();
+ selectVerb(0);
updateRoom();
}
@@ -2693,12 +2184,7 @@ void DrasculaEngine::animation_8_4() {
}
loadPic(96, frontSurface);
- openDoor(7, 2);
-}
-
-void DrasculaEngine::animation_9_4() {
- animate("st.bin", 14);
- fadeToBlack(1);
+ toggleDoor(7, 2, kOpenDoor);
}
void DrasculaEngine::activatePendulum() {
diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp
index 1c3831e4ca..cef1a17486 100644
--- a/engines/drascula/converse.cpp
+++ b/engines/drascula/converse.cpp
@@ -27,38 +27,128 @@
namespace Drascula {
+void DrasculaEngine::playTalkSequence(int sequence) {
+ bool seen = false;
+
+ for (int i = 0; i < _talkSequencesSize; i++) {
+ if (_talkSequences[i].chapter == currentChapter &&
+ _talkSequences[i].sequence == sequence) {
+ seen = true;
+
+ doTalkSequenceCommand(_talkSequences[i]);
+ } else if (seen) // Stop searching down the list
+ break;
+ }
+}
+
+void DrasculaEngine::doTalkSequenceCommand(TalkSequenceCommand cmd) {
+ switch (cmd.commandType) {
+ case kPause:
+ pause(cmd.action);
+ break;
+ case kSetFlag:
+ flags[cmd.action] = 1;
+ break;
+ case kClearFlag:
+ flags[cmd.action] = 0;
+ break;
+ case kPickObject:
+ pickObject(cmd.action);
+ break;
+ case kAddObject:
+ addObject(cmd.action);
+ break;
+ case kBreakOut:
+ breakOut = 1;
+ break;
+ case kConverse:
+ converse(cmd.action);
+ break;
+ case kPlaceVB:
+ placeVonBraun(cmd.action);
+ break;
+ case kUpdateRoom:
+ updateRoom();
+ break;
+ case kUpdateScreen:
+ updateScreen();
+ break;
+ case kTrackProtagonist:
+ trackProtagonist = cmd.action;
+ break;
+ case kPlaySound:
+ playSound(cmd.action);
+ break;
+ case kFinishSound:
+ finishSound();
+ break;
+ case kTalkerGeneral:
+ talk(cmd.action);
+ break;
+ case kTalkerDrunk:
+ talk_drunk(cmd.action);
+ break;
+ case kTalkerPianist:
+ talk_pianist(cmd.action);
+ break;
+ case kTalkerBJ:
+ talk_bj(cmd.action);
+ break;
+ case kTalkerVBNormal:
+ talk_vonBraun(cmd.action, kVonBraunNormal);
+ break;
+ case kTalkerVBDoor:
+ talk_vonBraun(cmd.action, kVonBraunDoor);
+ break;
+ case kTalkerIgorSeated:
+ talk_igor(cmd.action, kIgorSeated);
+ break;
+ case kTalkerWerewolf:
+ talk_werewolf(cmd.action);
+ break;
+ case kTalkerMus:
+ talk_mus(cmd.action);
+ break;
+ case kTalkerDrascula:
+ talk_drascula(cmd.action, 1);
+ break;
+ case kTalkerBartender0:
+ talk_bartender(cmd.action, 0);
+ break;
+ case kTalkerBartender1:
+ talk_bartender(cmd.action, 1);
+ break;
+ default:
+ error("doTalkSequenceCommand: Unknown command: %d", cmd.commandType);
+ }
+}
+
+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();
+ selectVerb(0);
getStringFromLine(buffer, size, phrase1);
getStringFromLine(buffer, size, phrase2);
@@ -75,222 +165,131 @@ void DrasculaEngine::converse(int index) {
_arj.close();
if (currentChapter == 2 && !strcmp(fileName, "op_5.cal") && flags[38] == 1 && flags[33] == 1) {
- strcpy(phrase3, _text[_lang][405]);
+ strcpy(phrase3, _text[405]);
strcpy(sound3, "405.als");
answer3 = 31;
}
if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[7] == 1) {
- strcpy(phrase3, _text[_lang][273]);
+ strcpy(phrase3, _text[273]);
strcpy(sound3, "273.als");
answer3 = 14;
}
if (currentChapter == 6 && !strcmp(fileName, "op_12.cal") && flags[10] == 1) {
- strcpy(phrase3, _text[_lang][274]);
+ strcpy(phrase3, _text[274]);
strcpy(sound3, "274.als");
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(phrase3, 18, kDialogOptionSelected);
- 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);
-
- 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) {
- if (currentChapter == 1) {
- if (function >= 10 && function <= 12)
- talk_drunk(function - 9);
- } else if (currentChapter == 2) {
- if (function == 8)
- animation_8_2();
- else if (function == 9)
- animation_9_2();
- else if (function == 10)
- animation_10_2();
- else if (function == 15)
- animation_15_2();
- else if (function == 16)
+ playTalkSequence(function);
+
+ if (currentChapter == 2) {
+ if (function == 16)
animation_16_2();
- else if (function == 17)
- animation_17_2();
- else if (function == 19)
- animation_19_2();
else if (function == 20)
animation_20_2();
- else if (function == 21)
- animation_21_2();
else if (function == 23)
animation_23_2();
- else if (function == 28)
- animation_28_2();
else if (function == 29)
animation_29_2();
- else if (function == 30)
- animation_30_2();
else if (function == 31)
animation_31_2();
- } else if (currentChapter == 4) {
- if (function == 2)
- animation_2_4();
- else if (function == 3)
- animation_3_4();
- else if (function == 4)
- animation_4_4();
- } else if (currentChapter == 5) {
- if (function == 2)
- animation_2_5();
- else if (function == 3)
- animation_3_5();
- else if (function == 6)
- animation_6_5();
- else if (function == 7)
- animation_7_5();
- else if (function == 8)
- animation_8_5();
- else if (function == 15)
- animation_15_5();
- else if (function == 16)
- animation_16_5();
- else if (function == 17)
- animation_17_5();
- } else if (currentChapter == 6) {
- if (function == 2)
- animation_2_6();
- else if (function == 3)
- animation_3_6();
- else if (function == 4)
- animation_4_6();
- else if (function == 11)
- animation_11_6();
- else if (function == 12)
- animation_12_6();
- else if (function == 13)
- animation_13_6();
- else if (function == 14)
- animation_14_6();
- else if (function == 15)
- animation_15_6();
+ } else if (currentChapter == 3) {
+ grr();
}
}
diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp
index a426857fbd..81c8d9a62a 100644
--- a/engines/drascula/detection.cpp
+++ b/engines/drascula/detection.cpp
@@ -195,6 +195,38 @@ static const DrasculaGameDescription gameDescriptions[] = {
},
},
+ {
+ // Drascula Spanish version (ScummVM repacked files)
+ {
+ "drascula",
+ 0,
+ {
+ {"packet.001", 0, "c6a8697396e213a18472542d5f547cb4", 32847563},
+ {"packet.004", 0, "a289d3cf80d50f25ec569b653248437e", 17205838},
+ {NULL, 0, NULL, 0}
+ },
+ Common::ES_ESP,
+ Common::kPlatformPC,
+ GF_PACKED
+ },
+ },
+
+ {
+ // Drascula Italian version (ScummVM repacked files)
+ {
+ "drascula",
+ 0,
+ {
+ {"packet.001", 0, "c6a8697396e213a18472542d5f547cb4", 32847563},
+ {"packet.005", 0, "58caac54b891f5d7f335e710e45e5d29", 16209623},
+ {NULL, 0, NULL, 0}
+ },
+ Common::IT_ITA,
+ Common::kPlatformPC,
+ GF_PACKED
+ },
+ },
+
{ AD_TABLE_END_MARKER }
};
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 1cbe2ae0e1..c1449ea2c9 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -65,7 +65,7 @@ DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gam
if (cd_num >= 0)
_system->openCD(cd_num);
- _lang = 0;
+ _lang = kEnglish;
}
DrasculaEngine::~DrasculaEngine() {
@@ -86,6 +86,7 @@ DrasculaEngine::~DrasculaEngine() {
free(_roomPreUpdates);
free(_roomUpdates);
free(_roomActions);
+ free(_talkSequences);
freeTexts(_text);
freeTexts(_textd);
freeTexts(_textb);
@@ -112,23 +113,23 @@ int DrasculaEngine::init() {
switch (getLanguage()) {
case Common::EN_ANY:
- _lang = 0;
+ _lang = kEnglish;
break;
case Common::ES_ESP:
- _lang = 1;
+ _lang = kSpanish;
break;
case Common::DE_DEU:
- _lang = 2;
+ _lang = kGerman;
break;
case Common::FR_FRA:
- _lang = 3;
+ _lang = kFrench;
break;
case Common::IT_ITA:
- _lang = 4;
+ _lang = kItalian;
break;
default:
warning("Unknown game language. Falling back to English");
- _lang = 0;
+ _lang = kEnglish;
}
_charMap = 0;
@@ -162,6 +163,12 @@ int DrasculaEngine::init() {
_textmisc = 0;
_textd1 = 0;
+ _color = 0;
+ blinking = 0;
+ leftMouseButton = 0;
+ rightMouseButton = 0;
+ *textName = 0;
+
if (!loadDrasculaDat())
return 1;
@@ -173,7 +180,9 @@ int DrasculaEngine::init() {
int DrasculaEngine::go() {
currentChapter = 1; // values from 1 to 6 will start each part of game
- hay_que_load = 0;
+ loadedDifferentChapter = 0;
+
+ checkCD();
for (;;) {
int i;
@@ -193,7 +202,6 @@ int DrasculaEngine::go() {
talkHeight = TALK_HEIGHT; talkWidth = TALK_WIDTH;
hasAnswer = 0;
savedTime = 0;
- changeColor = 0;
breakOut = 0;
vonBraunX = 120; trackVonBraun = 1; vonBraunHasMoved = 0;
framesWithoutAction = 0;
@@ -215,50 +223,46 @@ int DrasculaEngine::go() {
withVoices = 0;
selectionMade = 0;
- if (currentChapter != 6)
- loadPic(95, tableSurface);
+ if (currentChapter != 3)
+ loadPic(96, frontSurface, COMPLETE_PAL);
if (currentChapter == 1) {
- loadPic(96, frontSurface, COMPLETE_PAL);
- loadPic(99, backSurface);
- loadPic(97, extraSurface);
} else if (currentChapter == 2) {
- loadPic(96, frontSurface, COMPLETE_PAL);
loadPic("pts.alg", drawSurface2);
} else if (currentChapter == 3) {
loadPic("aux13.alg", bgSurface, COMPLETE_PAL);
loadPic(96, frontSurface);
- loadPic(97, extraSurface);
- loadPic(99, backSurface);
} else if (currentChapter == 4) {
- loadPic(96, frontSurface, COMPLETE_PAL);
- if (hay_que_load == 0)
+ if (loadedDifferentChapter == 0)
animation_ray();
loadPic(96, frontSurface);
clearRoom();
- loadPic(99, backSurface);
- loadPic(97, extraSurface);
} else if (currentChapter == 5) {
- loadPic(96, frontSurface, COMPLETE_PAL);
- loadPic(97, extraSurface);
- loadPic(99, backSurface);
} else if (currentChapter == 6) {
igorX = 105, igorY = 85, trackIgor = 1;
drasculaX = 62, drasculaY = 99, trackDrascula = 1;
actorFrames[kFramePendulum] = 0;
flag_tv = 0;
+ }
- loadPic(96, frontSurface, COMPLETE_PAL);
+ loadPic(95, tableSurface);
+ for (i = 0; i < 25; i++)
+ memcpy(crosshairCursor + i * 40, tableSurface + 225 + (56 + i) * 320, 40);
+
+ if (_lang == kSpanish)
+ loadPic(974, tableSurface);
+
+ if (currentChapter != 2) {
loadPic(99, backSurface);
loadPic(97, extraSurface);
- loadPic(95, tableSurface);
}
+
memset(iconName, 0, sizeof(iconName));
for (i = 0; i < 6; i++)
- strcpy(iconName[i + 1], _textverbs[_lang][i]);
+ strcpy(iconName[i + 1], _textverbs[i]);
- assignDefaultPalette();
+ assignPalette(defaultPalette);
if (!runCurrentChapter()) {
endChapter();
break;
@@ -286,10 +290,7 @@ void DrasculaEngine::endChapter() {
bool DrasculaEngine::runCurrentChapter() {
int n;
- if (_lang == kSpanish)
- textSurface = extraSurface;
- else
- textSurface = tableSurface;
+ rightMouseButton = 0;
previousMusic = -1;
@@ -319,14 +320,14 @@ bool DrasculaEngine::runCurrentChapter() {
if (currentChapter == 1) {
pickObject(28);
- if (hay_que_load == 0)
+ if (loadedDifferentChapter == 0)
animation_1_1();
- withoutVerb();
+ selectVerb(0);
loadPic("2aux62.alg", drawSurface2);
trackProtagonist = 1;
objExit = 104;
- if (hay_que_load != 0) {
+ if (loadedDifferentChapter != 0) {
if (!loadGame(saveName)) {
return true;
}
@@ -340,7 +341,7 @@ bool DrasculaEngine::runCurrentChapter() {
addObject(kItemPhone);
trackProtagonist = 3;
objExit = 162;
- if (hay_que_load == 0)
+ if (loadedDifferentChapter == 0)
enterRoom(14);
else {
if (!loadGame(saveName)) {
@@ -358,7 +359,7 @@ bool DrasculaEngine::runCurrentChapter() {
flags[1] = 1;
trackProtagonist = 1;
objExit = 99;
- if (hay_que_load == 0)
+ if (loadedDifferentChapter == 0)
enterRoom(20);
else {
if (!loadGame(saveName)) {
@@ -372,7 +373,7 @@ bool DrasculaEngine::runCurrentChapter() {
addObject(kItemReefer2);
addObject(kItemOneCoin2);
objExit = 100;
- if (hay_que_load == 0) {
+ if (loadedDifferentChapter == 0) {
enterRoom(21);
trackProtagonist = 0;
curX = 235;
@@ -394,7 +395,7 @@ bool DrasculaEngine::runCurrentChapter() {
addObject(20);
trackProtagonist = 1;
objExit = 100;
- if (hay_que_load == 0) {
+ if (loadedDifferentChapter == 0) {
enterRoom(45);
} else {
if (!loadGame(saveName)) {
@@ -407,7 +408,7 @@ bool DrasculaEngine::runCurrentChapter() {
trackProtagonist = 1;
objExit = 104;
- if (hay_que_load == 0) {
+ if (loadedDifferentChapter == 0) {
enterRoom(58);
animation_1_6();
} else {
@@ -418,6 +419,8 @@ bool DrasculaEngine::runCurrentChapter() {
}
}
+ showCursor();
+
while (1) {
if (characterMoved == 0) {
stepX = STEP_X;
@@ -436,7 +439,8 @@ bool DrasculaEngine::runCurrentChapter() {
// made the character start walking off screen, as his actual position was
// different than the displayed one
if (roomNumber == 3 && (curX == 279) && (curY + curHeight == 101)) {
- animation_1_2();
+ gotoObject(178, 121);
+ gotoObject(169, 135);
} else if (roomNumber == 14 && (curX == 214) && (curY + curHeight == 121)) {
walkToObject = 1;
gotoObject(190, 130);
@@ -457,12 +461,26 @@ bool DrasculaEngine::runCurrentChapter() {
playMusic(roomMusic);
}
+ delay(25);
+#ifndef _WIN32_WCE
+ // FIXME
+ // This and the following #ifndefs disable the excess updateEvents() calls *within* the game loop.
+ // Events such as keypresses or mouse clicks are dropped on the ground with no processing
+ // by these calls. They are properly handled by the implicit call through getScan() below.
+ // It is not a good practice to not process events and indeed this created problems with synthesized
+ // events in the wince port.
updateEvents();
+#endif
if (menuScreen == 0 && takeObject == 1)
checkObjects();
+#ifdef _WIN32_WCE
+ if (rightMouseButton)
+ if (menuScreen) {
+#else
if (rightMouseButton == 1 && menuScreen == 1) {
+#endif
delay(100);
if (currentChapter == 2)
loadPic(menuBackground, backSurface);
@@ -470,9 +488,24 @@ bool DrasculaEngine::runCurrentChapter() {
loadPic(99, backSurface);
setPalette((byte *)&gamePalette);
menuScreen = 0;
+#ifndef _WIN32_WCE
+ // FIXME: This call here is in hope that it will catch the rightmouseup event so the
+ // next if block won't be executed. This too is not a good coding practice. I've recoded it
+ // with a mutual exclusive if block for the menu. I would commit this properly but I cannot test
+ // for other (see Desktop) ports right now.
updateEvents();
+#endif
+#ifdef _WIN32_WCE
+ } else {
+#else
}
- if (rightMouseButton == 1 && menuScreen == 0) {
+
+ // Do not show the inventory screen in chapter 5, if the right mouse button is clicked
+ // while the plug (object 16) is held
+ // Fixes bug #2059621 - "DRASCULA: Plug bug"
+ if (rightMouseButton == 1 && menuScreen == 0 &&
+ !(currentChapter == 5 && pickedObject == 16)) {
+#endif
delay(100);
characterMoved = 0;
if (trackProtagonist == 2)
@@ -486,8 +519,10 @@ bool DrasculaEngine::runCurrentChapter() {
else
loadPic("icons.alg", backSurface);
menuScreen = 1;
+#ifndef _WIN32_WCE
updateEvents();
- withoutVerb();
+#endif
+ selectVerb(0);
}
if (leftMouseButton == 1 && menuBar == 1) {
@@ -523,15 +558,15 @@ bool DrasculaEngine::runCurrentChapter() {
if (!saveLoadScreen())
return true;
} else if (key == Common::KEYCODE_F8) {
- withoutVerb();
+ selectVerb(0);
} else if (key == Common::KEYCODE_v) {
withVoices = 1;
- print_abc(_textsys[_lang][2], 96, 86);
+ print_abc(_textsys[2], 96, 86);
updateScreen();
delay(1410);
} else if (key == Common::KEYCODE_t) {
withVoices = 0;
- print_abc(_textsys[_lang][3], 94, 86);
+ print_abc(_textsys[3], 94, 86);
updateScreen();
delay(1460);
} else if (key == Common::KEYCODE_ESCAPE) {
@@ -563,8 +598,10 @@ char *DrasculaEngine::getLine(char *buf, int len) {
for (;;) {
b = buf;
- while (!_arj.eos()) {
+ while (true) {
c = ~_arj.readByte();
+ if (_arj.eos()) break;
+
if (c == '\r')
continue;
if (c == '\n' || b - buf >= (len - 1))
@@ -672,10 +709,14 @@ void DrasculaEngine::updateEvents() {
Common::Event event;
Common::EventManager *eventMan = _system->getEventManager();
- AudioCD.updateCD();
+ updateMusic();
+#ifdef _WIN32_WCE
+ if (eventMan->pollEvent(event)) {
+#else
while (eventMan->pollEvent(event)) {
- switch (event.type) {
+#endif
+ switch (event.type) {
case Common::EVENT_KEYDOWN:
_keyPressed = event.kbd;
break;
@@ -725,7 +766,6 @@ void DrasculaEngine::reduce_hare_chico(int xx1, int yy1, int xx2, int yy2, int w
float totalX, totalY;
int n, m;
float pixelX, pixelY;
- int pixelPos[6];
newWidth = (width * factor) / 100;
newHeight = (height * factor) / 100;
@@ -738,14 +778,8 @@ void DrasculaEngine::reduce_hare_chico(int xx1, int yy1, int xx2, int yy2, int w
for (n = 0; n < newHeight; n++) {
for (m = 0; m < newWidth; m++) {
- pixelPos[0] = (int)pixelX;
- pixelPos[1] = (int)pixelY;
- pixelPos[2] = xx2 + m;
- pixelPos[3] = yy2 + n;
- pixelPos[4] = 1;
- pixelPos[5] = 1;
-
- copyRectClip(pixelPos, dir_inicio, dir_fin);
+ copyRect((int)pixelX, (int)pixelY, xx2 + m, yy2 + n,
+ 1, 1, dir_inicio, dir_fin);
pixelX += totalX;
}
@@ -762,7 +796,7 @@ void DrasculaEngine::hipo_sin_nadie(int counter){
do {
counter--;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
if (currentChapter == 3)
updateScreen(0, 0, 0, y, 320, 200, screenSurface);
else
@@ -786,7 +820,7 @@ void DrasculaEngine::hipo_sin_nadie(int counter){
}
} while (counter > 0);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
}
@@ -931,6 +965,15 @@ bool DrasculaEngine::loadDrasculaDat() {
_roomActions[i].speechID = in.readSint16BE();
}
+ _talkSequencesSize = in.readUint16BE();
+ _talkSequences = (TalkSequenceCommand *)malloc(sizeof(TalkSequenceCommand) * _talkSequencesSize);
+ for (i = 0; i < _talkSequencesSize; i++) {
+ _talkSequences[i].chapter = in.readSint16BE();
+ _talkSequences[i].sequence = in.readSint16BE();
+ _talkSequences[i].commandType = in.readSint16BE();
+ _talkSequences[i].action = in.readSint16BE();
+ }
+
_numLangs = in.readUint16BE();
_text = loadTexts(in);
@@ -952,24 +995,22 @@ bool DrasculaEngine::loadDrasculaDat() {
return true;
}
-char ***DrasculaEngine::loadTexts(Common::File &in) {
+char **DrasculaEngine::loadTexts(Common::File &in) {
int numTexts = in.readUint16BE();
- char ***res;
+ char **res = (char **)malloc(sizeof(char *) * numTexts);
int entryLen;
- char *pos;
+ char *pos = 0;
int len;
- res = (char ***)malloc(sizeof(char *) * _numLangs);
-
for (int lang = 0; lang < _numLangs; lang++) {
entryLen = in.readUint16BE();
-
- res[lang] = (char **)malloc(sizeof(char *) * numTexts);
-
pos = (char *)malloc(entryLen);
- res[lang][0] = pos;
-
- in.read(res[lang][0], entryLen);
+ if (lang == _lang) {
+ res[0] = pos;
+ in.read(res[0], entryLen);
+ } else {
+ in.read(pos, entryLen);
+ }
pos += DATAALIGNMENT;
@@ -979,18 +1020,19 @@ char ***DrasculaEngine::loadTexts(Common::File &in) {
len = READ_BE_UINT16(pos);
pos += 2 + len;
- res[lang][i] = pos;
+ if (lang == _lang)
+ res[i] = pos;
}
}
return res;
}
-void DrasculaEngine::freeTexts(char ***ptr) {
- for (int lang = 0; lang < _numLangs; lang++) {
- free(ptr[lang][0] - DATAALIGNMENT);
- free(ptr[lang]);
- }
+void DrasculaEngine::freeTexts(char **ptr) {
+ if (!ptr)
+ return;
+
+ free(ptr[0]);
free(ptr);
}
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 8bb73d8dd1..3b499f27a0 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -37,16 +37,13 @@
#include "common/keyboard.h"
#include "common/unarj.h"
-#include "sound/audiostream.h"
#include "sound/mixer.h"
-#include "sound/voc.h"
-#include "sound/audiocd.h"
#include "engines/engine.h"
namespace Drascula {
-#define DRASCULA_DAT_VER 2
+#define DRASCULA_DAT_VER 4
#define DATAALIGNMENT 4
enum DrasculaGameFeatures {
@@ -135,6 +132,11 @@ enum IgorTalkerTypes {
kIgorWig = 4
};
+enum VonBraunTalkerTypes {
+ kVonBraunNormal = 0,
+ kVonBraunDoor = 1
+};
+
enum AnimFrameTypes {
kFrameBlind = 0,
kFrameSnore = 1,
@@ -146,6 +148,64 @@ enum AnimFrameTypes {
kFramePendulum = 7
};
+enum DialogOptionStatus {
+ kDialogOptionUnselected = 1,
+ kDialogOptionSelected = 2,
+ kDialogOptionClicked = 3
+};
+
+enum TalkSequenceCommands {
+ kPause = 0,
+ kSetFlag = 1,
+ kClearFlag = 2,
+ kPickObject = 3,
+ kAddObject = 4,
+ kBreakOut = 5,
+ kConverse = 6,
+ kPlaceVB = 7,
+ kUpdateRoom = 8,
+ kUpdateScreen = 9,
+ kTrackProtagonist = 10,
+ kPlaySound = 11,
+ kFinishSound = 12,
+ kTalkerGeneral = 13,
+ kTalkerDrunk = 14,
+ kTalkerPianist = 15,
+ kTalkerBJ = 16,
+ kTalkerVBNormal = 17,
+ kTalkerVBDoor = 18,
+ kTalkerIgorSeated = 19,
+ kTalkerWerewolf = 20,
+ kTalkerMus = 21,
+ kTalkerDrascula = 22,
+ kTalkerBartender0 = 23,
+ kTalkerBartender1 = 24
+};
+
+enum CharacterDirections {
+ kDirectionUp = 0,
+ kDirectionDown = 1,
+ kDirectionLeft = 2,
+ kDirectionRight = 3
+};
+
+enum MouseCursors {
+ kCursorCrosshair = 0,
+ kCursorCurrentItem = 1
+};
+
+enum DoorActions {
+ kCloseDoor = 0,
+ kOpenDoor = 1
+};
+
+struct TalkSequenceCommand {
+ int chapter;
+ int sequence;
+ int commandType;
+ int action;
+};
+
#define TEXTD_START 68
struct DrasculaGameDescription;
@@ -248,13 +308,18 @@ public:
typedef signed char DacPalette256[256][3];
void setRGB(byte *pal, int plt);
- void assignDefaultPalette();
+ void assignPalette(DacPalette256 pal);
+ void setDefaultPalette(DacPalette256 pal);
void setPalette(byte *PalBuf);
void copyBackground(int xorg, int yorg, int xdes, int ydes, int width,
int height, byte *src, byte *dest);
+
+ void copyBackground() {
+ copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ }
+
void copyRect(int xorg, int yorg, int xdes, int ydes, int width,
int height, byte *src, byte *dest);
- void copyRectClip(int *Array, byte *src, byte *dest);
void updateScreen() {
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
}
@@ -275,6 +340,9 @@ public:
DacPalette256 brightPalette;
DacPalette256 darkPalette;
+ byte *crosshairCursor;
+ byte *mouseCursor;
+
// Graphics buffers/pointers
byte *VGA;
byte *bgSurface;
@@ -309,7 +377,7 @@ public:
int roomObjX[40], roomObjY[40], trackObj[40];
int inventoryObjects[43];
char _targetSurface[40][20];
- int _destX[40], _destY[40], trackCharacter_alkeva[40], alapuertakeva[40];
+ int _destX[40], _destY[40], trackCharacter_alkeva[40], roomExits[40];
int x1[40], y1[40], x2[40], y2[40];
int takeObject, pickedObject;
int withVoices;
@@ -321,7 +389,8 @@ public:
int flags[NUM_FLAGS];
int frame_y;
- int curX, curY, characterMoved, curDirection, trackProtagonist, num_frame, hare_se_ve;
+ int curX, curY, characterMoved, curDirection, trackProtagonist, num_frame;
+ int hare_se_ve; // TODO: what is this for?
int roomX, roomY, checkFlags;
int doBreak;
int stepX, stepY;
@@ -334,7 +403,6 @@ public:
int timeDiff, startTime;
int hasAnswer;
int savedTime;
- int changeColor;
int breakOut;
int vonBraunX, trackVonBraun, vonBraunHasMoved;
float newHeight, newWidth;
@@ -347,7 +415,7 @@ public:
int framesWithoutAction;
int term_int;
int currentChapter;
- int hay_que_load;
+ int loadedDifferentChapter;
char saveName[13];
int _color;
int musicStopped;
@@ -368,12 +436,9 @@ public:
void moveVonBraun();
void placeVonBraun(int pointX);
void hipo_sin_nadie(int counter);
- void openDoor(int nflag, int doorNum);
+ void toggleDoor(int nflag, int doorNum, int action);
void showMap();
- void setDarkPalette();
-
- void withoutVerb();
void enterRoom(int);
void clearRoom();
void gotoObject(int, int);
@@ -399,6 +464,7 @@ public:
void fadeToBlack(int fadeSpeed);
signed char adjustToVGA(signed char value);
void color_abc(int cl);
+ bool textFitsCentered(char *text, int x);
void centerText(const char *,int,int);
void playSound(int soundNum);
bool animate(const char *animation, int FPS);
@@ -408,7 +474,7 @@ public:
void placeDrascula();
void talkInit(const char *filename);
- bool isTalkFinished(int* length);
+ bool isTalkFinished();
void talk_igor(int, int);
void talk_drascula(int index, int talkerType = 0);
void talk_solo(const char *, const char *);
@@ -417,7 +483,7 @@ public:
void talk_bj_bed(int);
void talk_htel(int);
void talk_bj(int);
- void talk_baul(int);
+ void talk_trunk(int);
void talk(int);
void talk(const char *, const char *);
void talk_sync(const char *, const char *, const char *);
@@ -425,9 +491,8 @@ public:
void talk_pianist(int);
void talk_werewolf(int);
void talk_mus(int);
- void talk_dr_grande(int);
- void talk_vonBraun(int);
- void talk_vonBraunpuerta(int);
+ void talk_drascula_big(int);
+ void talk_vonBraun(int, int);
void talk_blind(int);
void talk_hacker(int);
void talk_generic(const char* said, const char* filename, int* faces, int faceCount, int* coords, byte* surface);
@@ -435,18 +500,14 @@ public:
void hiccup(int);
void finishSound();
void stopSound();
- void closeDoor(int nflag, int doorNum);
void playMusic(int p);
void stopMusic();
+ void updateMusic();
int musicStatus();
void updateRoom();
bool loadGame(const char *);
void updateDoor(int);
- void setDefaultPalette();
void setPaletteBase(int darkness);
- void assignBrightPalette();
- void assignDarkPalette();
- void setBrightPalette();
void updateVisible();
void startWalking();
void updateRefresh();
@@ -458,7 +519,10 @@ public:
bool exitRoom(int);
bool pickupObject();
bool checkAction(int);
- void setCursorTable();
+ void setCursor(int cursor);
+ void showCursor();
+ void hideCursor();
+ bool isCursorVisible();
void enterName();
bool soundIsActive();
void waitFrameSSN();
@@ -490,8 +554,11 @@ public:
bool checkMenuFlags();
void setupRoomsTable();
bool roomParse(int, int);
+ void cleanupString(char *string);
+ void playTalkSequence(int sequence);
+ void doTalkSequenceCommand(TalkSequenceCommand cmd);
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();
@@ -551,28 +618,17 @@ public:
void animation_3_1();
void animation_4_1();
//
- void animation_1_2();
void animation_2_2();
- void animation_3_2();
void animation_4_2();
void animation_5_2();
void animation_6_2();
void animation_7_2();
- void animation_8_2();
- void animation_9_2();
- void animation_10_2();
void animation_11_2();
void animation_12_2();
void animation_13_2();
void animation_14_2();
- void animation_15_2();
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();
void animation_23_joined2();
@@ -580,9 +636,7 @@ public:
void animation_25_2();
void animation_26_2();
void animation_27_2();
- void animation_28_2();
void animation_29_2();
- void animation_30_2();
void animation_31_2();
void animation_32_2();
void animation_33_2();
@@ -590,7 +644,6 @@ public:
void animation_35_2();
void animation_36_2();
//
- void animation_1_3();
void animation_2_3();
void animation_3_3();
void animation_4_3();
@@ -599,48 +652,22 @@ public:
void animation_ray();
//
void animation_1_4();
- void animation_2_4();
- void animation_3_4();
- void animation_4_4();
void animation_5_4();
void animation_6_4();
void animation_7_4();
void animation_8_4();
- void animation_9_4();
//
void animation_1_5();
- void animation_2_5();
- void animation_3_5();
- void animation_4_5();
void animation_5_5();
- void animation_6_5();
- void animation_7_5();
- void animation_8_5();
- void animation_9_5();
- void animation_10_5();
void animation_11_5();
void animation_12_5();
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();
void animation_9_6();
- 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();
void update_1_pre();
@@ -683,23 +710,24 @@ private:
int _roomPreUpdatesSize;
int _roomUpdatesSize;
int _roomActionsSize;
+ int _talkSequencesSize;
int _numLangs;
- char ***_text;
- char ***_textd;
- char ***_textb;
- char ***_textbj;
- char ***_texte;
- char ***_texti;
- char ***_textl;
- char ***_textp;
- char ***_textt;
- char ***_textvb;
- char ***_textsys;
- char ***_texthis;
- char ***_textverbs;
- char ***_textmisc;
- char ***_textd1;
+ char **_text;
+ char **_textd;
+ char **_textb;
+ char **_textbj;
+ char **_texte;
+ char **_texti;
+ char **_textl;
+ char **_textp;
+ char **_textt;
+ char **_textvb;
+ char **_textsys;
+ char **_texthis;
+ char **_textverbs;
+ char **_textmisc;
+ char **_textd1;
ItemLocation *_itemLocations;
int *_polX, *_polY;
int *_verbBarX;
@@ -709,9 +737,10 @@ private:
int *_pianistX, *_drunkX;
RoomUpdate *_roomPreUpdates, *_roomUpdates;
RoomTalkAction *_roomActions;
+ TalkSequenceCommand *_talkSequences;
- char ***loadTexts(Common::File &in);
- void freeTexts(char ***ptr);
+ char **loadTexts(Common::File &in);
+ void freeTexts(char **ptr);
};
} // End of namespace Drascula
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 67993bfb6c..de35de5ab2 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -47,6 +47,10 @@ void DrasculaEngine::allocMemory() {
assert(tableSurface);
extraSurface = (byte *)malloc(64000);
assert(extraSurface);
+ crosshairCursor = (byte *)malloc(40 * 25);
+ assert(crosshairCursor);
+ mouseCursor = (byte *)malloc(OBJWIDTH * OBJHEIGHT);
+ assert(mouseCursor);
}
void DrasculaEngine::freeMemory() {
@@ -58,10 +62,12 @@ void DrasculaEngine::freeMemory() {
free(drawSurface3);
free(extraSurface);
free(frontSurface);
+ free(crosshairCursor);
+ free(mouseCursor);
}
void DrasculaEngine::moveCursor() {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
moveCharacters();
@@ -78,14 +84,6 @@ void DrasculaEngine::moveCursor() {
showMenu();
else if (menuBar == 1)
clearMenu();
-
- int cursorPos[6] = { 0, 0, mouseX - 20, mouseY - 17, OBJWIDTH, OBJHEIGHT };
- copyRectClip(cursorPos, drawSurface3, screenSurface);
-}
-
-void DrasculaEngine::setCursorTable() {
- int cursorPos[6] = { 225, 56, mouseX - 20, mouseY - 12, 40, 25 };
- copyRectClip(cursorPos, tableSurface, screenSurface);
}
void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int colorCount) {
@@ -148,7 +146,15 @@ void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int
int height, byte *src, byte *dest) {
dest += xdes + ydes * 320;
src += xorg + yorg * 320;
+ /* Unoptimized code
for (int x = 0; x < height; x++) {
+ memcpy(dest + 320 * x, src + 320 * x, width);
+ } */
+
+ // A bit more optimized code, thanks to Fingolfin
+ // Uses 2 less registers and performs 2 less multiplications
+ int x = height;
+ while (x--) {
memcpy(dest, src, width);
dest += 320;
src += 320;
@@ -159,24 +165,7 @@ void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width,
int height, byte *src, byte *dest) {
int y, x;
- dest += xdes + ydes * 320;
- src += xorg + yorg * 320;
-
- for (y = 0; y < height; y++)
- for (x = 0; x < width; x++)
- if (src[x + y * 320] != 255)
- dest[x + y * 320] = src[x + y * 320];
-}
-
-void DrasculaEngine::copyRectClip(int *Array, byte *src, byte *dest) {
- int y, x;
- int xorg = Array[0];
- int yorg = Array[1];
- int xdes = Array[2];
- int ydes = Array[3];
- int width = Array[4];
- int height = Array[5];
-
+ //
if (ydes < 0) {
yorg += -ydes;
height += ydes;
@@ -191,6 +180,7 @@ void DrasculaEngine::copyRectClip(int *Array, byte *src, byte *dest) {
width -= (xdes + width) - 320;
if ((ydes + height) > 199)
height -= (ydes + height) - 200;
+ //
dest += xdes + ydes * 320;
src += xorg + yorg * 320;
@@ -202,16 +192,7 @@ void DrasculaEngine::copyRectClip(int *Array, byte *src, byte *dest) {
}
void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) {
- byte *ptr = VGA;
-
- ptr += xdes + ydes * 320;
- buffer += xorg + yorg * 320;
- for (int x = 0; x < height; x++) {
- memcpy(ptr, buffer, width);
- ptr += 320;
- buffer += 320;
- }
-
+ copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, VGA);
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
_system->updateScreen();
}
@@ -229,22 +210,22 @@ void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) {
letterX = _charMap[i].mappedChar;
switch (_charMap[i].charType) {
- case 0: // letters
- letterY = (_lang == kSpanish) ? 149 : 158;
- break;
- case 1: // signs
- letterY = (_lang == kSpanish) ? 160 : 169;
- break;
- case 2: // accented
- letterY = 180;
- break;
+ case 0: // letters
+ letterY = (_lang == kSpanish) ? 149 : 158;
+ break;
+ case 1: // signs
+ letterY = (_lang == kSpanish) ? 160 : 169;
+ break;
+ case 2: // accented
+ letterY = 180;
+ break;
} // switch
break;
} // if
} // for
- int textPos[6] = { letterX, letterY, screenX, screenY, CHAR_WIDTH, CHAR_HEIGHT };
- copyRectClip(textPos, textSurface, screenSurface);
+ copyRect(letterX, letterY, screenX, screenY,
+ CHAR_WIDTH, CHAR_HEIGHT, tableSurface, screenSurface);
screenX = screenX + CHAR_WIDTH;
if (screenX > 317) {
@@ -254,10 +235,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;
@@ -293,76 +276,70 @@ void DrasculaEngine::print_abc_opc(const char *said, int screenX, int screenY, i
} // if
} // for
- int textPos[6] = { letterX, letterY, screenX, screenY, CHAR_WIDTH_OPC, CHAR_HEIGHT_OPC };
- copyRectClip(textPos, backSurface, screenSurface);
+ copyRect(letterX, letterY, screenX, screenY,
+ CHAR_WIDTH_OPC, CHAR_HEIGHT_OPC, backSurface, screenSurface);
screenX = screenX + CHAR_WIDTH_OPC;
}
}
-void DrasculaEngine::centerText(const char *message, int textX, int textY) {
- char bb[200], m2[200], m1[200], mb[10][50];
- char m3[200];
- int h, fil, textX3, textX2, textX1, conta_f = 0, ya = 0;
-
- strcpy(m1, " ");
- strcpy(m2, " ");
- strcpy(m3, " ");
- strcpy(bb, " ");
-
- for (h = 0; h < 10; h++)
- strcpy(mb[h], " ");
-
- if (textX > 160)
- ya = 1;
-
- strcpy(m1, message);
- textX = CLIP<int>(textX, 60, 255);
-
- textX1 = textX;
-
- if (ya == 1)
- textX1 = 315 - textX;
-
- textX2 = (strlen(m1) / 2) * CHAR_WIDTH;
-
- while (true) {
- strcpy(bb, m1);
- scumm_strrev(bb);
-
- if (textX1 < textX2) {
- strcpy(m3, strrchr(m1, ' '));
- strcpy(m1, strstr(bb, " "));
- scumm_strrev(m1);
- m1[strlen(m1) - 1] = '\0';
- strcat(m3, m2);
- strcpy(m2, m3);
- };
-
- textX2 = (strlen(m1) / 2) * CHAR_WIDTH;
-
- if (textX1 < textX2)
- continue;
+bool DrasculaEngine::textFitsCentered(char *text, int x) {
+ int len = strlen(text);
+ int tmp = CLIP<int>(x - len * CHAR_WIDTH / 2, 60, 255);
+ return (tmp + len * CHAR_WIDTH) <= 320;
+}
- strcpy(mb[conta_f], m1);
+void DrasculaEngine::centerText(const char *message, int textX, int textY) {
+ char msg[200];
+ char messageLine[200];
+ char tmpMessageLine[200];
+ *messageLine = 0;
+ *tmpMessageLine = 0;
+ char *curWord;
+ int curLine = 0;
+ int x = 0;
+ // original starts printing 4 lines above textY
+ int y = CLIP<int>(textY - (4 * CHAR_HEIGHT), 0, 320);
- if (!strcmp(m2, ""))
- break;
+ strcpy(msg, message);
- scumm_strrev(m2);
- m2[strlen(m2) - 1] = '\0';
- scumm_strrev(m2);
- strcpy(m1, m2);
- strcpy(m2, "");
- conta_f++;
+ // If the message fits on screen as-is, just print it here
+ if (textFitsCentered(msg, textX)) {
+ x = CLIP<int>(textX - strlen(msg) * CHAR_WIDTH / 2, 60, 255);
+ print_abc(msg, x, y);
+ return;
}
- fil = textY - (((conta_f + 3) * CHAR_HEIGHT));
+ // Message doesn't fit on screen, split it
+
+ // Get a word from the message
+ curWord = strtok(msg, " ");
+ while (curWord != NULL) {
+ // Check if the word and the current line fit on screen
+ if (strlen(tmpMessageLine) > 0)
+ strcat(tmpMessageLine, " ");
+ strcat(tmpMessageLine, curWord);
+ if (textFitsCentered(tmpMessageLine, textX)) {
+ // Line fits, so add the word to the current message line
+ strcpy(messageLine, tmpMessageLine);
+ } else {
+ // Line doesn't fit, so show the current line on screen and
+ // create a new one
+ // If it goes off screen, print_abc will adjust it
+ x = CLIP<int>(textX - strlen(messageLine) * CHAR_WIDTH / 2, 60, 255);
+ print_abc(messageLine, x, y + curLine * CHAR_HEIGHT);
+ strcpy(messageLine, curWord);
+ strcpy(tmpMessageLine, curWord);
+ curLine++;
+ }
+
+ // Get next word
+ curWord = strtok(NULL, " ");
- for (h = 0; h < conta_f + 1; h++) {
- textX3 = strlen(mb[h]) / 2;
- print_abc(mb[h], ((textX) - textX3 * CHAR_WIDTH) - 1, fil);
- fil = fil + CHAR_HEIGHT + 2;
+ if (curWord == NULL) {
+ x = CLIP<int>(textX - strlen(messageLine) * CHAR_WIDTH / 2, 60, 255);
+ print_abc(messageLine, x, y + curLine * CHAR_HEIGHT);
+ }
}
}
@@ -375,6 +352,8 @@ void DrasculaEngine::screenSaver() {
int tempLine[320];
int tempRow[200];
+ hideCursor();
+
clearRoom();
loadPic("sv.alg", bgSurface, HALF_PAL);
@@ -463,6 +442,7 @@ void DrasculaEngine::screenSaver() {
free(ghost);
loadPic(roomNumber, bgSurface, HALF_PAL);
+ showCursor();
}
void DrasculaEngine::playFLI(const char *filefli, int vel) {
@@ -621,12 +601,11 @@ void DrasculaEngine::decodeRLE(byte* srcPtr, byte* dstPtr) {
pixel = *srcPtr++;
}
for (uint j = 0; j < repeat; j++) {
- curByte++;
- if (curByte > 64000) {
+ *dstPtr++ = pixel;
+ if (++curByte >= 64000) {
stopProcessing = true;
break;
}
- *dstPtr++ = pixel;
}
}
}
diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp
index 6e86788007..32f07fce73 100644
--- a/engines/drascula/interface.cpp
+++ b/engines/drascula/interface.cpp
@@ -24,9 +24,34 @@
*/
#include "drascula/drascula.h"
+#include "graphics/cursorman.h"
namespace Drascula {
+void DrasculaEngine::setCursor(int cursor) {
+ switch (cursor) {
+ case kCursorCrosshair:
+ CursorMan.replaceCursor((const byte *)crosshairCursor, 40, 25, 20, 17);
+ break;
+ case kCursorCurrentItem:
+ CursorMan.replaceCursor((const byte *)mouseCursor, OBJWIDTH, OBJHEIGHT, 20, 17);
+ default:
+ break;
+ }
+}
+
+void DrasculaEngine::showCursor() {
+ CursorMan.showMouse(true);
+}
+
+void DrasculaEngine::hideCursor() {
+ CursorMan.showMouse(false);
+}
+
+bool DrasculaEngine::isCursorVisible() {
+ return CursorMan.isVisible();
+}
+
void DrasculaEngine::selectVerbFromBar() {
for (int n = 0; n < 7; n++) {
if (mouseX > _verbBarX[n] && mouseX < _verbBarX[n + 1] && n > 0) {
@@ -36,7 +61,7 @@ void DrasculaEngine::selectVerbFromBar() {
}
// no verb selected
- withoutVerb();
+ selectVerb(0);
}
void DrasculaEngine::selectVerb(int verb) {
@@ -50,10 +75,17 @@ void DrasculaEngine::selectVerb(int verb) {
addObject(pickedObject);
}
- copyBackground(OBJWIDTH * verb, c, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3);
+ for (int i = 0; i < OBJHEIGHT; i++)
+ memcpy(mouseCursor + i * OBJWIDTH, backSurface + OBJWIDTH * verb + (c + i) * 320, OBJWIDTH);
+ setCursor(kCursorCurrentItem);
- takeObject = 1;
- pickedObject = verb;
+ if (verb > 0) {
+ takeObject = 1;
+ pickedObject = verb;
+ } else {
+ takeObject = 0;
+ hasName = 0;
+ }
}
bool DrasculaEngine::confirmExit() {
@@ -61,7 +93,7 @@ bool DrasculaEngine::confirmExit() {
color_abc(kColorRed);
updateRoom();
- centerText(_textsys[_lang][1], 160, 87);
+ centerText(_textsys[1], 160, 87);
updateScreen();
delay(100);
@@ -114,7 +146,8 @@ void DrasculaEngine::clearMenu() {
}
void DrasculaEngine::enterName() {
- Common::KeyCode key;
+ Common::KeyCode key, prevkey = Common::KEYCODE_INVALID;
+ int counter = 0;
int v = 0, h = 0;
char select2[23];
strcpy(select2, " ");
@@ -123,17 +156,25 @@ void DrasculaEngine::enterName() {
copyBackground(115, 14, 115, 14, 176, 9, bgSurface, screenSurface);
print_abc(select2, 117, 15);
updateScreen();
+ _system->delayMillis(100);
+
key = getScan();
- delay(70);
- if (key != 0) {
+
+ // Artifically decrease repeat rate.
+ // Part of bug fix#2017432 DRASCULA: Typing is slow when you save a game
+ // Alternative is to roll our own event loop
+ if (key == prevkey)
+ if (++counter == 3) {
+ counter = 0;
+ prevkey = Common::KEYCODE_INVALID;
+ }
+
+ if (key != 0 && key != prevkey) {
+ prevkey = key;
if (key >= 0 && key <= 0xFF && isalpha(key))
select2[v] = tolower(key);
- else if ((key == Common::KEYCODE_LCTRL) || (key == Common::KEYCODE_RCTRL))
- select2[v] = '\164';
- else if (key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9)
+ else if ((key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) || key == Common::KEYCODE_SPACE)
select2[v] = key;
- else if (key == Common::KEYCODE_SPACE)
- select2[v] = '\167';
else if (key == Common::KEYCODE_ESCAPE)
break;
else if (key == Common::KEYCODE_RETURN) {
@@ -185,25 +226,4 @@ void DrasculaEngine::showMap() {
}
}
-void DrasculaEngine::grr() {
- int length = 30;
-
- color_abc(kColorDarkGreen);
-
- playFile("s10.als");
-
- updateRoom();
- copyBackground(253, 110, 150, 65, 20, 30, drawSurface3, screenSurface);
-
- if (withVoices == 0)
- centerText("groaaarrrrgghhhh!", 153, 65);
-
- updateScreen();
-
- while (!isTalkFinished(&length));
-
- updateRoom();
- updateScreen();
-}
-
} // End of namespace Drascula
diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp
index 01967d975d..c9c99aafa8 100644
--- a/engines/drascula/objects.cpp
+++ b/engines/drascula/objects.cpp
@@ -51,7 +51,9 @@ void DrasculaEngine::chooseObject(int object) {
if (takeObject == 1 && menuScreen == 0)
addObject(pickedObject);
}
- copyBackground(_x1d_menu[object], _y1d_menu[object], 0, 0, OBJWIDTH,OBJHEIGHT, backSurface, drawSurface3);
+ for (int i = 0; i < OBJHEIGHT; i++)
+ memcpy(mouseCursor + i * OBJWIDTH, backSurface + _x1d_menu[object] + (_y1d_menu[object] + i) * 320, OBJWIDTH);
+ setCursor(kCursorCurrentItem);
takeObject = 1;
pickedObject = object;
}
@@ -70,23 +72,10 @@ int DrasculaEngine::removeObject(int obj) {
return result;
}
-void DrasculaEngine::withoutVerb() {
- int c = (menuScreen == 1) ? 0 : 171;
-
- if (currentChapter == 5) {
- if (takeObject == 1 && pickedObject != 16)
- addObject(pickedObject);
- } else {
- if (takeObject == 1)
- addObject(pickedObject);
- }
- copyBackground(0, c, 0, 0, OBJWIDTH,OBJHEIGHT, backSurface, drawSurface3);
-
- takeObject = 0;
- hasName = 0;
-}
-
void DrasculaEngine::gotoObject(int pointX, int pointY) {
+ bool cursorVisible = isCursorVisible();
+ hideCursor();
+
if (currentChapter == 5 || currentChapter == 6) {
if (hare_se_ve == 0) {
curX = roomX;
@@ -113,6 +102,9 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) {
}
updateRoom();
updateScreen();
+
+ if (cursorVisible)
+ showCursor();
}
void DrasculaEngine::checkObjects() {
@@ -186,7 +178,7 @@ bool DrasculaEngine::pickupObject() {
}
updateEvents();
if (takeObject == 0)
- withoutVerb();
+ selectVerb(0);
return false;
}
@@ -256,7 +248,7 @@ void DrasculaEngine::updateVisible() {
if (roomNumber == 22 && flags[27] == 1)
visible[3] = 0;
if (roomNumber == 26 && flags[21] == 0)
- strcpy(objName[2], _textmisc[_lang][0]);
+ strcpy(objName[2], _textmisc[0]);
if (roomNumber == 26 && flags[18] == 1)
visible[2] = 0;
if (roomNumber == 26 && flags[12] == 1)
diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp
index 6a93f21e55..ba174c9237 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];
@@ -127,64 +127,25 @@ void DrasculaEngine::fadeFromBlack(int fadeSpeed) {
}
}
-void DrasculaEngine::assignDefaultPalette() {
+void DrasculaEngine::assignPalette(DacPalette256 pal) {
int color, component;
for (color = 235; color < 253; color++)
for (component = 0; component < 3; component++)
- defaultPalette[color][component] = gamePalette[color][component];
-}
-
-void DrasculaEngine::assignBrightPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++) {
- for (component = 0; component < 3; component++)
- brightPalette[color][component] = gamePalette[color][component];
- }
-}
-
-void DrasculaEngine::assignDarkPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++) {
- for (component = 0; component < 3; component++)
- darkPalette[color][component] = gamePalette[color][component];
- }
+ pal[color][component] = gamePalette[color][component];
}
-void DrasculaEngine::setDefaultPalette() {
+void DrasculaEngine::setDefaultPalette(DacPalette256 pal) {
int color, component;
for (color = 235; color < 253; color++) {
for (component = 0; component < 3; component++) {
- gamePalette[color][component] = defaultPalette[color][component];
+ gamePalette[color][component] = pal[color][component];
}
}
setPalette((byte *)&gamePalette);
}
-void DrasculaEngine::setBrightPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++) {
- for (component = 0; component < 3; component++)
- gamePalette[color][component] = brightPalette[color][component];
- }
-
- setPalette((byte *)&gamePalette);
-}
-
-void DrasculaEngine::setDarkPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++ )
- for (component = 0; component < 3; component++)
- gamePalette[color][component] = darkPalette[color][component];
-
- setPalette((byte *)&gamePalette);
-}
-
void DrasculaEngine::setPaletteBase(int darkness) {
signed char fade;
unsigned int color, component;
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index 37dddf4b7e..027685f56a 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -29,6 +29,24 @@
namespace Drascula {
+struct doorInfo {
+ int chapter;
+ int doorNum;
+ int flag;
+};
+
+doorInfo doors[] = {
+ { 2, 138, 0 }, { 2, 136, 8 },
+ { 2, 156, 16 }, { 2, 163, 17 },
+ { 2, 177, 15 }, { 2, 175, 40 },
+ { 2, 173, 36 }, { 4, 103, 0 },
+ { 4, 104, 1 }, { 4, 105, 1 },
+ { 4, 106, 2 }, { 4, 107, 2 },
+ { 4, 110, 6 }, { 4, 114, 4 },
+ { 4, 115, 4 }, { 4, 117, 5 },
+ { 4, 120, 8 }, { 4, 122, 7 }
+};
+
typedef bool (DrasculaEngine::*RoomParser)(int args);
struct DrasculaRoomParser {
@@ -184,9 +202,9 @@ bool DrasculaEngine::room_3(int fl) {
if (pickedObject == kVerbTalk && fl == 129) {
talk(23);
pause(6);
- talk_sync(_text[_lang][50], "50.als", "11111111111144432554433");
+ talk_sync(_text[50], "50.als", "11111111111144432554433");
} else if (pickedObject == kVerbTalk && fl == 133) {
- talk_sync(_text[_lang][322], "322.als", "13333334125433333333");
+ talk_sync(_text[322], "322.als", "13333334125433333333");
updateRoom();
updateScreen();
pause(25);
@@ -248,11 +266,11 @@ bool DrasculaEngine::room_6(int fl) {
talk(41);
talk(42);
} else if (pickedObject == kVerbOpen && fl == 138)
- openDoor(0, 1);
+ toggleDoor(0, 1, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 138)
- closeDoor(0, 1);
+ toggleDoor(0, 1, kCloseDoor);
else if (pickedObject == kVerbOpen && fl == 143 && flags[2] == 0) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
copyRect(228, 102, curX + 5, curY - 1, 47, 73, drawSurface3, screenSurface);
updateScreen();
@@ -263,7 +281,7 @@ bool DrasculaEngine::room_6(int fl) {
updateScreen();
finishSound();
} else if (pickedObject == kVerbClose && fl == 143 && flags[2] == 1) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
flags[2] = 0;
updateRefresh_pre();
copyRect(228, 102, curX + 5, curY - 1, 47, 73, drawSurface3, screenSurface);
@@ -274,7 +292,7 @@ bool DrasculaEngine::room_6(int fl) {
updateScreen();
finishSound();
} else if (pickedObject == kVerbOpen && fl == 139 && flags[1] == 0) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
copyRect(267, 1, curX - 14, curY - 2, 52, 73, drawSurface3, screenSurface);
updateScreen();
@@ -287,7 +305,7 @@ bool DrasculaEngine::room_6(int fl) {
updateScreen();
finishSound();
} else if (pickedObject == kVerbPick && fl == 140) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
copyRect(267, 1, curX - 14, curY - 2, 52, 73, drawSurface3, screenSurface);
updateScreen();
@@ -350,9 +368,9 @@ bool DrasculaEngine::room_9(int fl) {
bool DrasculaEngine::room_12(int fl) {
if (pickedObject == kVerbOpen && fl == 156)
- openDoor(16, 4);
+ toggleDoor(16, 4, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 156)
- closeDoor(16, 4);
+ toggleDoor(16, 4, kCloseDoor);
else
hasAnswer = 0;
@@ -365,11 +383,14 @@ bool DrasculaEngine::room_13(int fl) {
trackProtagonist = 3;
talk(412);
strcpy(objName[1], "yoda");
- } else if (pickedObject == kVerbTalk && fl == 51)
+ } else if (pickedObject == kVerbTalk && fl == 51) {
converse(7);
- else if (pickedObject == 19 && fl == 51)
- animation_1_3();
- else if (pickedObject == 9 && fl == 51) {
+ } else if (pickedObject == 19 && fl == 51) {
+ talk(413);
+ grr();
+ pause(50);
+ talk(414);
+ } else if (pickedObject == 9 && fl == 51) {
animation_2_3();
return true;
} else
@@ -404,10 +425,10 @@ bool DrasculaEngine::room_15(int fl) {
talk(336);
trackProtagonist = 3;
talk(337);
- talk_sync(_text[_lang][46], "46.als", "4442444244244");
+ talk_sync(_text[46], "46.als", "4442444244244");
trackProtagonist = 1;
} else if (pickedObject == 18 && fl == 188 && flags[26] == 0) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
copyRect(133, 135, curX + 6, curY, 39, 63, drawSurface3, screenSurface);
updateScreen();
playSound(8);
@@ -432,17 +453,17 @@ bool DrasculaEngine::room_15(int fl) {
bool DrasculaEngine::room_16(int fl) {
if (pickedObject == kVerbOpen && fl == 163)
- openDoor(17, 0);
+ toggleDoor(17, 0, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 163)
- closeDoor(17, 0);
+ toggleDoor(17, 0, kCloseDoor);
else if (pickedObject == kVerbTalk && fl == 183) {
talk(341);
pause(10);
- talk_sync(_text[_lang][50], "50.als", "11111111111144432554433");
+ talk_sync(_text[50], "50.als", "11111111111144432554433");
pause(3);
- talk_baul(83);
+ talk_trunk(83);
} else if (pickedObject == kVerbOpen && fl == 183) {
- openDoor(19, NO_DOOR);
+ toggleDoor(19, NO_DOOR, kOpenDoor);
if (flags[20] == 0) {
flags[20] = 1;
trackProtagonist = 3;
@@ -452,7 +473,7 @@ bool DrasculaEngine::room_16(int fl) {
pickObject(22);
}
} else if (pickedObject == kVerbClose && fl == 183)
- closeDoor(19, NO_DOOR);
+ toggleDoor(19, NO_DOOR, kCloseDoor);
else if (pickedObject == kVerbLook && fl == 187) {
talk(343);
trackProtagonist = 3;
@@ -470,16 +491,18 @@ bool DrasculaEngine::room_17(int fl) {
talk(35);
else if (pickedObject == kVerbTalk && fl == 177 && flags[18] == 0)
talk(6);
- else if (pickedObject == kVerbTalk && fl == 177 && flags[18] == 1)
- animation_18_2();
- else if (pickedObject == kVerbOpen && fl == 177 && flags[18] == 1)
+ else if (pickedObject == kVerbTalk && fl == 177 && flags[18] == 1) {
+ talk(378);
+ talk_vonBraun(4, kVonBraunDoor);
+ converse(3);
+ } else if (pickedObject == kVerbOpen && fl == 177 && flags[18] == 1)
talk(346);
else if (pickedObject == kVerbOpen && fl == 177 && flags[14] == 0 && flags[18] == 0)
- animation_22_2();
+ playTalkSequence(22); // sequence 22, chapter 2
else if (pickedObject == kVerbOpen && fl == 177 && flags[14] == 1)
- openDoor(15, 1);
+ toggleDoor(15, 1, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 177 && flags[14] == 1)
- closeDoor(15, 1);
+ toggleDoor(15, 1, kCloseDoor);
else if (pickedObject == 11 && fl == 50 && flags[22] == 0) {
talk(347);
flags[29] = 1;
@@ -497,7 +520,7 @@ bool DrasculaEngine::room_18(int fl) {
else if (pickedObject == kVerbTalk && fl == 55 && flags[36] == 1)
talk(109);
else if (pickedObject == kVerbPick && fl == 182) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
copyRect(44, 1, curX, curY, 41, 70, drawSurface2, screenSurface);
updateRefresh();
@@ -519,7 +542,7 @@ bool DrasculaEngine::room_18(int fl) {
trackProtagonist = 3;
updateRoom();
updateScreen();
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
copyRect(1, 1, curX - 1, curY + 3, 42, 67, drawSurface2, screenSurface);
updateRefresh();
@@ -539,19 +562,20 @@ bool DrasculaEngine::room_21(int fl) {
if (pickedObject == kVerbOpen && fl == 101 && flags[28] == 0)
talk(419);
else if (pickedObject == kVerbOpen && fl == 101 && flags[28] == 1)
- openDoor(0, 1);
+ toggleDoor(0, 1, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 101)
- closeDoor(0, 1);
+ toggleDoor(0, 1, kCloseDoor);
else if(pickedObject == kVerbPick && fl == 141) {
pickObject(19);
visible[2] = 0;
flags[10] = 1;
} else if(pickedObject == 7 && fl == 101) {
flags[28] = 1;
- openDoor(0, 1);
- withoutVerb();
+ toggleDoor(0, 1, kOpenDoor);
+ selectVerb(0);
} else if (pickedObject == 21 && fl == 179) {
- animation_9_4();
+ animate("st.bin", 14);
+ fadeToBlack(1);
return true;
} else
hasAnswer = 0;
@@ -570,7 +594,7 @@ bool DrasculaEngine::room_22(int fl) {
playSound(1);
hiccup(14);
finishSound();
- withoutVerb();
+ selectVerb(0);
removeObject(22);
updateVisible();
trackProtagonist = 3;
@@ -590,15 +614,15 @@ bool DrasculaEngine::room_22(int fl) {
bool DrasculaEngine::room_23(int fl) {
if (pickedObject == kVerbOpen && fl == 103) {
- openDoor(0, 0);
+ toggleDoor(0, 0, kOpenDoor);
updateVisible();
} else if(pickedObject == kVerbClose && fl == 103) {
- closeDoor(0, 0);
+ toggleDoor(0, 0, kCloseDoor);
updateVisible();
} else if(pickedObject == kVerbOpen && fl == 104)
- openDoor(1, 1);
+ toggleDoor(1, 1, kOpenDoor);
else if(pickedObject == kVerbClose && fl == 104)
- closeDoor(1, 1);
+ toggleDoor(1, 1, kCloseDoor);
else if(pickedObject == kVerbPick && fl == 142) {
pickObject(8);
visible[2] = 0;
@@ -615,13 +639,13 @@ bool DrasculaEngine::room_23(int fl) {
bool DrasculaEngine::room_24(int fl) {
if (pickedObject == kVerbOpen && fl == 105)
- openDoor(1, 0);
+ toggleDoor(1, 0, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 105)
- closeDoor(1, 0);
+ toggleDoor(1, 0, kCloseDoor);
else if (pickedObject == kVerbOpen && fl == 106)
- openDoor(2, 1);
+ toggleDoor(2, 1, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 106)
- closeDoor(2, 1);
+ toggleDoor(2, 1, kCloseDoor);
else
hasAnswer = 0;
@@ -630,11 +654,11 @@ bool DrasculaEngine::room_24(int fl) {
bool DrasculaEngine::room_26(int fl) {
if (pickedObject == kVerbOpen && fl == 107 && flags[30] == 0)
- openDoor(2, 0);
+ toggleDoor(2, 0, kOpenDoor);
else if (pickedObject == kVerbOpen && fl == 107 && flags[30] == 1)
talk(421);
else if (pickedObject == kVerbClose && fl == 107)
- closeDoor(2, 0);
+ toggleDoor(2, 0, kCloseDoor);
else if (pickedObject == 10 && fl == 50 && flags[18] == 1 && flags[12] == 1)
animation_5_4();
else if (pickedObject == 8 && fl == 50 && flags[18] == 1 && flags[12] == 1)
@@ -648,7 +672,7 @@ bool DrasculaEngine::room_26(int fl) {
pickObject(10);
visible[1] = 0;
flags[12] = 1;
- closeDoor(2, 0);
+ toggleDoor(2, 0, kCloseDoor);
trackProtagonist = 2;
talk_igor(27, kIgorDoor);
flags[30] = 1;
@@ -671,17 +695,17 @@ bool DrasculaEngine::room_26(int fl) {
bool DrasculaEngine::room_27(int fl) {
if (pickedObject == kVerbOpen && fl == 110)
- openDoor(6, 1);
+ toggleDoor(6, 1, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 110)
- closeDoor(6, 1);
+ toggleDoor(6, 1, kCloseDoor);
else if (pickedObject == kVerbOpen && fl == 116 && flags[23] == 0)
talk(419);
else if (pickedObject == kVerbOpen && fl == 116 && flags[23] == 1)
- openDoor(5, 3);
+ toggleDoor(5, 3, kOpenDoor);
else if (pickedObject == 17 && fl == 116) {
flags[23] = 1;
- openDoor(5,3);
- withoutVerb();
+ toggleDoor(5, 3, kOpenDoor);
+ selectVerb(0);
} else if (fl == 150)
talk(460);
else
@@ -692,9 +716,9 @@ bool DrasculaEngine::room_27(int fl) {
bool DrasculaEngine::room_29(int fl) {
if (pickedObject == kVerbOpen && fl == 114)
- openDoor(4, 1);
+ toggleDoor(4, 1, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 114)
- closeDoor(4, 1);
+ toggleDoor(4, 1, kCloseDoor);
else
hasAnswer = 0;
@@ -703,15 +727,15 @@ bool DrasculaEngine::room_29(int fl) {
bool DrasculaEngine::room_30(int fl) {
if (pickedObject == kVerbOpen && fl == 115)
- openDoor(4, 0);
+ toggleDoor(4, 0, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 115)
- closeDoor(4, 0);
+ toggleDoor(4, 0, kCloseDoor);
else if (pickedObject == kVerbOpen && fl == 144 && flags[19] == 0)
talk(422);
else if (pickedObject == kVerbOpen && fl == 144 && flags[19] == 1 && flags[22] == 1)
- openDoor(16, 1);
+ toggleDoor(16, 1, kOpenDoor);
else if (pickedObject == kVerbOpen && fl == 144 && flags[19] == 1 && flags[22] == 0) {
- openDoor(16, 1);
+ toggleDoor(16, 1, kOpenDoor);
talk(423);
flags[22] = 1;
pickObject(12);
@@ -720,7 +744,7 @@ bool DrasculaEngine::room_30(int fl) {
if (flags[18] == 1)
animation_6_4();
} else if (pickedObject == kVerbClose && fl == 144)
- closeDoor(16, 1);
+ toggleDoor(16, 1, kCloseDoor);
else if (pickedObject == 13 && fl == 144) {
talk(424);
flags[19] = 1;
@@ -736,9 +760,9 @@ bool DrasculaEngine::room_31(int fl) {
visible[1] = 0;
flags[13] = 1;
} else if (pickedObject == kVerbOpen && fl == 117)
- openDoor(5, 0);
+ toggleDoor(5, 0, kOpenDoor);
else if (pickedObject == kVerbClose && fl == 117)
- closeDoor(5, 0);
+ toggleDoor(5, 0, kCloseDoor);
else
hasAnswer = 0;
@@ -749,15 +773,15 @@ bool DrasculaEngine::room_34(int fl) {
if (pickedObject == kVerbMove && fl == 146)
animation_8_4();
else if (pickedObject == kVerbOpen && fl == 120 && flags[25] == 1)
- openDoor(8, 2);
+ toggleDoor(8, 2, kOpenDoor);
else if (pickedObject == kVerbOpen && fl == 120 && flags[25] == 0) {
- openDoor(8, 2);
+ toggleDoor(8, 2, kOpenDoor);
trackProtagonist = 3;
talk(425);
pickObject(14);
flags[25] = 1;
} else if (pickedObject == kVerbClose && fl == 120)
- closeDoor(8, 2);
+ toggleDoor(8, 2, kCloseDoor);
else
hasAnswer=0;
@@ -805,20 +829,27 @@ bool DrasculaEngine::room_53(int fl) {
if (pickedObject == kVerbPick && fl == 120) {
pickObject(16);
visible[3] = 0;
- } else if (pickedObject == kVerbMove && fl == 123)
+ } else if (pickedObject == kVerbMove && fl == 123) {
animation_11_5();
- else if (pickedObject == 12 && fl == 52)
- animation_10_5();
- else if (pickedObject == 15 && fl == 52)
- animation_9_5();
- else if (pickedObject == 16 && fl == 121) {
+ } else if (pickedObject == 12 && fl == 52) {
+ flags[3] = 1;
+ talk(401);
+ selectVerb(0);
+ removeObject(12);
+ } else if (pickedObject == 15 && fl == 52) {
+ flags[4] = 1;
+ talk(401);
+ selectVerb(0);
+ removeObject(15);
+ } else if (pickedObject == 16 && fl == 121) {
flags[2] = 1;
- withoutVerb();
+ selectVerb(0);
updateVisible();
+ pickedObject = kVerbMove;
} else if (pickedObject == 16) {
- talk(439);
- withoutVerb();
+ // Wall plug in chapter 5
visible[3] = 1;
+ hasAnswer = 0;
} else
hasAnswer = 0;
@@ -851,7 +882,7 @@ bool DrasculaEngine::room_54(int fl) {
} else if (pickedObject == 10 && fl == 119) {
pause(4);
talk(436);
- withoutVerb();
+ selectVerb(0);
removeObject(10);
} else
hasAnswer = 0;
@@ -886,10 +917,12 @@ bool DrasculaEngine::room_56(int fl) {
}
bool DrasculaEngine::room_58(int fl) {
- if (pickedObject == kVerbMove && fl == 103)
- animation_7_6();
- else
+ if (pickedObject == kVerbMove && fl == 103) {
+ flags[8] = 1;
+ updateVisible();
+ } else {
hasAnswer = 0;
+ }
return true;
}
@@ -933,19 +966,19 @@ bool DrasculaEngine::room_59(int fl) {
talk_htel(240);
color_abc(kColorBrown);
- talk_solo(_textvb[_lang][58], "VB58.als");
+ talk_solo(_textvb[58], "VB58.als");
talk_htel(241);
color_abc(kColorBrown);
- talk_solo(_textvb[_lang][59], "VB59.als");
+ talk_solo(_textvb[59], "VB59.als");
talk_htel(242);
color_abc(kColorBrown);
- talk_solo(_textvb[_lang][60], "VB60.als");
+ talk_solo(_textvb[60], "VB60.als");
talk_htel(196);
color_abc(kColorBrown);
- talk_solo(_textvb[_lang][61],"VB61.als");
+ talk_solo(_textvb[61],"VB61.als");
talk_htel(244);
color_abc(kColorBrown);
- talk_solo(_textvb[_lang][62], "VB62.als");
+ talk_solo(_textvb[62], "VB62.als");
clearRoom();
loadPic("aux59.alg", drawSurface3);
loadPic(96, frontSurface, COMPLETE_PAL);
@@ -953,7 +986,7 @@ bool DrasculaEngine::room_59(int fl) {
loadPic(59, bgSurface, HALF_PAL);
trackProtagonist = 3;
talk(245);
- withoutVerb();
+ selectVerb(0);
flags[11] = 1;
}
} else
@@ -963,17 +996,27 @@ bool DrasculaEngine::room_59(int fl) {
}
bool DrasculaEngine::room_60(int fl) {
- if (pickedObject == kVerbMove && fl == 112)
- animation_10_6();
- else if (pickedObject == kVerbTalk && fl == 52) {
+ if (pickedObject == kVerbMove && fl == 112) {
+ playSound(14);
+ copyBackground();
+ updateRefresh_pre();
+ copyBackground(164, 85, 155, 48, 113, 114, drawSurface3, screenSurface);
+ updateScreen();
+ finishSound();
+ talk_bartender(23, 1);
+ flags[7] = 1;
+ } else if (pickedObject == kVerbTalk && fl == 52) {
talk(266);
talk_bartender(1, 1);
converse(12);
- withoutVerb();
+ selectVerb(0);
pickedObject = 0;
- } else if (pickedObject == 21 && fl == 56)
- animation_18_6();
- else if (pickedObject == 9 && fl == 56 && flags[6] == 1) {
+ } else if (pickedObject == 21 && fl == 56) {
+ flags[6] = 1;
+ selectVerb(0);
+ removeObject(21);
+ animate("beb.bin", 10);
+ } else if (pickedObject == 9 && fl == 56 && flags[6] == 1) {
animation_9_6();
return true;
} else if (pickedObject == 9 && fl == 56 && flags[6] == 0) {
@@ -1089,11 +1132,9 @@ void DrasculaEngine::updateRefresh_pre() {
void DrasculaEngine::update_1_pre() {
if (curX > 98 && curX < 153) {
- changeColor = 1;
- setDarkPalette();
+ setDefaultPalette(darkPalette);
} else {
- changeColor = 0;
- setBrightPalette();
+ setDefaultPalette(brightPalette);
}
if (flags[8] == 0)
@@ -1101,8 +1142,8 @@ void DrasculaEngine::update_1_pre() {
}
void DrasculaEngine::update_2() {
- int batPos[6];
int difference;
+ int w, h;
int batX[] = {0, 38, 76, 114, 152, 190, 228, 266,
0, 38, 76, 114, 152, 190, 228, 266,
0, 38, 76, 114, 152, 190,
@@ -1122,24 +1163,19 @@ void DrasculaEngine::update_2() {
if (actorFrames[kFrameBat] == 41)
actorFrames[kFrameBat] = 0;
- batPos[0] = batX[actorFrames[kFrameBat]];
- batPos[1] = batY[actorFrames[kFrameBat]];
-
if (actorFrames[kFrameBat] < 22) {
- batPos[4] = 37;
- batPos[5] = 21;
+ w = 37;
+ h = 21;
} else if (actorFrames[kFrameBat] > 27) {
- batPos[4] = 57;
- batPos[5] = 36;
+ w = 57;
+ h = 36;
} else {
- batPos[4] = 47;
- batPos[5] = 22;
+ w = 47;
+ h = 22;
}
- batPos[2] = 239;
- batPos[3] = 19;
-
- copyRectClip(batPos, drawSurface3, screenSurface);
+ copyRect(batX[actorFrames[kFrameBat]], batY[actorFrames[kFrameBat]],
+ 239, 19, w, h, drawSurface3, screenSurface);
difference = getTime() - savedTime;
if (difference >= 6) {
actorFrames[kFrameBat]++;
@@ -1158,22 +1194,18 @@ void DrasculaEngine::update_3() {
void DrasculaEngine::update_4() {
if (curX > 190) {
- changeColor = 1;
- setDarkPalette();
+ setDefaultPalette(darkPalette);
} else {
- changeColor = 0;
- setBrightPalette();
+ setDefaultPalette(brightPalette);
}
}
void DrasculaEngine::update_6_pre() {
if ((curX > 149 && curY + curHeight > 160 && curX < 220 && curY + curHeight < 188) ||
(curX > 75 && curY + curHeight > 183 && curX < 145)) {
- changeColor = 0;
- setBrightPalette();
+ setDefaultPalette(brightPalette);
} else {
- changeColor = 1;
- setDarkPalette();
+ setDefaultPalette(darkPalette);
}
}
@@ -1463,6 +1495,7 @@ void DrasculaEngine::update_102() {
}
bool DrasculaEngine::checkAction(int fl) {
+ hideCursor();
characterMoved = 0;
updateRoom();
updateScreen();
@@ -1481,7 +1514,7 @@ bool DrasculaEngine::checkAction(int fl) {
|| (pickedObject == kVerbOpen && fl == 22 && flags[23] == 0)) {
talk(164);
flags[23] = 1;
- withoutVerb();
+ selectVerb(0);
addObject(kItemMoney);
addObject(kItemTwoCoins);
} else if (pickedObject == kVerbLook && fl == 22 && flags[23] == 1)
@@ -1492,7 +1525,7 @@ bool DrasculaEngine::checkAction(int fl) {
hasAnswer = 0;
} else if (currentChapter == 4) {
if ((pickedObject == 18 && fl == 19) || (pickedObject == 19 && fl == 18)) {
- withoutVerb();
+ selectVerb(0);
chooseObject(21);
removeObject(18);
removeObject(19);
@@ -1504,13 +1537,7 @@ bool DrasculaEngine::checkAction(int fl) {
talk(495);
} else
hasAnswer = 0;
- } else if (currentChapter == 5) {
- if (pickedObject == kVerbLook && fl == 9) {
- talk(482);
- talk(483);
- } else
- hasAnswer = 0;
- } else if (currentChapter == 6) {
+ } else if (currentChapter == 5 || currentChapter == 6) {
if (pickedObject == kVerbLook && fl == 9) {
talk(482);
talk(483);
@@ -1528,8 +1555,10 @@ bool DrasculaEngine::checkAction(int fl) {
hasAnswer = 0;
} else if (currentChapter == 3) {
if (roomNumber == 13) {
- if (room(13, fl))
+ if (room(13, fl)) {
+ showCursor();
return true;
+ }
} else
hasAnswer = 0;
} else if (currentChapter == 4) {
@@ -1540,14 +1569,18 @@ bool DrasculaEngine::checkAction(int fl) {
else if (pickedObject == 12 && fl == 50 && flags[18] == 0)
talk(487);
else if (roomNumber == 21) {
- if (room(21, fl))
+ if (room(21, fl)) {
+ showCursor();
return true;
+ }
} else
hasAnswer = 0;
} else if (currentChapter == 5) {
if (roomNumber == 56) {
- if (room(56, fl))
+ if (room(56, fl)) {
+ showCursor();
return true;
+ }
} else
hasAnswer = 0;
} else if (currentChapter == 6) {
@@ -1558,8 +1591,10 @@ bool DrasculaEngine::checkAction(int fl) {
else if (roomNumber == 102)
room(102, fl);
else if (roomNumber == 60) {
- if (room(60, fl))
+ if (room(60, fl)) {
+ showCursor();
return true;
+ }
}
else
hasAnswer = 0;
@@ -1575,6 +1610,7 @@ bool DrasculaEngine::checkAction(int fl) {
if (hasAnswer == 0 && (hasName == 1 || menuScreen == 1))
room(0, -1);
+ showCursor();
return false;
}
@@ -1600,6 +1636,7 @@ bool DrasculaEngine::room(int rN, int fl) {
void DrasculaEngine::enterRoom(int roomIndex) {
debug(2, "Entering room %d", roomIndex);
+ showCursor();
char fileName[20];
sprintf(fileName, "%d.ald", roomIndex);
@@ -1661,7 +1698,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
getIntFromLine(buffer, size, &_destX[l]);
getIntFromLine(buffer, size, &_destY[l]);
getIntFromLine(buffer, size, &trackCharacter_alkeva[l]);
- getIntFromLine(buffer, size, &alapuertakeva[l]);
+ getIntFromLine(buffer, size, &roomExits[l]);
updateDoor(l);
}
}
@@ -1716,16 +1753,15 @@ void DrasculaEngine::enterRoom(int roomIndex) {
copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3);
- setDefaultPalette();
+ setDefaultPalette(defaultPalette);
if (palLevel != 0)
setPaletteBase(palLevel);
- assignBrightPalette();
- setDefaultPalette();
+ assignPalette(brightPalette);
+ setDefaultPalette(defaultPalette);
setPaletteBase(palLevel + 2);
- assignDarkPalette();
+ assignPalette(darkPalette);
- setBrightPalette();
- changeColor = -1;
+ setDefaultPalette(brightPalette);
if (currentChapter == 2)
color_abc(kColorLightGreen);
@@ -1821,8 +1857,9 @@ void DrasculaEngine::enterRoom(int roomIndex) {
if (currentChapter == 5) {
if (roomNumber == 45)
hare_se_ve = 0;
- if (roomNumber == 49 && flags[7] == 0)
- animation_4_5();
+ if (roomNumber == 49 && flags[7] == 0) {
+ playTalkSequence(4); // sequence 4, chapter 5
+ }
}
updateRoom();
@@ -1830,7 +1867,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
void DrasculaEngine::clearRoom() {
memset(VGA, 0, 64000);
- _system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+ _system->clearScreen();
_system->updateScreen();
}
@@ -1839,49 +1876,50 @@ bool DrasculaEngine::exitRoom(int l) {
int roomNum = 0;
- if (currentChapter == 1) {
- if (objectNum[l] == 105 && flags[0] == 0)
- talk(442);
- else {
- updateDoor(l);
- if (isDoor[l] != 0) {
- gotoObject(roomObjX[l], roomObjY[l]);
- trackProtagonist = trackObj[l];
- updateRoom();
- updateScreen();
- characterMoved = 0;
- trackProtagonist = trackCharacter_alkeva[l];
- objExit = alapuertakeva[l];
- doBreak = 1;
- previousMusic = roomMusic;
-
- if (objectNum[l] == 105) {
- animation_2_1();
- return true;
- }
- clearRoom();
- sscanf(_targetSurface[l], "%d", &roomNum);
- curX = -1;
- enterRoom(roomNum);
- }
+ // Player can't exit the inn in chapter 1
+ if (currentChapter == 1 && objectNum[l] == 104) {
+ return false;
+ }
+
+ if (currentChapter == 1 && objectNum[l] == 105 && flags[0] == 0) {
+ talk(442);
+ return false;
+ }
+
+ updateDoor(l);
+ if (isDoor[l] != 0 &&
+ ((currentChapter != 3 && currentChapter != 5) || visible[l] == 1)) {
+
+ hideCursor();
+ gotoObject(roomObjX[l], roomObjY[l]);
+ if (currentChapter != 2) {
+ trackProtagonist = trackObj[l];
+ updateRoom();
+ updateScreen();
}
- } else if (currentChapter == 2) {
- updateDoor(l);
- if (isDoor[l] != 0) {
- gotoObject(roomObjX[l], roomObjY[l]);
- characterMoved = 0;
- trackProtagonist = trackCharacter_alkeva[l];
- objExit = alapuertakeva[l];
- doBreak = 1;
- previousMusic = roomMusic;
+ characterMoved = 0;
+ trackProtagonist = trackCharacter_alkeva[l];
+ objExit = roomExits[l];
+ doBreak = 1;
+ previousMusic = roomMusic;
+
+ // Object specific actions
+ if (currentChapter == 1 && objectNum[l] == 105) {
+ animation_2_1();
+ return true;
+ } else if (currentChapter == 2) {
if (objectNum[l] == 136)
animation_2_2();
- if (objectNum[l] == 124)
- animation_3_2();
+ if (objectNum[l] == 124) {
+ gotoObject(163, 106);
+ gotoObject(287, 101);
+ trackProtagonist = 0;
+ }
if (objectNum[l] == 173) {
animation_35_2();
return true;
- } if (objectNum[l] == 146 && flags[39] == 1) {
+ }
+ if (objectNum[l] == 146 && flags[39] == 1) {
flags[5] = 1;
flags[11] = 1;
}
@@ -1890,93 +1928,27 @@ bool DrasculaEngine::exitRoom(int l) {
removeObject(kItemEarWithEarPlug);
addObject(kItemEarplugs);
}
- clearRoom();
- sscanf(_targetSurface[l], "%d", &roomNum);
- curX =- 1;
- enterRoom(roomNum);
- }
- } else if (currentChapter == 3) {
- updateDoor(l);
- if (isDoor[l] != 0 && visible[l] == 1) {
- gotoObject(roomObjX[l], roomObjY[l]);
- trackProtagonist = trackObj[l];
- updateRoom();
- updateScreen();
- characterMoved = 0;
- trackProtagonist = trackCharacter_alkeva[l];
- objExit = alapuertakeva[l];
- doBreak = 1;
- previousMusic = roomMusic;
- clearRoom();
- sscanf(_targetSurface[l], "%d", &roomNum);
- curX =- 1;
- enterRoom(roomNum);
- }
- } else if (currentChapter == 4) {
- updateDoor(l);
- if (isDoor[l] != 0) {
- gotoObject(roomObjX[l], roomObjY[l]);
- trackProtagonist = trackObj[l];
- updateRoom();
- updateScreen();
- characterMoved = 0;
- trackProtagonist = trackCharacter_alkeva[l];
- objExit = alapuertakeva[l];
- doBreak = 1;
- previousMusic = roomMusic;
-
- if (objectNum[l] == 108)
- gotoObject(171, 78);
- clearRoom();
- sscanf(_targetSurface[l], "%d", &roomNum);
- curX = -1;
- enterRoom(roomNum);
+ } else if (currentChapter == 4 && objectNum[l] == 108) {
+ gotoObject(171, 78);
}
- } else if (currentChapter == 5) {
- updateDoor(l);
- if (isDoor[l] != 0 && visible[l] == 1) {
- gotoObject(roomObjX[l], roomObjY[l]);
- trackProtagonist = trackObj[l];
- updateRoom();
- updateScreen();
- characterMoved = 0;
- trackProtagonist = trackCharacter_alkeva[l];
- objExit = alapuertakeva[l];
- doBreak = 1;
- previousMusic = roomMusic;
+
+ if (currentChapter == 5)
hare_se_ve = 1;
- clearRoom();
- sscanf(_targetSurface[l], "%d", &roomNum);
- curX = -1;
- enterRoom(roomNum);
- }
- } else if (currentChapter == 6) {
- updateDoor(l);
- if (isDoor[l] != 0) {
- gotoObject(roomObjX[l], roomObjY[l]);
- trackProtagonist = trackObj[l];
- updateRoom();
- updateScreen();
- characterMoved = 0;
- trackProtagonist = trackCharacter_alkeva[l];
- objExit = alapuertakeva[l];
- doBreak = 1;
- previousMusic = roomMusic;
- clearRoom();
- sscanf(_targetSurface[l], "%d", &roomNum);
- curX = -1;
- enterRoom(roomNum);
- if (objExit == 105)
- animation_19_6();
- }
+ clearRoom();
+ sscanf(_targetSurface[l], "%d", &roomNum);
+ curX = -1;
+ enterRoom(roomNum);
+
+ if (currentChapter == 6 && objExit == 105)
+ animation_19_6();
}
return false;
}
void DrasculaEngine::updateRoom() {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
if (currentChapter == 3) {
if (flags[0] == 0)
@@ -1990,67 +1962,41 @@ void DrasculaEngine::updateRoom() {
}
void DrasculaEngine::updateDoor(int doorNum) {
- if (currentChapter == 1 || currentChapter == 3 || currentChapter == 5 || currentChapter == 6)
+ if (currentChapter != 2 && currentChapter != 4)
return;
- else if (currentChapter == 2) {
- if (objectNum[doorNum] == 138)
- isDoor[doorNum] = flags[0];
- else if (objectNum[doorNum] == 136)
- isDoor[doorNum] = flags[8];
- else if (objectNum[doorNum] == 156)
- isDoor[doorNum] = flags[16];
- else if (objectNum[doorNum] == 163)
- isDoor[doorNum] = flags[17];
- else if (objectNum[doorNum] == 177)
- isDoor[doorNum] = flags[15];
- else if (objectNum[doorNum] == 175)
- isDoor[doorNum] = flags[40];
- else if (objectNum[doorNum] == 173)
- isDoor[doorNum] = flags[36];
- } else if (currentChapter == 4) {
+
+ for (int i = 0; i < ARRAYSIZE(doors); i++) {
+ if (doors[i].chapter == currentChapter &&
+ objectNum[doorNum] == doors[i].doorNum) {
+ isDoor[doorNum] = flags[doors[i].flag];
+ return;
+ }
+ }
+
+ if (currentChapter == 4) {
if (objectNum[doorNum] == 101 && flags[0] == 0)
isDoor[doorNum] = 0;
else if (objectNum[doorNum] == 101 && flags[0] == 1 && flags[28] == 1)
isDoor[doorNum] = 1;
- else if (objectNum[doorNum] == 103)
- isDoor[doorNum] = flags[0];
- else if (objectNum[doorNum] == 104)
- isDoor[doorNum] = flags[1];
- else if (objectNum[doorNum] == 105)
- isDoor[doorNum] = flags[1];
- else if (objectNum[doorNum] == 106)
- isDoor[doorNum] = flags[2];
- else if (objectNum[doorNum] == 107)
- isDoor[doorNum] = flags[2];
- else if (objectNum[doorNum] == 110)
- isDoor[doorNum] = flags[6];
- else if (objectNum[doorNum] == 114)
- isDoor[doorNum] = flags[4];
- else if (objectNum[doorNum] == 115)
- isDoor[doorNum] = flags[4];
else if (objectNum[doorNum] == 116 && flags[5] == 0)
isDoor[doorNum] = 0;
else if (objectNum[doorNum] == 116 && flags[5] == 1 && flags[23] == 1)
isDoor[doorNum] = 1;
- else if (objectNum[doorNum] == 117)
- isDoor[doorNum] = flags[5];
- else if (objectNum[doorNum] == 120)
- isDoor[doorNum] = flags[8];
- else if (objectNum[doorNum] == 122)
- isDoor[doorNum] = flags[7];
}
}
-void DrasculaEngine::openDoor(int nflag, int doorNum) {
- if (flags[nflag] == 0) {
- if (currentChapter == 1 /*|| currentChapter == 4*/) {
- if (nflag != 7) {
- playSound(3);
- flags[nflag] = 1;
- }
- } else {
+void DrasculaEngine::toggleDoor(int nflag, int doorNum, int action) {
+ if ((flags[nflag] == 0 && action == kOpenDoor) ||
+ (flags[nflag] == 1 && action == kCloseDoor)) {
+ if (currentChapter == 1 && nflag == 7 && action == kOpenDoor)
+ return;
+
+ if (action == kOpenDoor) {
playSound(3);
flags[nflag] = 1;
+ } else {
+ playSound(4);
+ flags[nflag] = 0;
}
if (doorNum != NO_DOOR)
@@ -2058,20 +2004,7 @@ void DrasculaEngine::openDoor(int nflag, int doorNum) {
updateRoom();
updateScreen();
finishSound();
- withoutVerb();
- }
-}
-
-void DrasculaEngine::closeDoor(int nflag, int doorNum) {
- if (flags[nflag] == 1) {
- playSound(4);
- flags[nflag] = 0;
- if (doorNum != NO_DOOR)
- updateDoor(doorNum);
- updateRoom();
- updateScreen();
- finishSound();
- withoutVerb();
+ selectVerb(0);
}
}
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp
index de82899462..503d2ab639 100644
--- a/engines/drascula/saveload.cpp
+++ b/engines/drascula/saveload.cpp
@@ -50,7 +50,7 @@ bool DrasculaEngine::saveLoadScreen() {
}
}
for (n = 0; n < NUM_SAVES; n++)
- sav->readLine(names[n], 23);
+ sav->readLine_OLD(names[n], 23);
delete sav;
loadPic("savescr.alg", bgSurface, HALF_PAL);
@@ -59,15 +59,17 @@ bool DrasculaEngine::saveLoadScreen() {
select[0] = 0;
+ _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
+ setCursor(kCursorCrosshair);
+
for (;;) {
y = 27;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
for (n = 0; n < NUM_SAVES; n++) {
print_abc(names[n], 116, y);
y = y + 9;
}
print_abc(select, 117, 15);
- setCursorTable();
updateScreen();
y = 27;
@@ -140,8 +142,10 @@ bool DrasculaEngine::saveLoadScreen() {
}
if (mouseX > 125 && mouseY > 123 && mouseX < 199 && mouseY < 149 && selectionMade == 1) {
- if (!loadGame(file))
+ if (!loadGame(file)) {
+ _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
return false;
+ }
break;
} else if (mouseX > 208 && mouseY > 123 && mouseX < 282 && mouseY < 149 && selectionMade == 1) {
saveGame(file);
@@ -168,10 +172,14 @@ bool DrasculaEngine::saveLoadScreen() {
delay(5);
}
+ selectVerb(0);
+
clearRoom();
loadPic(roomNumber, bgSurface, HALF_PAL);
selectionMade = 0;
+ _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
+
return true;
}
@@ -192,7 +200,7 @@ bool DrasculaEngine::loadGame(const char *gameName) {
if (savedChapter != currentChapter) {
strcpy(saveName, gameName);
currentChapter = savedChapter - 1;
- hay_que_load = 1;
+ loadedDifferentChapter = 1;
return false;
}
sav->read(currentData, 20);
@@ -210,10 +218,10 @@ bool DrasculaEngine::loadGame(const char *gameName) {
takeObject = sav->readSint32LE();
pickedObject = sav->readSint32LE();
- hay_que_load = 0;
+ loadedDifferentChapter = 0;
sscanf(currentData, "%d.ald", &roomNum);
enterRoom(roomNum);
- withoutVerb();
+ selectVerb(0);
return true;
}
@@ -247,9 +255,6 @@ void DrasculaEngine::saveGame(char gameName[]) {
warning("Can't write file '%s'. (Disk full?)", gameName);
delete out;
-
- playSound(99);
- finishSound();
}
} // End of namespace Drascula
diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp
index 840d6c7cb5..6a3d83cae6 100644
--- a/engines/drascula/sound.cpp
+++ b/engines/drascula/sound.cpp
@@ -23,6 +23,10 @@
*
*/
+#include "sound/mixer.h"
+#include "sound/voc.h"
+#include "sound/audiocd.h"
+
#include "drascula/drascula.h"
namespace Drascula {
@@ -37,25 +41,31 @@ void DrasculaEngine::updateVolume(Audio::Mixer::SoundType soundType, int prevVol
}
void DrasculaEngine::volumeControls() {
- int masterVolume, voiceVolume, musicVolume;
+ if (_lang == kSpanish)
+ loadPic(95, tableSurface);
copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface);
updateScreen(73, 63, 73, 63, 177, 97, screenSurface);
- masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4);
- voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4);
- musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4);
+ setCursor(kCursorCrosshair);
+ showCursor();
for (;;) {
+ int masterVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16), 0, 15);
+ int voiceVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16), 0, 15);
+ int musicVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16), 0, 15);
+
+ int masterVolumeY = 72 + 61 - masterVolume * 4;
+ int voiceVolumeY = 72 + 61 - voiceVolume * 4;
+ int musicVolumeY = 72 + 61 - musicVolume * 4;
+
updateRoom();
copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface);
- copyBackground(183, 56, 82, masterVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4), tableSurface, screenSurface);
- copyBackground(183, 56, 138, voiceVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4), tableSurface, screenSurface);
- copyBackground(183, 56, 194, musicVolume, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4), tableSurface, screenSurface);
-
- setCursorTable();
+ copyBackground(183, 56, 82, masterVolumeY, 39, 2 + masterVolume * 4, tableSurface, screenSurface);
+ copyBackground(183, 56, 138, voiceVolumeY, 39, 2 + voiceVolume * 4, tableSurface, screenSurface);
+ copyBackground(183, 56, 194, musicVolumeY, 39, 2 + musicVolume * 4, tableSurface, screenSurface);
updateScreen();
@@ -68,23 +78,25 @@ void DrasculaEngine::volumeControls() {
if (leftMouseButton == 1) {
delay(100);
if (mouseX > 80 && mouseX < 121) {
- updateVolume(Audio::Mixer::kPlainSoundType, mouseY);
- masterVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4);
+ updateVolume(Audio::Mixer::kPlainSoundType, masterVolumeY);
}
if (mouseX > 136 && mouseX < 178) {
- updateVolume(Audio::Mixer::kSFXSoundType, mouseY);
- voiceVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4);
+ updateVolume(Audio::Mixer::kSFXSoundType, voiceVolumeY);
}
if (mouseX > 192 && mouseX < 233) {
- updateVolume(Audio::Mixer::kMusicSoundType, mouseY);
- musicVolume = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4);
+ updateVolume(Audio::Mixer::kMusicSoundType, musicVolumeY);
}
}
}
+ if (_lang == kSpanish)
+ loadPic(974, tableSurface);
+
+ selectVerb(0);
+
updateEvents();
}
@@ -111,6 +123,10 @@ void DrasculaEngine::stopMusic() {
AudioCD.stop();
}
+void DrasculaEngine::updateMusic() {
+ AudioCD.updateCD();
+}
+
int DrasculaEngine::musicStatus() {
return AudioCD.isPlaying();
}
@@ -142,7 +158,18 @@ void DrasculaEngine::playFile(const char *fname) {
if (_arj.open(fname)) {
int soundSize = _arj.size();
byte *soundData = (byte *)malloc(soundSize);
- _arj.seek(32);
+
+ if (!(!strcmp(fname, "3.als") && soundSize == 145166 && _lang != kSpanish)) {
+ _arj.seek(32);
+ } else {
+ // WORKAROUND: File 3.als with English speech files has a big silence at
+ // its beginning and end. We seek past the silence at the beginning,
+ // and ignore the silence at the end
+ // Fixes bug #2111815 - "DRASCULA: Voice delayed"
+ _arj.seek(73959, SEEK_SET);
+ soundSize = 117158 - 73959;
+ }
+
_arj.read(soundData, soundSize);
_arj.close();
diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp
index a89c5ff734..7bf55b7c40 100644
--- a/engines/drascula/talk.cpp
+++ b/engines/drascula/talk.cpp
@@ -36,9 +36,8 @@ void DrasculaEngine::talkInit(const char *filename) {
playFile(filename);
}
-bool DrasculaEngine::isTalkFinished(int* length) {
- byte key = getScan();
- if (key != 0)
+bool DrasculaEngine::isTalkFinished() {
+ if (getScan() != 0)
stopSound();
if (soundIsActive())
return false;
@@ -55,13 +54,12 @@ bool DrasculaEngine::isTalkFinished(int* length) {
void DrasculaEngine::talk_igor(int index, int talkerType) {
char filename[20];
sprintf(filename, "I%i.als", index);
- const char *said = _texti[_lang][index];
+ const char *said = _texti[index];
int x_talk0[8] = { 56, 82, 108, 134, 160, 186, 212, 238 };
int x_talk1[8] = { 56, 86, 116, 146, 176, 206, 236, 266 };
int x_talk3[4] = { 80, 102, 124, 146 };
int x_talk4[4] = { 119, 158, 197, 236 };
int face = 0;
- int length = strlen(said);
color_abc(kColorWhite);
@@ -70,11 +68,11 @@ void DrasculaEngine::talk_igor(int index, int talkerType) {
do {
if (talkerType == kIgorDch || talkerType == kIgorFront) {
face = _rnd->getRandomNumber(7);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
} else if (talkerType == kIgorSeated || talkerType == kIgorWig) {
face = _rnd->getRandomNumber(3);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
}
@@ -119,7 +117,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) {
updateScreen();
pause(3);
}
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
if ((talkerType == kIgorFront && currentChapter == 6) ||
talkerType == kIgorDoor || talkerType == kIgorSeated || talkerType == kIgorWig) {
@@ -127,7 +125,7 @@ void DrasculaEngine::talk_igor(int index, int talkerType) {
}
if (talkerType == kIgorDch || (talkerType == kIgorFront && currentChapter == 1)) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
placeIgor();
placeDrascula();
}
@@ -136,12 +134,11 @@ void DrasculaEngine::talk_igor(int index, int talkerType) {
// Talker type 0: talk_dr_izq, 1: talk_dr_dch
void DrasculaEngine::talk_drascula(int index, int talkerType) {
- const char *said = _textd[_lang][index];
+ const char *said = _textd[index];
char filename[20];
sprintf(filename, "d%i.als", index);
int x_talk[8] = { 1, 40, 79, 118, 157, 196, 235, 274 };
int face;
- int length = strlen(said);
int offset = (talkerType == 0) ? 0 : 7;
int offset2 = (talkerType == 0) ? 90 : 58;
@@ -152,7 +149,7 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) {
do {
face = _rnd->getRandomNumber(7);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
@@ -176,10 +173,10 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) {
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
if (talkerType == 0)
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
if (talkerType == 1 && currentChapter == 6)
updateRoom();
@@ -193,8 +190,41 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) {
updateScreen();
}
+void DrasculaEngine::talk_drascula_big(int index) {
+ char filename[20];
+ sprintf(filename, "d%i.als", index);
+ const char *said = _textd[index];
+ int x_talk[4] = {47, 93, 139, 185};
+ int face;
+ int l = 0;
+
+ color_abc(kColorRed);
+
+ talkInit(filename);
+
+ do {
+ face = _rnd->getRandomNumber(3);
+ copyBackground();
+ copyBackground(interf_x[l] + 24, interf_y[l], 0, 45, 39, 31, drawSurface2, screenSurface);
+ copyBackground(x_talk[face], 1, 171, 68, 45, 48, drawSurface2, screenSurface);
+ l++;
+ if (l == 7)
+ l = 0;
+
+ if (withVoices == 0)
+ centerText(said, 191, 69);
+
+ updateScreen();
+
+ pause(3);
+
+ byte key = getScan();
+ if (key == Common::KEYCODE_ESCAPE)
+ term_int = 1;
+ } while (!isTalkFinished());
+}
+
void DrasculaEngine::talk_solo(const char *said, const char *filename) {
- int length = strlen(said);
if (currentChapter == 1)
color_abc(color_solo);
@@ -204,7 +234,7 @@ void DrasculaEngine::talk_solo(const char *said, const char *filename) {
talkInit(filename);
if (currentChapter == 6)
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
do {
if (withVoices == 0) {
@@ -216,10 +246,10 @@ void DrasculaEngine::talk_solo(const char *said, const char *filename) {
centerText(said, 173, 92);
}
updateScreen();
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
if (currentChapter == 6) {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
}
}
@@ -231,15 +261,14 @@ void DrasculaEngine::talk_bartender(int index, int talkerType) {
// Line 82 is a special case
if (index != 82)
- said = _textt[_lang][index];
+ said = _textt[index];
else {
sprintf(filename, "d%i.als", index);
- said = _textd[_lang][index];
+ said = _textd[index];
}
int x_talk[9] = { 1, 23, 45, 67, 89, 111, 133, 155, 177 };
int face;
- int length = strlen(said);
color_abc(kColorMaroon);
@@ -260,7 +289,7 @@ void DrasculaEngine::talk_bartender(int index, int talkerType) {
face = _rnd->getRandomNumber(5);
}
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
@@ -277,7 +306,7 @@ void DrasculaEngine::talk_bartender(int index, int talkerType) {
updateScreen();
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
updateRoom();
updateScreen();
@@ -286,10 +315,9 @@ void DrasculaEngine::talk_bartender(int index, int talkerType) {
void DrasculaEngine::talk_bj(int index) {
char filename[20];
sprintf(filename, "BJ%i.als", index);
- const char *said = _textbj[_lang][index];
+ const char *said = _textbj[index];
int x_talk[5] = { 64, 92, 120, 148, 176 };
int face;
- int length = strlen(said);
color_abc(kColorWhite);
@@ -299,7 +327,7 @@ void DrasculaEngine::talk_bj(int index) {
if (currentChapter != 5) {
face = _rnd->getRandomNumber(4);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
@@ -325,7 +353,7 @@ void DrasculaEngine::talk_bj(int index) {
updateScreen();
}
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
updateRoom();
updateScreen();
@@ -334,7 +362,7 @@ void DrasculaEngine::talk_bj(int index) {
void DrasculaEngine::talk(int index) {
char name[20];
sprintf(name, "%i.als", index);
- talk(_text[_lang][index], name);
+ talk(_text[index], name);
}
void DrasculaEngine::talk(const char *said, const char *filename) {
@@ -344,7 +372,6 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
int y_mask_talk = 170;
int face;
- int length = strlen(said);
if (currentChapter == 6) {
if (flags[0] == 0 && roomNumber == 102) {
@@ -375,7 +402,7 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
do {
face = _rnd->getRandomNumber(5);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
if (currentChapter == 2)
@@ -442,7 +469,7 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
updateScreen();
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
updateRoom();
updateScreen();
@@ -456,7 +483,7 @@ void DrasculaEngine::talk(const char *said, const char *filename) {
void DrasculaEngine::talk_pianist(int index) {
char filename[20];
sprintf(filename, "P%i.als", index);
- const char* said = _textp[_lang][index];
+ const char* said = _textp[index];
int x_talk[4] = { 97, 145, 193, 241 };
int coords[7] = { 139, 228, 112, 47, 60, 221, 128 };
@@ -467,7 +494,7 @@ void DrasculaEngine::talk_pianist(int index) {
void DrasculaEngine::talk_drunk(int index) {
char filename[20];
sprintf(filename, "B%i.als", index);
- const char *said = _textb[_lang][index];
+ const char *said = _textb[index];
int x_talk[8] = { 1, 21, 41, 61, 81, 101, 121, 141 };
int coords[7] = { 29, 177, 50, 19, 19, 181, 54 };
@@ -498,13 +525,15 @@ void DrasculaEngine::talk_drunk(int index) {
}
}
-void DrasculaEngine::talk_vonBraun(int index) {
+// talker types:
+// 0: kVonBraunNormal
+// 1: KVonBraunDoor
+void DrasculaEngine::talk_vonBraun(int index, int talkerType) {
char filename[20];
sprintf(filename, "VB%i.als", index);
- const char *said = _textvb[_lang][index];
+ const char *said = _textvb[index];
int x_talk[6] = {1, 27, 53, 79, 105, 131};
int face;
- int length = strlen(said);
color_abc(kColorBrown);
@@ -513,50 +542,33 @@ void DrasculaEngine::talk_vonBraun(int index) {
copyBackground(vonBraunX + 5, 64, OBJWIDTH + 1, 0, 25, 27, bgSurface, drawSurface3);
do {
- if (trackVonBraun == 1) {
- face = _rnd->getRandomNumber(5);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
-
- moveCharacters();
- moveVonBraun();
+ if (talkerType == kVonBraunNormal) {
+ if (trackVonBraun == 1) {
+ face = _rnd->getRandomNumber(5);
+ copyBackground();
- copyBackground(OBJWIDTH + 1, 0, vonBraunX + 5, 64, 25, 27, drawSurface3, screenSurface);
- copyRect(x_talk[face], 34, vonBraunX + 5, 64, 25, 27, frontSurface, screenSurface);
- updateRefresh();
- }
+ moveCharacters();
+ moveVonBraun();
- if (withVoices == 0)
- centerText(said, vonBraunX, 66);
-
- updateScreen();
-
- pause(3);
- } while (!isTalkFinished(&length));
-
- updateRoom();
- updateScreen();
- if (musicStatus() == 0 && flags[11] == 0 && roomMusic != 0)
- playMusic(roomMusic);
-}
-
-void DrasculaEngine::talk_vonBraunpuerta(int index) {
- char filename[20];
- sprintf(filename, "VB%i.als", index);
- const char *said = _textvb[_lang][index];
- int length = strlen(said);
-
- color_abc(kColorBrown);
+ copyBackground(OBJWIDTH + 1, 0, vonBraunX + 5, 64, 25, 27, drawSurface3, screenSurface);
+ copyRect(x_talk[face], 34, vonBraunX + 5, 64, 25, 27, frontSurface, screenSurface);
+ updateRefresh();
+ }
- talkInit(filename);
+ if (withVoices == 0)
+ centerText(said, vonBraunX, 66);
- do {
- updateRoom();
+ updateScreen();
+ pause(3);
+ } else {
+ updateRoom();
- if (withVoices == 0)
- centerText(said, 150, 80);
+ if (withVoices == 0)
+ centerText(said, 150, 80);
- updateScreen();
- } while (!isTalkFinished(&length));
+ updateScreen();
+ }
+ } while (!isTalkFinished());
updateRoom();
updateScreen();
@@ -570,60 +582,56 @@ void DrasculaEngine::talk_blind(int index) {
// voice files start from 58, not 1
char filename[20];
sprintf(filename, "d%i.als", index + TEXTD_START - 1);
- const char *said = _textd[_lang][index + TEXTD_START - 1];
- const char *syncChar = _textd1[_lang][index - 1];
+ const char *said = _textd[index + TEXTD_START - 1];
+ const char *syncChar = _textd1[index - 1];
- byte *faceBuffer;
int p = 0;
- int pos_blind[6] = { 0, 2, 73, 1, 126, 149 };
- int length = strlen(said);
+ int bX = 0;
+ int h = 149;
color_abc(kColorBrown);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
talkInit(filename);
do {
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
- pos_blind[5] = 149;
+ copyBackground();
+ h = 149;
char c = toupper(syncChar[p]);
if (c == '0' || c == '2' || c == '4' || c == '6')
- pos_blind[0] = 1;
+ bX = 1;
else
- pos_blind[0] = 132;
+ bX = 132;
if (c == '0' || c == '1')
- faceBuffer = drawSurface3;
+ copyRect(bX, 2, 73, 1, 126, h, drawSurface3, screenSurface);
else if (c == '2' || c == '3')
- faceBuffer = extraSurface;
+ copyRect(bX, 2, 73, 1, 126, h, extraSurface, screenSurface);
else if (c == '4' || c == '5')
- faceBuffer = backSurface;
+ copyRect(bX, 2, 73, 1, 126, h, backSurface, screenSurface);
else {
- faceBuffer = frontSurface;
- pos_blind[5] = 146;
+ h = 146;
+ copyRect(bX, 2, 73, 1, 126, h, frontSurface, screenSurface);
}
- copyRectClip( pos_blind, faceBuffer, screenSurface);
-
if (withVoices == 0)
- centerText(said, 310, 71);
+ centerText(said, 260, 71);
updateScreen();
pause(2);
p++;
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
}
void DrasculaEngine::talk_hacker(int index) {
char filename[20];
sprintf(filename, "d%i.als", index);
- const char *said = _textd[_lang][index];
- int length = strlen(said);
+ const char *said = _textd[index];
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
color_abc(kColorYellow);
@@ -634,13 +642,13 @@ void DrasculaEngine::talk_hacker(int index) {
if (withVoices == 0)
centerText(said, 156, 170);
updateScreen();
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
}
void DrasculaEngine::talk_werewolf(int index) {
char filename[20];
sprintf(filename, "L%i.als", index);
- const char *said = _textl[_lang][index];
+ const char *said = _textl[index];
int x_talk[9] = {52, 79, 106, 133, 160, 187, 214, 241, 268};
int coords[7] = { 136, 198, 81, 26, 24, 203, 78 };
@@ -651,7 +659,7 @@ void DrasculaEngine::talk_werewolf(int index) {
void DrasculaEngine::talk_mus(int index) {
char filename[20];
sprintf(filename, "E%i.als", index);
- const char *said = _texte[_lang][index];
+ const char *said = _texte[index];
int x_talk[8] = { 16, 35, 54, 73, 92, 111, 130, 149};
int coords[7] = { 156, 190, 64, 18, 24, 197, 64 };
@@ -663,7 +671,6 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker
int x_talk[8] = {112, 138, 164, 190, 216, 242, 268, 294};
int x_talk2[5] = {122, 148, 174, 200, 226};
int face;
- int length = strlen(said);
flags[1] = 1;
@@ -683,7 +690,7 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker
else
face = _rnd->getRandomNumber(4);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
if (talkerType == 0)
@@ -703,10 +710,10 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker
updateScreen();
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
flags[1] = 0;
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
updateScreen();
}
@@ -714,10 +721,9 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker
void DrasculaEngine::talk_bj_bed(int index) {
char filename[20];
sprintf(filename, "BJ%i.als", index);
- const char *said = _textbj[_lang][index];
+ const char *said = _textbj[index];
int x_talk[5] = {51, 101, 151, 201, 251};
int face;
- int length = strlen(said);
color_abc(kColorWhite);
@@ -726,7 +732,7 @@ void DrasculaEngine::talk_bj_bed(int index) {
do {
face = _rnd->getRandomNumber(4);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
@@ -741,7 +747,7 @@ void DrasculaEngine::talk_bj_bed(int index) {
updateScreen();
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
updateRoom();
updateScreen();
@@ -750,11 +756,9 @@ void DrasculaEngine::talk_bj_bed(int index) {
void DrasculaEngine::talk_htel(int index) {
char filename[20];
sprintf(filename, "%i.als", index);
- const char *said = _text[_lang][index];
- char *faceBuffer;
+ const char *said = _text[index];
int x_talk[3] = {1, 94, 187};
int face, curScreen;
- int length = strlen(said);
color_abc(kColorYellow);
@@ -764,25 +768,23 @@ void DrasculaEngine::talk_htel(int index) {
face = _rnd->getRandomNumber(2);
curScreen = _rnd->getRandomNumber(2);
+ copyBackground();
+
if (face == 0 && curScreen == 0)
- faceBuffer = (char *)drawSurface3;
+ copyBackground(x_talk[face], 1, 45, 24, 92, 108, drawSurface3, screenSurface);
else if (curScreen == 1)
- faceBuffer = (char *)frontSurface;
+ copyBackground(x_talk[face], 1, 45, 24, 92, 108, frontSurface, screenSurface);
else
- faceBuffer = (char *)backSurface;
-
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
-
- copyBackground(x_talk[face], 1, 45, 24, 92, 108, (byte *)faceBuffer, screenSurface);
-
+ copyBackground(x_talk[face], 1, 45, 24, 92, 108, backSurface, screenSurface);
+
if (withVoices == 0)
centerText(said, 90, 50);
updateScreen();
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateScreen();
}
@@ -790,7 +792,6 @@ void DrasculaEngine::talk_sync(const char *said, const char *filename, const cha
int talkOffset = 1;
int y_mask_talk = 170;
int p, face = 0;
- int length = strlen(said);
char buf[2];
color_abc(kColorYellow);
@@ -808,7 +809,7 @@ void DrasculaEngine::talk_sync(const char *said, const char *filename, const cha
strncpy(buf, &syncChar[p], 1);
face = atoi(buf);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
if (currentChapter == 2)
@@ -863,7 +864,7 @@ void DrasculaEngine::talk_sync(const char *said, const char *filename, const cha
p++;
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
if (currentChapter == 1 && musicStatus() == 0 && flags[11] == 0)
playMusic(roomMusic);
@@ -871,12 +872,11 @@ void DrasculaEngine::talk_sync(const char *said, const char *filename, const cha
playMusic(roomMusic);
}
-void DrasculaEngine::talk_baul(int index) {
+void DrasculaEngine::talk_trunk(int index) {
char filename[20];
sprintf(filename, "d%i.als", index);
- const char *said = _text[_lang][index];
+ const char *said = _text[index];
int face = 0, cara_antes;
- int length = strlen(said);
cara_antes = flags[19];
@@ -896,57 +896,21 @@ void DrasculaEngine::talk_baul(int index) {
updateScreen();
pause(4);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
flags[19] = cara_antes;
updateRoom();
updateScreen();
}
-void DrasculaEngine::talk_dr_grande(int index) {
- char filename[20];
- sprintf(filename, "D%i.als", index);
- const char *said = _textd[_lang][index];
- int x_talk[4] = {47, 93, 139, 185};
- int face;
- int l = 0;
- int length = strlen(said);
-
- color_abc(kColorRed);
-
- talkInit(filename);
-
- do {
- face = _rnd->getRandomNumber(3);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
- copyBackground(interf_x[l] + 24, interf_y[l], 0, 45, 39, 31, drawSurface2, screenSurface);
- copyBackground(x_talk[face], 1, 171, 68, 45, 48, drawSurface2, screenSurface);
- l++;
- if (l == 7)
- l = 0;
-
- if (withVoices == 0)
- centerText(said, 191, 69);
-
- updateScreen();
-
- pause(3);
-
- byte key = getScan();
- if (key == Common::KEYCODE_ESCAPE)
- term_int = 1;
- } while (!isTalkFinished(&length));
-}
-
void DrasculaEngine::talk_generic(const char* said, const char* filename, int* faces, int faceCount, int* coords, byte* surface) {
int face;
- int length = strlen(said);
talkInit(filename);
do {
face = _rnd->getRandomNumber(faceCount - 1);
- copyBackground(0, 0, 0, 0, 320, 200, bgSurface, screenSurface);
+ copyBackground();
updateRefresh_pre();
copyBackground(faces[face], coords[0], coords[1], coords[2],
coords[3], coords[4], surface, screenSurface);
@@ -959,7 +923,27 @@ void DrasculaEngine::talk_generic(const char* said, const char* filename, int* f
updateScreen();
pause(3);
- } while (!isTalkFinished(&length));
+ } while (!isTalkFinished());
+
+ updateRoom();
+ updateScreen();
+}
+
+
+void DrasculaEngine::grr() {
+ color_abc(kColorDarkGreen);
+
+ playFile("s10.als");
+
+ updateRoom();
+ copyBackground(253, 110, 150, 65, 20, 30, drawSurface3, screenSurface);
+
+ if (withVoices == 0)
+ centerText("groaaarrrrgghhhh!", 153, 65);
+
+ updateScreen();
+
+ while (!isTalkFinished());
updateRoom();
updateScreen();