diff options
author | Alejandro Marzini | 2010-07-13 04:31:15 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-13 04:31:15 +0000 |
commit | 609e08d5dbae3179eddf981abe73d69009432de4 (patch) | |
tree | cddbd0a0e69eaa53b85f98f96dc410a307773f08 /engines/drascula | |
parent | 8b6a670391f1b5103e3761d78eef8f41d64cf8cd (diff) | |
parent | 03c0faa5d76f547603ee6389cdf958e2a6f0f43d (diff) | |
download | scummvm-rg350-609e08d5dbae3179eddf981abe73d69009432de4.tar.gz scummvm-rg350-609e08d5dbae3179eddf981abe73d69009432de4.tar.bz2 scummvm-rg350-609e08d5dbae3179eddf981abe73d69009432de4.zip |
Merged from trunk, from Rev 49499 to HEAD
svn-id: r50840
Diffstat (limited to 'engines/drascula')
-rw-r--r-- | engines/drascula/actors.cpp | 3 | ||||
-rw-r--r-- | engines/drascula/animation.cpp | 142 | ||||
-rw-r--r-- | engines/drascula/console.cpp | 63 | ||||
-rw-r--r-- | engines/drascula/console.h | 51 | ||||
-rw-r--r-- | engines/drascula/converse.cpp | 10 | ||||
-rw-r--r-- | engines/drascula/detection.cpp | 6 | ||||
-rw-r--r-- | engines/drascula/drascula.cpp | 47 | ||||
-rw-r--r-- | engines/drascula/drascula.h | 5 | ||||
-rw-r--r-- | engines/drascula/graphics.cpp | 25 | ||||
-rw-r--r-- | engines/drascula/interface.cpp | 8 | ||||
-rw-r--r-- | engines/drascula/module.mk | 1 | ||||
-rw-r--r-- | engines/drascula/objects.cpp | 3 | ||||
-rw-r--r-- | engines/drascula/palette.cpp | 4 | ||||
-rw-r--r-- | engines/drascula/rooms.cpp | 4 | ||||
-rw-r--r-- | engines/drascula/talk.cpp | 39 |
15 files changed, 369 insertions, 42 deletions
diff --git a/engines/drascula/actors.cpp b/engines/drascula/actors.cpp index ff46d8201a..33cb7fd478 100644 --- a/engines/drascula/actors.cpp +++ b/engines/drascula/actors.cpp @@ -77,6 +77,7 @@ void DrasculaEngine::hiccup(int counter) { do { counter--; + updateEvents(); updateRoom(); if (currentChapter == 3) updateScreen(0, 0, 0, y, 320, 200, screenSurface); @@ -99,6 +100,7 @@ void DrasculaEngine::hiccup(int counter) { if (y == 0) trackCharacter = 0; } + pause(3); } while (counter > 0); updateRoom(); @@ -449,6 +451,7 @@ void DrasculaEngine::placeVonBraun(int pointX) { vonBraunHasMoved = 1; for (;;) { + updateEvents(); updateRoom(); updateScreen(); if (trackVonBraun == 0) { diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index e4bd844d75..d6a3bafd9f 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -32,17 +32,23 @@ void DrasculaEngine::updateAnim(int y, int destX, int destY, int width, int heig for (int n = 0; n < count; n++){ x++; - copyBackground(x, y, destX, destY, width, height, src, screenSurface); - if (copyRectangle) + if (copyRectangle) { + copyBackground(destX, destY, destX, destY, width, height, bgSurface, screenSurface); copyRect(x, y, destX, destY, width, height, src, screenSurface); + } else { + copyBackground(x, y, destX, destY, width, height, src, screenSurface); + } updateScreen(destX, destY, destX, destY, width, height, screenSurface); x += width; + updateEvents(); pause(delayVal); } } // This is the game's introduction sequence void DrasculaEngine::animation_1_1() { + debug(4, "animation_1_1()"); + int l, l2, p; //int pixelPos[6]; @@ -141,9 +147,9 @@ void DrasculaEngine::animation_1_1() { copyBackground(0, 0, 320 - l, 0, l, 200, drawSurface3, screenSurface); copyBackground(l, 0, 0, 0, 320 - l, 200, bgSurface, screenSurface); - copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31, - drawSurface2, screenSurface); + copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31, drawSurface2, screenSurface); updateScreen(); + updateEvents(); p++; if (p == 6) { p = 0; @@ -371,6 +377,8 @@ void DrasculaEngine::animation_1_1() { // John falls in love with BJ, who is then abducted by Drascula void DrasculaEngine::animation_2_1() { + debug(4, "animation_2_1()"); + int l; gotoObject(231, 91); @@ -560,6 +568,8 @@ void DrasculaEngine::animation_2_1() { // John Hacker talks with the bartender to book a room void DrasculaEngine::animation_3_1() { + debug(4, "animation_3_1()"); + loadPic("an11y13.alg", extraSurface); playTalkSequence(3); // sequence 3, chapter 1 @@ -569,6 +579,8 @@ void DrasculaEngine::animation_3_1() { // John Hacker talks with the pianist void DrasculaEngine::animation_4_1() { + debug(4, "animation_4_1()"); + loadPic("an12.alg", extraSurface); talk(205); @@ -605,6 +617,8 @@ void DrasculaEngine::animation_4_1() { } void DrasculaEngine::animation_2_2() { + debug(4, "animation_2_2()"); + trackProtagonist = 0; copyBackground(); moveCharacters(); @@ -640,6 +654,8 @@ void DrasculaEngine::animation_2_2() { } void DrasculaEngine::animation_4_2() { + debug(4, "animation_4_2()"); + stopMusic(); flags[9] = 1; @@ -704,6 +720,8 @@ void DrasculaEngine::animation_4_2() { } void DrasculaEngine::animation_14_2() { + debug(4, "animation_14_2()"); + int cY = -160; int l = 0; @@ -735,6 +753,8 @@ void DrasculaEngine::animation_14_2() { // The drunk tells us about Von Braun void DrasculaEngine::animation_16_2() { + debug(4, "animation_16_2()"); + char curPic[20]; talk_drunk(12); talk(371); @@ -812,6 +832,8 @@ asco: } void DrasculaEngine::animation_20_2() { + debug(4, "animation_20_2()"); + talk_vonBraun(7, kVonBraunDoor); talk_vonBraun(8, kVonBraunDoor); talk(383); @@ -842,6 +864,8 @@ void DrasculaEngine::animation_20_2() { } void DrasculaEngine::animation_23_2() { + debug(4, "animation_23_2()"); + loadPic("an24.alg", frontSurface); flags[21] = 1; @@ -897,6 +921,8 @@ void DrasculaEngine::animation_23_2() { } void DrasculaEngine::animation_23_joined() { + debug(4, "animation_23_joined()"); + int p_x = curX + 2, p_y = curY - 3; int x[] = {1, 38, 75, 112, 75, 112, 75, 112, 149, 112, 149, 112, 149, 186, 223, 260, 1, 38, 75, 112, 149, 112, 149, 112, 149, 112, 149, 186, 223, 260, 260, 260, 260, 223}; @@ -910,6 +936,7 @@ void DrasculaEngine::animation_23_joined() { copyRect(x[n], y[n], p_x, p_y, 36, 74, backSurface, screenSurface); updateRefresh(); updateScreen(p_x, p_y, p_x, p_y, 36, 74, screenSurface); + updateEvents(); pause(5); } @@ -917,6 +944,8 @@ void DrasculaEngine::animation_23_joined() { } void DrasculaEngine::animation_23_joined2() { + debug(4, "animation_23_joined2()"); + int p_x = curX + 4, p_y = curY; int x[] = {1, 35, 69, 103, 137, 171, 205, 239, 273, 1, 35, 69, 103, 137}; int y[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 73, 73, 73, 73, 73}; @@ -930,6 +959,7 @@ void DrasculaEngine::animation_23_joined2() { copyRect(x[n], y[n], p_x, p_y, 33, 71, backSurface, screenSurface); updateRefresh(); updateScreen(p_x,p_y, p_x,p_y, 33,71, screenSurface); + updateEvents(); pause(5); } @@ -937,6 +967,8 @@ void DrasculaEngine::animation_23_joined2() { } void DrasculaEngine::animation_25_2() { + debug(4, "animation_25_2()"); + int cY = 0; loadPic("an14_2.alg", backSurface); @@ -959,6 +991,7 @@ void DrasculaEngine::animation_25_2() { updateRefresh(); updateScreen(); + updateEvents(); } finishSound(); @@ -967,6 +1000,8 @@ void DrasculaEngine::animation_25_2() { } void DrasculaEngine::animation_27_2() { + debug(4, "animation_27_2()"); + flags[22] = 1; selectVerb(kVerbNone); @@ -986,6 +1021,8 @@ void DrasculaEngine::animation_27_2() { } void DrasculaEngine::animation_29_2() { + debug(4, "animation_29_2()"); + if (flags[33] == 0) { playTalkSequence(29); // sequence 29, chapter 2 } else @@ -1002,6 +1039,8 @@ void DrasculaEngine::animation_29_2() { } void DrasculaEngine::animation_31_2() { + debug(4, "animation_31_2()"); + talk_vonBraun(44, kVonBraunNormal); placeVonBraun(-50); pause(15); @@ -1020,6 +1059,8 @@ void DrasculaEngine::animation_31_2() { } void DrasculaEngine::animation_35_2() { + debug(4, "animation_35_2()"); + gotoObject(96, 165); gotoObject(79, 165); @@ -1049,7 +1090,10 @@ void DrasculaEngine::animation_35_2() { fadeToBlack(2); } +// Use cross on Yoda void DrasculaEngine::animation_2_3() { + debug(4, "animation_2_3()"); + flags[0] = 1; playMusic(13); animation_3_3(); @@ -1070,6 +1114,8 @@ void DrasculaEngine::animation_2_3() { } void DrasculaEngine::animation_3_3() { + debug(4, "animation_3_3()"); + int px = curX - 20, py = curY - 1; loadPic("an2y_1.alg", frontSurface); @@ -1085,6 +1131,8 @@ void DrasculaEngine::animation_3_3() { } void DrasculaEngine::animation_4_3() { + debug(4, "animation_4_3()"); + int px = 120, py = 63; loadPic("any_1.alg", frontSurface); @@ -1100,6 +1148,8 @@ void DrasculaEngine::animation_4_3() { } void DrasculaEngine::animation_5_3() { + debug(4, "animation_5_3()"); + int px = curX - 20, py = curY - 1; loadPic("an3y_1.alg", frontSurface); @@ -1115,6 +1165,8 @@ void DrasculaEngine::animation_5_3() { } void DrasculaEngine::animation_6_3() { + debug(4, "animation_6_3()"); + int frame = 0, px = 112, py = 62; int yoda_x[] = { 3 ,82, 161, 240, 3, 82 }; int yoda_y[] = { 3, 3, 3, 3, 94, 94 }; @@ -1133,6 +1185,7 @@ void DrasculaEngine::animation_6_3() { copyBackground(); copyRect(yoda_x[frame], yoda_y[frame], px, py, 78, 90, frontSurface, screenSurface); updateScreen(px, py, px, py, 78, 90, screenSurface); + updateEvents(); } flags[2] = 1; @@ -1144,6 +1197,8 @@ void DrasculaEngine::animation_6_3() { } void DrasculaEngine::animation_ray() { + debug(4, "animation_ray()"); + loadPic("anr_1.alg", frontSurface, HALF_PAL); loadPic("anr_2.alg", extraSurface); loadPic("anr_3.alg", backSurface); @@ -1171,6 +1226,8 @@ void DrasculaEngine::animation_ray() { } void DrasculaEngine::animation_7_4() { + debug(4, "animation_7_4()"); + black(); talk(427); fadeFromBlack(1); @@ -1184,6 +1241,8 @@ void DrasculaEngine::animation_7_4() { } void DrasculaEngine::animation_1_5() { + debug(4, "animation_1_5()"); + if (flags[0] == 0) { talk(430); talk_bj(16); @@ -1212,6 +1271,7 @@ void DrasculaEngine::animation_1_5() { break; updateRoom(); updateScreen(); + updateEvents(); } trackProtagonist = 1; @@ -1224,6 +1284,8 @@ void DrasculaEngine::animation_1_5() { } void DrasculaEngine::animation_5_5(){ + debug(4, "animation_5_5("); + int h; int frame = 0; int boneX[] = {1, 99, 197, 1, 99, 197, 1, 99, 197}; @@ -1247,6 +1309,7 @@ void DrasculaEngine::animation_5_5(){ copyBackground(); copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, backSurface, screenSurface); updateScreen(pixelX, pixelY, pixelX,pixelY, 97,64, screenSurface); + updateEvents(); } copyBackground(52, 161, 198, 81, 26, 24, drawSurface3, screenSurface); @@ -1257,6 +1320,7 @@ void DrasculaEngine::animation_5_5(){ copyBackground(); copyRect(boneX[frame], boneY[frame], pixelX, pixelY, 97, 64, frontSurface, screenSurface); updateScreen(pixelX, pixelY, pixelX,pixelY, 97, 64, screenSurface); + updateEvents(); } flags[6] = 1; @@ -1279,11 +1343,13 @@ void DrasculaEngine::animation_5_5(){ pause(3); copyBackground(flyX[frame], 1, 174, 79, 61, 109, backSurface, screenSurface); updateScreen(174, 79, 174, 79, 61, 109, screenSurface); + updateEvents(); } for (frame = 0; frame < 5; frame++) { pause(3); copyBackground(flyX[frame], 1, 174, 79, 61, 109, extraSurface, screenSurface); updateScreen(174, 79, 174, 79, 61, 109, screenSurface); + updateEvents(); } updateScreen(0, 0, 0, 0, 320, 200, bgSurface); @@ -1299,6 +1365,8 @@ void DrasculaEngine::animation_5_5(){ } void DrasculaEngine::animation_11_5() { + debug(4, "animation_11_5()"); + flags[9] = 1; if (flags[2] == 1 && flags[3] == 1 && flags[4] == 1) animation_12_5(); @@ -1309,6 +1377,8 @@ void DrasculaEngine::animation_11_5() { } void DrasculaEngine::animation_12_5() { + debug(4, "animation_12_5()"); + DacPalette256 bgPalette1; DacPalette256 bgPalette2; DacPalette256 bgPalette3; @@ -1367,6 +1437,7 @@ void DrasculaEngine::animation_12_5() { copyRect(rayX[frame], 1, 41, 0, 44, 44, backSurface, screenSurface); copyRect(frusky_x[frame], 113, 205, 50, 38, 86, drawSurface3, screenSurface); updateScreen(); + updateEvents(); } stopSound(); @@ -1383,6 +1454,7 @@ void DrasculaEngine::animation_12_5() { updateRoom(); copyRect(elfrusky_x[frame], 47, 192, 39, 66, 106, backSurface, screenSurface); updateScreen(); + updateEvents(); } animate("frel.bin", 16); @@ -1415,6 +1487,8 @@ void DrasculaEngine::animation_12_5() { } void DrasculaEngine::animation_13_5() { + debug(4, "animation_13_5()"); + int frank_x = 199; int frame = 0; int frus_x[] = {1, 46, 91, 136, 181, 226, 271}; @@ -1441,11 +1515,14 @@ void DrasculaEngine::animation_13_5() { frame = 0; trackProtagonist = 3; } + updateEvents(); pause(6); } } void DrasculaEngine::animation_14_5() { + debug(4, "animation_14_5()"); + flags[11] = 1; playSound(3); updateRoom(); @@ -1469,6 +1546,8 @@ void DrasculaEngine::animation_14_5() { } void DrasculaEngine::animation_1_6() { + debug(4, "animation_1_6()"); + trackProtagonist = 0; curX = 103; curY = 108; @@ -1497,11 +1576,15 @@ void DrasculaEngine::animation_1_6() { talk_drascula(28, 1); talk(255); talk_drascula(29, 1); + updateEvents(); fadeToBlack(1); + updateEvents(); clearRoom(); loadPic("time1.alg", screenSurface); updateScreen(); + updateEvents(); delay(930); + updateEvents(); clearRoom(); black(); hare_se_ve = 0; @@ -1513,10 +1596,13 @@ void DrasculaEngine::animation_1_6() { talk_drascula(30, 1); talk(257); fadeToBlack(0); + updateEvents(); clearRoom(); loadPic("time1.alg", screenSurface); updateScreen(); + updateEvents(); delay(900); + updateEvents(); clearRoom(); black(); updateRoom(); @@ -1540,6 +1626,8 @@ void DrasculaEngine::animation_1_6() { } void DrasculaEngine::animation_5_6() { + debug(4, "animation_5_6()"); + int pY = -125; animate("man.bin", 14); @@ -1553,6 +1641,7 @@ void DrasculaEngine::animation_5_6() { updateRefresh(); updateScreen(); + updateEvents(); pause(2); } @@ -1560,6 +1649,8 @@ void DrasculaEngine::animation_5_6() { } void DrasculaEngine::animation_6_6() { + debug(4, "animation_6_6()"); + animate("rct.bin", 11); clearRoom(); selectVerb(kVerbNone); @@ -1584,6 +1675,8 @@ void DrasculaEngine::animation_6_6() { } void DrasculaEngine::animation_9_6() { + debug(4, "animation_9_6()"); + int v_cd; animate("fin.bin", 14); @@ -1660,6 +1753,8 @@ void DrasculaEngine::animation_9_6() { } void DrasculaEngine::animation_19_6() { + debug(4, "animation_19_6()"); + copyBackground(); copyBackground(140, 23, 161, 69, 35, 80, drawSurface3, screenSurface); @@ -1675,6 +1770,8 @@ void DrasculaEngine::animation_19_6() { } void DrasculaEngine::animation_12_2() { + debug(4, "animation_12_2()"); + loadPic("an12.alg", extraSurface); talk(356); @@ -1705,6 +1802,8 @@ void DrasculaEngine::animation_12_2() { } void DrasculaEngine::animation_26_2() { + debug(4, "animation_26_2()"); + loadPic("an12.alg", extraSurface); talk(392); @@ -1745,6 +1844,7 @@ void DrasculaEngine::animation_26_2() { x = x + 50; if (n == 2) playSound(9); + updateEvents(); pause(3); } @@ -1762,6 +1862,8 @@ void DrasculaEngine::animation_26_2() { } void DrasculaEngine::animation_11_2() { + debug(4, "animation_11_2()"); + loadPic("an11y13.alg", extraSurface); playTalkSequence(11); // sequence 11, chapter 2 @@ -1770,6 +1872,8 @@ void DrasculaEngine::animation_11_2() { } void DrasculaEngine::animation_13_2() { + debug(4, "animation_13_2()"); + loadPic("an11y13.alg", frontSurface); if (flags[41] == 0) { @@ -1780,6 +1884,8 @@ void DrasculaEngine::animation_13_2() { } void DrasculaEngine::animation_24_2() { + debug(4, "animation_24_2()"); + if (curX < 178) gotoObject(208, 136); trackProtagonist = 3; @@ -1810,6 +1916,8 @@ void DrasculaEngine::animation_24_2() { } void DrasculaEngine::animation_32_2() { + debug(4, "animation_32_2()"); + loadPic("an32_1.alg", drawSurface3); loadPic("an32_2.alg", backSurface); @@ -1825,12 +1933,16 @@ void DrasculaEngine::animation_32_2() { x = x + 65; if (n < 2) pause(4); + + updateEvents(); } loadPic("aux18.alg", drawSurface3); } void DrasculaEngine::animation_34_2() { + debug(4, "animation_34_2()"); + trackProtagonist = 1; updateRoom(); updateScreen(); @@ -1858,6 +1970,8 @@ void DrasculaEngine::animation_34_2() { } void DrasculaEngine::animation_36_2() { + debug(4, "animation_36_2()"); + loadPic("an11y13.alg", extraSurface); talk(404); @@ -1871,7 +1985,10 @@ void DrasculaEngine::animation_36_2() { loadPic(974, extraSurface); } +// Use sickle on plant void DrasculaEngine::animation_7_2() { + debug(4, "animation_7_2()"); + loadPic("an7_1.alg", backSurface); loadPic("an7_2.alg", extraSurface); loadPic("an7_3.alg", frontSurface); @@ -1928,6 +2045,8 @@ void DrasculaEngine::animation_7_2() { } void DrasculaEngine::animation_5_2() { + debug(4, "animation_5_2()"); + trackProtagonist = 0; updateRoom(); updateScreen(); @@ -1964,6 +2083,8 @@ void DrasculaEngine::animation_5_2() { } void DrasculaEngine::animation_6_2() { + debug(4, "animation_6_2()"); + stopMusic(); flags[9] = 1; @@ -2005,6 +2126,8 @@ void DrasculaEngine::animation_6_2() { } void DrasculaEngine::animation_33_2() { + debug(4, "animation_33_2()"); + stopMusic(); flags[9] = 1; @@ -2052,6 +2175,8 @@ void DrasculaEngine::animation_33_2() { } void DrasculaEngine::animation_1_4() { + debug(4, "animation_1_4()"); + if (flags[21] == 0) { strcpy(objName[2], "igor"); talk(275); @@ -2108,6 +2233,8 @@ void DrasculaEngine::animation_1_4() { } void DrasculaEngine::animation_5_4(){ + debug(4, "animation_5_4("); + trackProtagonist = 3; loadPic("anh_dr.alg", backSurface); gotoObject(99, 160); @@ -2136,6 +2263,8 @@ void DrasculaEngine::animation_5_4(){ } void DrasculaEngine::animation_6_4() { + debug(4, "animation_6_4()"); + int prevRoom = roomNumber; roomNumber = 26; @@ -2161,6 +2290,8 @@ void DrasculaEngine::animation_6_4() { } void DrasculaEngine::animation_8_4() { + debug(4, "animation_8_4()"); + int bookcaseX[] = {1, 75, 149, 223, 1, 75, 149, 223, 149, 223, 149, 223, 149, 223}; int bookcaseY[] = {1, 1, 1, 1, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74}; @@ -2170,6 +2301,7 @@ void DrasculaEngine::animation_8_4() { pause(2); copyBackground(bookcaseX[frame], bookcaseY[frame], 77, 45, 73, 72, frontSurface, screenSurface); updateScreen(77, 45, 77, 45, 73, 72, screenSurface); + updateEvents(); } loadPic(96, frontSurface); @@ -2177,6 +2309,8 @@ void DrasculaEngine::animation_8_4() { } void DrasculaEngine::activatePendulum() { + debug(4, "activatePendulum()"); + flags[1] = 2; hare_se_ve = 0; roomNumber = 102; diff --git a/engines/drascula/console.cpp b/engines/drascula/console.cpp new file mode 100644 index 0000000000..d017468285 --- /dev/null +++ b/engines/drascula/console.cpp @@ -0,0 +1,63 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "drascula/console.h" +#include "gui/debugger.h" +#include "drascula/drascula.h" + +namespace Drascula { + +Console::Console(DrasculaEngine *vm) : GUI::Debugger(), _vm(vm) { + DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room)); +} + +Console::~Console() { +} + +void Console::preEnter() { +} + +void Console::postEnter() { +} + +bool Console::Cmd_Room(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Usage: changeCard <card>\n"); + return true; + } + + int roomNum = atoi(argv[1]); + + _vm->loadedDifferentChapter = 0; + _vm->enterRoom(roomNum); + _vm->selectVerb(kVerbNone); + _vm->clearRoom(); + _vm->loadPic(roomNum, _vm->bgSurface, HALF_PAL); + _vm->selectionMade = 0; + + return false; +} + +} // End of namespace Drascula diff --git a/engines/drascula/console.h b/engines/drascula/console.h new file mode 100644 index 0000000000..33e2f626e4 --- /dev/null +++ b/engines/drascula/console.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#ifndef DRASCULA_CONSOLE_H +#define DRASCULA_CONSOLE_H + +#include "gui/debugger.h" + +namespace Drascula { + +class DrasculaEngine; + +class Console : public GUI::Debugger { +public: + Console(DrasculaEngine *vm); + virtual ~Console(void); + +protected: + virtual void preEnter(); + virtual void postEnter(); + +private: + DrasculaEngine *_vm; + + bool Cmd_Room(int argc, const char **argv); +}; + +} // End of namespace Drascula +#endif diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index b2a7e217e6..0e70348148 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -131,6 +131,8 @@ void DrasculaEngine::cleanupString(char *string) { } void DrasculaEngine::converse(int index) { + debug(4, "converse(%d)", index); + char fileName[20]; sprintf(fileName, "op_%d.cal", index); Common::SeekableReadStream *stream = _archives.open(fileName); @@ -279,9 +281,15 @@ void DrasculaEngine::converse(int index) { } void DrasculaEngine::response(int function) { - playTalkSequence(function); + debug(4, "response(%d)", function); + + if (function != 31) + playTalkSequence(function); if (currentChapter == 2) { + if (function == 16 || function == 20 || function == 23 || function == 29 || function == 31) + loadPic(menuBackground, backSurface); + if (function == 16) animation_16_2(); else if (function == 20) diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp index 76d48b7b89..c10222cadd 100644 --- a/engines/drascula/detection.cpp +++ b/engines/drascula/detection.cpp @@ -264,7 +264,11 @@ static const ADParams detectionParams = { // Flags 0, // Additional GUI options (for every game} - Common::GUIO_NOMIDI + Common::GUIO_NOMIDI, + // Maximum directory depth + 1, + // List of directory globs + 0 }; class DrasculaMetaEngine : public AdvancedMetaEngine { diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 39f07e5875..7c87f3574d 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -38,6 +38,7 @@ #include "sound/mixer.h" #include "drascula/drascula.h" +#include "drascula/console.h" namespace Drascula { @@ -115,6 +116,8 @@ DrasculaEngine::~DrasculaEngine() { freeRoomsTable(); + delete _console; + free(_charMap); free(_itemLocations); free(_polX); @@ -173,6 +176,8 @@ Common::Error DrasculaEngine::run() { _lang = kEnglish; } + _console = new Console(this); + if (!loadDrasculaDat()) return Common::kUnknownError; @@ -241,6 +246,8 @@ Common::Error DrasculaEngine::run() { if (currentChapter != 3) loadPic(96, frontSurface, COMPLETE_PAL); + loadPic(99, cursorSurface); + if (currentChapter == 1) { } else if (currentChapter == 2) { loadPic("pts.alg", drawSurface2); @@ -272,6 +279,7 @@ Common::Error DrasculaEngine::run() { loadPic(974, tableSurface); if (currentChapter != 2) { + loadPic(99, cursorSurface); loadPic(99, backSurface); loadPic(97, extraSurface); } @@ -499,11 +507,15 @@ bool DrasculaEngine::runCurrentChapter() { #else if (rightMouseButton == 1 && _menuScreen) { #endif + rightMouseButton = 0; delay(100); - if (currentChapter == 2) + if (currentChapter == 2) { + loadPic(menuBackground, cursorSurface); loadPic(menuBackground, backSurface); - else + } else { + loadPic(99, cursorSurface); loadPic(99, backSurface); + } setPalette((byte *)&gamePalette); _menuScreen = false; #ifndef _WIN32_WCE @@ -524,18 +536,24 @@ bool DrasculaEngine::runCurrentChapter() { if (rightMouseButton == 1 && !_menuScreen && !(currentChapter == 5 && pickedObject == 16)) { #endif + rightMouseButton = 0; delay(100); characterMoved = 0; if (trackProtagonist == 2) trackProtagonist = 1; - if (currentChapter == 4) + if (currentChapter == 4) { loadPic("icons2.alg", backSurface); - else if (currentChapter == 5) + loadPic("icons2.alg", cursorSurface); + } else if (currentChapter == 5) { loadPic("icons3.alg", backSurface); - else if (currentChapter == 6) + loadPic("icons3.alg", cursorSurface); + } else if (currentChapter == 6) { loadPic("iconsp.alg", backSurface); - else + loadPic("iconsp.alg", cursorSurface); + } else { loadPic("icons.alg", backSurface); + loadPic("icons.alg", cursorSurface); + } _menuScreen = true; #ifndef _WIN32_WCE updateEvents(); @@ -594,6 +612,9 @@ bool DrasculaEngine::runCurrentChapter() { } else if (key == Common::KEYCODE_ESCAPE) { if (!confirmExit()) return false; + } else if (key == Common::KEYCODE_TILDE || key == Common::KEYCODE_BACKQUOTE) { + _console->attach(); + _console->onFrame(); } else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) { loadPic("alcbar.alg", bgSurface, 255); } @@ -741,10 +762,10 @@ void DrasculaEngine::updateEvents() { leftMouseButton = 0; break; case Common::EVENT_RBUTTONDOWN: - rightMouseButton = 1; + // We changed semantic and react only on button up event break; case Common::EVENT_RBUTTONUP: - rightMouseButton = 0; + rightMouseButton = 1; break; case Common::EVENT_QUIT: // TODO @@ -758,11 +779,17 @@ void DrasculaEngine::updateEvents() { } void DrasculaEngine::delay(int ms) { - _system->delayMillis(ms * 2); // originally was 1 + uint32 end = _system->getMillis() + ms * 2; // originally was 1 + + do { + _system->delayMillis(10); + updateEvents(); + _system->updateScreen(); + } while (_system->getMillis() < end); } void DrasculaEngine::pause(int duration) { - _system->delayMillis(duration * 30); // was originally 2 + delay(duration * 15); } int DrasculaEngine::getTime() { diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 4876cf3390..0a8b7c8c9b 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -317,6 +317,8 @@ static const int interf_y[] = { 51, 51, 51, 51, 83, 83, 83 }; struct RoomHandlers; +class Console; + class DrasculaEngine : public ::Engine { protected: // Engine APIs @@ -389,6 +391,7 @@ public: // Graphics buffers/pointers byte *bgSurface; byte *backSurface; + byte *cursorSurface; byte *drawSurface3; byte *drawSurface2; byte *tableSurface; @@ -733,6 +736,8 @@ public: private: int _lang; + Console *_console; + CharInfo *_charMap; int _charMapSize; diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index 00399816da..70085b99af 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -54,6 +54,7 @@ void DrasculaEngine::allocMemory() { assert(crosshairCursor); mouseCursor = (byte *)malloc(OBJWIDTH * OBJHEIGHT); assert(mouseCursor); + cursorSurface = (byte *)malloc(64000); } void DrasculaEngine::freeMemory() { @@ -67,6 +68,7 @@ void DrasculaEngine::freeMemory() { free(frontSurface); free(crosshairCursor); free(mouseCursor); + free(cursorSurface); } void DrasculaEngine::moveCursor() { @@ -90,6 +92,8 @@ void DrasculaEngine::moveCursor() { } void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int colorCount) { + debug(5, "loadPic(%s)", NamePcc); + uint dataSize = 0; byte *pcxData; @@ -147,8 +151,7 @@ void DrasculaEngine::showFrame(Common::SeekableReadStream *stream, bool firstFra free(prevFrame); } -void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int width, - int height, byte *src, byte *dest) { +void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *src, byte *dest) { dest += xdes + ydes * 320; src += xorg + yorg * 320; /* Unoptimized code @@ -190,16 +193,20 @@ void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width, 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]; + int ptr = 0; + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + if (src[ptr] != 255) + dest[ptr] = src[ptr]; + ptr++; + } + ptr += 320 - width; + } + } void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) { - byte *screenBuffer = (byte *)_system->lockScreen()->pixels; - copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, screenBuffer); - _system->unlockScreen(); + _system->copyRectToScreen(buffer + xorg + yorg * 320, 320, xdes, ydes, width, height); _system->updateScreen(); } diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp index 21803a8932..1495694a1b 100644 --- a/engines/drascula/interface.cpp +++ b/engines/drascula/interface.cpp @@ -65,6 +65,8 @@ void DrasculaEngine::selectVerbFromBar() { } void DrasculaEngine::selectVerb(int verb) { + debug(4, "selectVerb(%d)", verb); + int c = _menuScreen ? 0 : 171; if (currentChapter == 5) { @@ -76,7 +78,7 @@ void DrasculaEngine::selectVerb(int verb) { } for (int i = 0; i < OBJHEIGHT; i++) - memcpy(mouseCursor + i * OBJWIDTH, backSurface + OBJWIDTH * verb + (c + i) * 320, OBJWIDTH); + memcpy(mouseCursor + i * OBJWIDTH, cursorSurface + OBJWIDTH * verb + (c + i) * 320, OBJWIDTH); setCursor(kCursorCurrentItem); if (verb > 0) { @@ -126,7 +128,7 @@ void DrasculaEngine::showMenu() { OBJWIDTH, OBJHEIGHT, srcSurface, screenSurface); } copyRect(_x1d_menu[h], _y1d_menu[h], _itemLocations[n].x, _itemLocations[n].y, - OBJWIDTH, OBJHEIGHT, backSurface, screenSurface); + OBJWIDTH, OBJHEIGHT, cursorSurface, screenSurface); } if (x < 7) @@ -140,7 +142,7 @@ void DrasculaEngine::clearMenu() { if (mouseX > _verbBarX[n] && mouseX < _verbBarX[n + 1]) verbActivated = 0; copyRect(OBJWIDTH * n, OBJHEIGHT * verbActivated, _verbBarX[n], 2, - OBJWIDTH, OBJHEIGHT, backSurface, screenSurface); + OBJWIDTH, OBJHEIGHT, cursorSurface, screenSurface); verbActivated = 1; } } diff --git a/engines/drascula/module.mk b/engines/drascula/module.mk index a9fa257549..20fd900124 100644 --- a/engines/drascula/module.mk +++ b/engines/drascula/module.mk @@ -3,6 +3,7 @@ MODULE := engines/drascula MODULE_OBJS := \ actors.o \ animation.o \ + console.o \ converse.o \ detection.o \ drascula.o \ diff --git a/engines/drascula/objects.cpp b/engines/drascula/objects.cpp index 13c8a742ca..73aea7b7f2 100644 --- a/engines/drascula/objects.cpp +++ b/engines/drascula/objects.cpp @@ -78,8 +78,11 @@ void DrasculaEngine::gotoObject(int pointX, int pointY) { for (;;) { updateRoom(); updateScreen(); + updateEvents(); if (characterMoved == 0) break; + + pause(3); } if (walkToObject == 1) { diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp index 1e51deffd9..0f75bb7959 100644 --- a/engines/drascula/palette.cpp +++ b/engines/drascula/palette.cpp @@ -106,6 +106,8 @@ void DrasculaEngine::fadeToBlack(int fadeSpeed) { pause(fadeSpeed); setPalette((byte *)&palFade); + + updateEvents(); } } @@ -124,6 +126,8 @@ void DrasculaEngine::fadeFromBlack(int fadeSpeed) { pause(fadeSpeed); setPalette((byte *)&palFade); + + updateEvents(); } } diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index a71545feca..57bfad26af 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -1091,7 +1091,7 @@ void DrasculaEngine::updateRefresh() { sprintf(rm, "update_%d", roomNumber); for (uint i = 0; i < _roomHandlers->roomUpdaters.size(); i++) { if (!strcmp(rm, _roomHandlers->roomUpdaters[i]->desc)) { - debug(4, "Calling room updater %d", roomNumber); + debug(8, "Calling room updater %d", roomNumber); (this->*(_roomHandlers->roomUpdaters[i]->proc))(); break; } @@ -1129,7 +1129,7 @@ void DrasculaEngine::updateRefresh_pre() { sprintf(rm, "update_%d_pre", roomNumber); for (uint i = 0; i < _roomHandlers->roomPreupdaters.size(); i++) { if (!strcmp(rm, _roomHandlers->roomPreupdaters[i]->desc)) { - debug(4, "Calling room preupdater %d", roomNumber); + debug(8, "Calling room preupdater %d", roomNumber); (this->*(_roomHandlers->roomPreupdaters[i]->proc))(); break; } diff --git a/engines/drascula/talk.cpp b/engines/drascula/talk.cpp index 54175c5e5b..8cefe0385c 100644 --- a/engines/drascula/talk.cpp +++ b/engines/drascula/talk.cpp @@ -170,6 +170,7 @@ void DrasculaEngine::talk_drascula(int index, int talkerType) { centerText(said, drasculaX + 19, drasculaY); updateScreen(); + updateEvents(); pause(3); @@ -215,6 +216,7 @@ void DrasculaEngine::talk_drascula_big(int index) { centerText(said, 191, 69); updateScreen(); + updateEvents(); pause(3); @@ -245,7 +247,9 @@ void DrasculaEngine::talk_solo(const char *said, const char *filename) { else if (currentChapter == 5) centerText(said, 173, 92); } + updateEvents(); updateScreen(); + pause(3); } while (!isTalkFinished()); if (currentChapter == 6) { @@ -304,6 +308,7 @@ void DrasculaEngine::talk_bartender(int index, int talkerType) { centerText(said, 132, 45); updateScreen(); + updateEvents(); pause(3); } while (!isTalkFinished()); @@ -331,11 +336,9 @@ void DrasculaEngine::talk_bj(int index) { updateRefresh_pre(); - copyBackground(bjX + 2, bjY - 1, bjX + 2, bjY - 1, 27, 40, - bgSurface, screenSurface); + copyBackground(bjX + 2, bjY - 1, bjX + 2, bjY - 1, 27, 40, bgSurface, screenSurface); - copyRect(x_talk[face], 99, bjX + 2, bjY - 1, 27, 40, - drawSurface3, screenSurface); + copyRect(x_talk[face], 99, bjX + 2, bjY - 1, 27, 40, drawSurface3, screenSurface); moveCharacters(); updateRefresh(); @@ -353,6 +356,7 @@ void DrasculaEngine::talk_bj(int index) { updateScreen(); } + updateEvents(); } while (!isTalkFinished()); updateRoom(); @@ -467,6 +471,7 @@ void DrasculaEngine::talk(const char *said, const char *filename) { centerText(said, curX, curY); updateScreen(); + updateEvents(); pause(3); } while (!isTalkFinished()); @@ -558,16 +563,15 @@ void DrasculaEngine::talk_vonBraun(int index, int talkerType) { if (!_subtitlesDisabled) centerText(said, vonBraunX, 66); - updateScreen(); - pause(3); } else { updateRoom(); if (!_subtitlesDisabled) centerText(said, 150, 80); - - updateScreen(); } + updateScreen(); + updateEvents(); + pause(3); } while (!isTalkFinished()); updateRoom(); @@ -621,6 +625,7 @@ void DrasculaEngine::talk_blind(int index) { centerText(said, 260, 71); updateScreen(); + updateEvents(); pause(2); p++; } while (!isTalkFinished()); @@ -641,7 +646,9 @@ void DrasculaEngine::talk_hacker(int index) { do { if (!_subtitlesDisabled) centerText(said, 156, 170); + updateEvents(); updateScreen(); + pause(3); } while (!isTalkFinished()); } @@ -693,13 +700,13 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker copyBackground(); updateRefresh_pre(); + updateRefresh(); + if (talkerType == 0) copyRect(x_talk[face], 145, 145, 105, 25, 29, drawSurface3, screenSurface); else copyBackground(x_talk2[face], 171, 173, 116, 25, 28, drawSurface3, screenSurface); - updateRefresh(); - if (!_subtitlesDisabled) { if (talkerType == 0) centerText(said, 160, 105); @@ -708,6 +715,7 @@ void DrasculaEngine::talk_pen(const char *said, const char *filename, int talker } updateScreen(); + updateEvents(); pause(3); } while (!isTalkFinished()); @@ -745,6 +753,7 @@ void DrasculaEngine::talk_bj_bed(int index) { centerText(said, 104, 102); updateScreen(); + updateEvents(); pause(3); } while (!isTalkFinished()); @@ -781,6 +790,7 @@ void DrasculaEngine::talk_htel(int index) { centerText(said, 90, 50); updateScreen(); + updateEvents(); pause(3); } while (!isTalkFinished()); @@ -862,6 +872,7 @@ void DrasculaEngine::talk_sync(const char *said, const char *filename, const cha centerText(said, curX, curY); updateScreen(); + updateEvents(); p++; pause(3); @@ -895,6 +906,7 @@ void DrasculaEngine::talk_trunk(int index) { centerText(said, 263, 69); updateScreen(); + updateEvents(); pause(4); } while (!isTalkFinished()); @@ -922,6 +934,7 @@ void DrasculaEngine::talk_generic(const char* said, const char* filename, int* f centerText(said, coords[5], coords[6]); updateScreen(); + updateEvents(); pause(3); } while (!isTalkFinished()); @@ -944,8 +957,10 @@ void DrasculaEngine::grr() { updateScreen(); - while (!isTalkFinished()) - ; + while (!isTalkFinished()) { + updateEvents(); + pause(3); + } updateRoom(); updateScreen(); |