From c1b0c80cce2aa20b854836fe003b31ed1ad4e6e6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 4 Jan 2013 19:30:36 +0200 Subject: DRASCULA: Merge some animation functions and document all animations --- engines/drascula/animation.cpp | 346 ++++++++++++++++------------------------- engines/drascula/converse.cpp | 1 - engines/drascula/drascula.cpp | 13 +- engines/drascula/drascula.h | 96 ++++++------ engines/drascula/rooms.cpp | 26 ++-- 5 files changed, 196 insertions(+), 286 deletions(-) diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 969d06f2ef..6bb1b3b132 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -42,7 +42,6 @@ void DrasculaEngine::updateAnim(int y, int destX, int destY, int width, int heig } } -// This is the game's introduction sequence void DrasculaEngine::animation_1_1() { debug(4, "animation_1_1()"); @@ -372,7 +371,6 @@ void DrasculaEngine::animation_1_1() { loadPic(99, backSurface); } -// John falls in love with BJ, who is then abducted by Drascula void DrasculaEngine::animation_2_1() { debug(4, "animation_2_1()"); @@ -563,7 +561,6 @@ 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()"); @@ -574,7 +571,6 @@ void DrasculaEngine::animation_3_1() { loadPic(97, extraSurface); } -// John Hacker talks with the pianist void DrasculaEngine::animation_4_1() { debug(4, "animation_4_1()"); @@ -676,26 +672,39 @@ void DrasculaEngine::animation_4_2() { pause(5); talk_hacker(57); pause(6); - talk_blind(2); - pause(4); - talk_hacker(58); - talk_blind(3); - delay(14); - talk_hacker(59); - talk_blind(4); - talk_hacker(60); - talk_blind(5); - talk_hacker(61); - talk_blind(6); - talk_hacker(62); - talk_blind(7); - talk_hacker(63); - talk_blind(8); - copyBackground(); - updateScreen(); - _system->delayMillis(1000); - talk_hacker(64); - talk_blind(9); + + if (flags[4] == 0) { // first time + talk_blind(2); + pause(4); + talk_hacker(58); + talk_blind(3); + delay(14); + talk_hacker(59); + talk_blind(4); + talk_hacker(60); + talk_blind(5); + talk_hacker(61); + talk_blind(6); + talk_hacker(62); + talk_blind(7); + talk_hacker(63); + talk_blind(8); + copyBackground(); + updateScreen(); + _system->delayMillis(1000); + talk_hacker(64); + talk_blind(9); + + flags[4] = 1; // talked to the blind man + } else { // second time + _system->delayMillis(1000); + talk_blind(10); + talk_hacker(65); + + flags[33] = 1; + } + + flags[9] = 0; copyBackground(); updateScreen(); @@ -711,9 +720,6 @@ void DrasculaEngine::animation_4_2() { loadPic(97, extraSurface); loadPic(99, backSurface); selectVerb(kVerbNone); - - flags[9] = 0; - flags[4] = 1; } void DrasculaEngine::animation_14_2() { @@ -899,10 +905,45 @@ void DrasculaEngine::animation_23_2() { trackVonBraun = 1; talk_vonBraun(18, kVonBraunNormal); - if (flags[29] == 0) - animation_23_joined(); - else - animation_23_joined2(); + if (flags[29] == 0) { + // John isn't wearing earplugs + 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}; + int y[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 1, 1, 1, 1}; + + loadPic("an23.alg", backSurface); + + for (int n = 0; n < 34; n++) { + copyRect(p_x, p_y, p_x, p_y, 36, 74, bgSurface, screenSurface); + 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); + } + } else { + // John is wearing earplugs + 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}; + + pause(50); + + loadPic("an23_2.alg", backSurface); + + for (int n = 0; n < 14; n++) { + copyRect(p_x, p_y, p_x, p_y, 33, 71, bgSurface, screenSurface); + 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); + } + } + + loadPic(99, backSurface); trackVonBraun = 2; animation_25_2(); @@ -927,52 +968,6 @@ void DrasculaEngine::animation_23_2() { breakOut = 1; } -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}; - int y[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 76, 76, 76, 76, 76, 76, 76, - 76, 76, 76, 76, 76, 76, 76, 1, 1, 1, 1}; - - loadPic("an23.alg", backSurface); - - for (int n = 0; n < 34; n++) { - copyRect(p_x, p_y, p_x, p_y, 36, 74, bgSurface, screenSurface); - 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); - } - - loadPic(99, backSurface); -} - -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}; - - pause(50); - - loadPic("an23_2.alg", backSurface); - - for (int n = 0; n < 14; n++) { - copyRect(p_x, p_y, p_x, p_y, 33, 71, bgSurface, screenSurface); - 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); - } - - loadPic(99, backSurface); -} - void DrasculaEngine::animation_25_2() { debug(4, "animation_25_2()"); @@ -1097,31 +1092,11 @@ 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(); - playMusic(13); - animation_4_3(); - flags[1] = 1; - updateRoom(); - updateScreen(120, 0, 120, 0, 200, 200, screenSurface); - animation_5_3(); - flags[0] = 0; - flags[1] = 1; - - loadPic(96, frontSurface); - loadPic(97, extraSurface); - loadPic(99, backSurface); - - gotoObject(332, 127); -} - -void DrasculaEngine::animation_3_3() { - debug(4, "animation_3_3()"); int px = curX - 20, py = curY - 1; @@ -1135,12 +1110,11 @@ void DrasculaEngine::animation_3_3() { updateAnim(75, px, py, 71, 72, 4, extraSurface, 3, true); updateAnim(2, px, py, 71, 72, 4, backSurface, 3, true); updateAnim(75, px, py, 71, 72, 4, backSurface, 3, true); -} -void DrasculaEngine::animation_4_3() { - debug(4, "animation_4_3()"); + playMusic(13); - int px = 120, py = 63; + px = 120; + py = 63; loadPic("any_1.alg", frontSurface); loadPic("any_2.alg", extraSurface); @@ -1152,12 +1126,13 @@ void DrasculaEngine::animation_4_3() { updateAnim(91, px, py, 77, 89, 4, extraSurface, 3, true); updateAnim(1, px, py, 77, 89, 4, backSurface, 3, true); updateAnim(91, px, py, 77, 89, 4, backSurface, 3, true); -} -void DrasculaEngine::animation_5_3() { - debug(4, "animation_5_3()"); + flags[1] = 1; + updateRoom(); + updateScreen(120, 0, 120, 0, 200, 200, screenSurface); - int px = curX - 20, py = curY - 1; + px = curX - 20; + py = curY - 1; loadPic("an3y_1.alg", frontSurface); loadPic("an3y_2.alg", extraSurface); @@ -1169,6 +1144,15 @@ void DrasculaEngine::animation_5_3() { updateAnim(75, px, py, 71, 72, 4, extraSurface, 3, true); updateAnim(2, px, py, 71, 72, 4, backSurface, 3, true); updateAnim(75, px, py, 71, 72, 4, backSurface, 3, true); + + flags[0] = 0; + flags[1] = 1; + + loadPic(96, frontSurface); + loadPic(97, extraSurface); + loadPic(99, backSurface); + + gotoObject(332, 127); } void DrasculaEngine::animation_6_3() { @@ -1203,8 +1187,8 @@ void DrasculaEngine::animation_6_3() { updateScreen(); } -void DrasculaEngine::animation_ray() { - debug(4, "animation_ray()"); +void DrasculaEngine::animation_castle() { + debug(4, "animation_castle()"); loadPic("anr_1.alg", frontSurface, HALF_PAL); loadPic("anr_2.alg", extraSurface); @@ -1371,18 +1355,6 @@ void DrasculaEngine::animation_5_5(){ loadPic(49, bgSurface, HALF_PAL); } -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(); - else { - flags[9] = 0; - talk(33); - } -} - void DrasculaEngine::animation_12_5() { debug(4, "animation_12_5()"); @@ -1432,7 +1404,7 @@ void DrasculaEngine::animation_12_5() { loadPic("3an11_1.alg", backSurface); for (frame = 0; frame < 8; frame++) { - if (frame == 2 || frame == 4 || frame == 8 || frame==10) + if (frame == 2 || frame == 4 || frame == 8 || frame == 10) setPalette((byte *)&bgPalette1); else if (frame == 1 || frame == 5 || frame == 7 || frame == 9) setPalette((byte *)&bgPalette2); @@ -1471,35 +1443,11 @@ void DrasculaEngine::animation_12_5() { flags[1] = 1; - animation_13_5(); - playSound(1); - hiccup(12); - finishSound(); - - loadPic(99, backSurface); - - gotoObject(40, 169); - gotoObject(-14, 175); - - doBreak = 1; - previousMusic = roomMusic; - hare_se_ve = 1; - clearRoom(); - trackProtagonist = 1; - characterMoved = 0; - curX = -1; - objExit = 104; - selectVerb(kVerbNone); - enterRoom(57); -} - -void DrasculaEngine::animation_13_5() { - debug(4, "animation_13_5()"); - + // Frankenstein walks to the left and destoys the wall - start int frank_x = 199; - int frame = 0; int frus_x[] = {1, 46, 91, 136, 181, 226, 271}; int frus_y[] = {1, 1, 1, 1, 1, 1, 1, 89}; + frame = 0; loadPic("auxfr.alg", backSurface); @@ -1525,6 +1473,27 @@ void DrasculaEngine::animation_13_5() { updateEvents(); pause(6); } + // Frankenstein walks to the left and destoys the wall - end + + playSound(1); + hiccup(12); + finishSound(); + + loadPic(99, backSurface); + + gotoObject(40, 169); + gotoObject(-14, 175); + + doBreak = 1; + previousMusic = roomMusic; + hare_se_ve = 1; + clearRoom(); + trackProtagonist = 1; + characterMoved = 0; + curX = -1; + objExit = 104; + selectVerb(kVerbNone); + enterRoom(57); } void DrasculaEngine::animation_14_5() { @@ -1904,27 +1873,6 @@ void DrasculaEngine::animation_24_2() { loadPic("an24.alg", frontSurface); - animation_32_2(); - - flags[21] = 1; - - talk_vonBraun(22, kVonBraunNormal); - - if (flags[22] == 0) - converse(4); - else - converse(5); - - exitRoom(0); - flags[21] = 0; - flags[24] = 0; - trackVonBraun = 1; - vonBraunX = 120; -} - -void DrasculaEngine::animation_32_2() { - debug(4, "animation_32_2()"); - loadPic("an32_1.alg", drawSurface3); loadPic("an32_2.alg", backSurface); @@ -1945,6 +1893,21 @@ void DrasculaEngine::animation_32_2() { } loadPic("aux18.alg", drawSurface3); + + flags[21] = 1; + + talk_vonBraun(22, kVonBraunNormal); + + if (flags[22] == 0) + converse(4); + else + converse(5); + + exitRoom(0); + flags[21] = 0; + flags[24] = 0; + trackVonBraun = 1; + vonBraunX = 120; } void DrasculaEngine::animation_34_2() { @@ -2132,55 +2095,6 @@ void DrasculaEngine::animation_6_2() { flags[9] = 0; } -void DrasculaEngine::animation_33_2() { - debug(4, "animation_33_2()"); - - stopMusic(); - flags[9] = 1; - - pause(12); - talk(60); - pause(8); - - clearRoom(); - loadPic("ciego1.alg", bgSurface, HALF_PAL); // ciego = blind - loadPic("ciego2.alg", drawSurface3); - loadPic("ciego3.alg", extraSurface); - loadPic("ciego4.alg", backSurface); - loadPic("ciego5.alg", frontSurface); - - copyBackground(); - updateScreen(); - - pause(10); - - talk_blind(1); - pause(5); - talk_hacker(57); - pause(6); - _system->delayMillis(1000); - talk_blind(10); - talk_hacker(65); - - copyBackground(); - updateScreen(); - - pause(14); - - clearRoom(); - - playMusic(roomMusic); - loadPic(9, bgSurface, HALF_PAL); - loadPic("aux9.alg", drawSurface3); - loadPic(96, frontSurface); - loadPic(97, extraSurface); - loadPic(99, backSurface); - selectVerb(kVerbNone); - - flags[33] = 1; - flags[9] = 0; -} - void DrasculaEngine::animation_1_4() { debug(4, "animation_1_4()"); diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index 7abbb3214b..d045d683fc 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -167,7 +167,6 @@ void DrasculaEngine::converse(int index) { // no need to delete the stream, since TextResourceParser takes ownership // delete stream; - if (currentChapter == 2 && !strcmp(fileName, "op_5.cal") && flags[38] == 1 && flags[33] == 1) { strcpy(phrase3, _text[405]); strcpy(sound3, "405.als"); diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index c2fd16423d..7733a0fd6b 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -269,7 +269,7 @@ Common::Error DrasculaEngine::run() { loadPic(96, frontSurface); } else if (currentChapter == 4) { if (loadedDifferentChapter == 0) - animation_ray(); + animation_castle(); loadPic(96, frontSurface); clearRoom(); } else if (currentChapter == 5) { @@ -377,6 +377,8 @@ bool DrasculaEngine::runCurrentChapter() { curY = 56; gotoObject(65, 145); } + + // REMINDER: This is a good place to debug animations } else if (currentChapter == 2) { addObject(kItemPhone); trackProtagonist = 3; @@ -647,17 +649,14 @@ bool DrasculaEngine::runCurrentChapter() { } if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0) - if (currentChapter != 3) - framesWithoutAction = 0; + framesWithoutAction = 0; if (framesWithoutAction == 15000) { screenSaver(); - if (currentChapter != 3) - framesWithoutAction = 0; + framesWithoutAction = 0; } - if (currentChapter != 3) - framesWithoutAction++; + framesWithoutAction++; } return false; diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index bb601b5b2e..9f13d36c9e 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -654,63 +654,55 @@ public: bool room_62(int); bool room_102(int); - void animation_1_1(); - void animation_2_1(); - void animation_3_1(); - void animation_4_1(); - // - void animation_2_2(); - void animation_4_2(); - void animation_5_2(); - void animation_6_2(); - void animation_7_2(); - void animation_11_2(); - void animation_12_2(); - void animation_13_2(); - void animation_14_2(); void asco(); - void animation_16_2(); - void animation_20_2(); - void animation_23_2(); - void animation_23_joined(); - void animation_23_joined2(); - void animation_24_2(); - void animation_25_2(); - void animation_26_2(); - void animation_27_2(); - void animation_29_2(); - void animation_31_2(); - void animation_32_2(); - void animation_33_2(); - void animation_34_2(); - void animation_35_2(); - void animation_36_2(); + + void animation_1_1(); // Game introduction + void animation_2_1(); // John falls in love with BJ, who is then abducted by Drascula + void animation_3_1(); // John talks with the bartender to book a room + void animation_4_1(); // John talks with the pianist + // + void animation_2_2(); // John enters the chapel via the window + void animation_4_2(); // John talks with the blind man (closeup) + void animation_5_2(); // John breaks the chapel window with the pike + void animation_6_2(); // The blind man (closeup) thanks John for giving him money and hands him the sickle + void animation_7_2(); // John uses the sickle + void animation_11_2(); // The drunk man says "they're all dead, thanks *hic*" + void animation_12_2(); // Conversation screen - John talks to the pianist after BJ is abducted by Drascula + void animation_13_2(); // ??? + void animation_14_2(); // The glass box falls from the ceiling + void animation_16_2(); // The drunk tells us about Von Braun + void animation_20_2(); // Von Braun tells John that he needs to have special skills to fight vampires + void animation_23_2(); // Von Braun tests John's reactions to scratching noises + void animation_24_2(); // Conversation screen - John talks with Von Braun + void animation_25_2(); // The glass box is lifted back to the ceiling + void animation_26_2(); // John gives the book to the pianist and gets his earplugs in return + void animation_27_2(); // Von Braun admits that John is ready to fight vampires and gives him his money back + void animation_29_2(); // Von Braun tells John what ingredients he needs for the brew + void animation_31_2(); // Von Braun obtains the items needed for the brew from John and creates it + void animation_34_2(); // John kicks an object + void animation_35_2(); // John jumps into the well + void animation_36_2(); // John asks the bartender about the pianist // - void animation_2_3(); - void animation_3_3(); - void animation_4_3(); - void animation_5_3(); - void animation_6_3(); - void animation_ray(); + void animation_2_3(); // John uses the cross with the Frankenstein-zombie ("yoda") and destroys him + void animation_6_3(); // Frankenstein is blocking John's path // - void animation_1_4(); - void animation_5_4(); - void animation_6_4(); - void animation_7_4(); - void animation_8_4(); + void animation_castle(); // Chapter 4 start - Drascula's castle exterior, lightning strikes + void animation_1_4(); // Conversation screen - John talks with Igor + void animation_5_4(); // John enters Igor's room dressed as Drascula + void animation_6_4(); // Igor says that he's going for supper + void animation_7_4(); // John removes Drascula's disguise + void animation_8_4(); // Secret passage behind bookcase is revealed // - void animation_1_5(); - void animation_5_5(); - void animation_11_5(); - void animation_12_5(); - void animation_13_5(); - void animation_14_5(); + void animation_1_5(); // John finds BJ + void animation_5_5(); // ??? + void animation_12_5(); // Frankenstein comes to life + void animation_14_5(); // John finds out that an object is empty // - void animation_1_6(); - void animation_5_6(); - void animation_6_6(); - void animation_9_6(); - void animation_19_6(); + void animation_1_6(); // ??? + void animation_5_6(); // John is tied to the table. Drascula and Igor lower the pendulum + void animation_6_6(); // John uses the pendulum to break free + void animation_9_6(); // Game ending - John uses the cross on Drascula and reads BJ's letter + void animation_19_6(); // Someone pops up from behind a door when trying to open it void update_1_pre(); void update_2(); diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index 9f725b6d76..ffac20acc8 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -374,16 +374,16 @@ bool DrasculaEngine::room_8(int fl) { } bool DrasculaEngine::room_9(int fl) { - if (pickedObject == kVerbTalk && fl == 51 && flags[4] == 0) + // Talking with the blind man + if (pickedObject == kVerbTalk && fl == 51) { animation_4_2(); - else if (pickedObject == kVerbTalk && fl == 51 && flags[4] == 1) - animation_33_2(); - else if (pickedObject == 7 && fl == 51) { + } else if (pickedObject == 7 && fl == 51) { animation_6_2(); removeObject(kItemMoney); - pickObject(14);} - else + pickObject(14); + } else { hasAnswer = 0; + } return true; } @@ -837,9 +837,9 @@ bool DrasculaEngine::room_35(int fl) { } bool DrasculaEngine::room_49(int fl) { - if (pickedObject == kVerbTalk && fl ==51) + if (pickedObject == kVerbTalk && fl == 51) converse(9); - else if ((pickedObject == 8 && fl == 51) || (pickedObject == 8 && fl == 203)) + else if (pickedObject == 8 && (fl == 51 || fl == 203)) animation_5_5(); else hasAnswer = 0; @@ -852,7 +852,13 @@ bool DrasculaEngine::room_53(int fl) { pickObject(16); visible[3] = 0; } else if (pickedObject == kVerbMove && fl == 123) { - animation_11_5(); + flags[9] = 1; + if (flags[2] == 1 && flags[3] == 1 && flags[4] == 1) { + animation_12_5(); + } else { + flags[9] = 0; + talk(33); + } } else if (pickedObject == 12 && fl == 52) { flags[3] = 1; talk(401); @@ -1649,7 +1655,7 @@ bool DrasculaEngine::room(int rN, int fl) { } } - // We did not find any parser, let default one work + // We did not find any parser, let the default one work hasAnswer = 0; } -- cgit v1.2.3