From 932399481a4463eb3f7a018913b2d7330a292c12 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 9 Sep 2008 15:59:06 +0000 Subject: - Cleanup and simplification - Moved several simple animations out of animation.cpp - Moved some animations with talk sequences inside drascula.dat - A new version of drascula.dat is needed (will be uploaded shortly) svn-id: r34464 --- engines/drascula/animation.cpp | 215 ----------------------------------------- engines/drascula/converse.cpp | 138 ++++++++++++++------------ engines/drascula/drascula.cpp | 13 ++- engines/drascula/drascula.h | 61 ++++++------ engines/drascula/rooms.cpp | 101 +++++++++++++------ 5 files changed, 190 insertions(+), 338 deletions(-) (limited to 'engines/drascula') diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp index 720506add1..5f0ad234e8 100644 --- a/engines/drascula/animation.cpp +++ b/engines/drascula/animation.cpp @@ -675,11 +675,6 @@ void DrasculaEngine::animation_4_1() { loadPic(97, extraSurface); } -void DrasculaEngine::animation_1_2() { - gotoObject(178, 121); - gotoObject(169, 135); -} - void DrasculaEngine::animation_2_2() { trackProtagonist = 0; copyBackground(); @@ -715,12 +710,6 @@ 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; @@ -791,32 +780,6 @@ void DrasculaEngine::animation_4_2() { 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 l = 0; @@ -847,14 +810,6 @@ 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); -} - void DrasculaEngine::animation_16_2() { talk_drunk(12); talk(371); @@ -1004,12 +959,6 @@ asco: stopMusic(); } -void DrasculaEngine::animation_17_2() { - talk_drunk(13); - talk_drunk(14); - flags[40] = 1; -} - void DrasculaEngine::animation_20_2() { talk_vonBraun(7, kVonBraunDoor); talk_vonBraun(8, kVonBraunDoor); @@ -1184,11 +1133,6 @@ void DrasculaEngine::animation_27_2() { talk_vonBraun(26, kVonBraunNormal); } -void DrasculaEngine::animation_28_2() { - for(int i = 27; i <= 30; i++) - talk_vonBraun(i, kVonBraunNormal); -} - void DrasculaEngine::animation_29_2() { if (flags[33] == 0) { talk_vonBraun(32, kVonBraunNormal); @@ -1220,11 +1164,6 @@ void DrasculaEngine::animation_29_2() { talk(386); } -void DrasculaEngine::animation_30_2() { - talk_vonBraun(31, kVonBraunNormal); - talk(396); -} - void DrasculaEngine::animation_31_2() { talk_vonBraun(44, kVonBraunNormal); placeVonBraun(-50); @@ -1302,13 +1241,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); @@ -1430,29 +1362,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); @@ -1506,33 +1415,6 @@ void DrasculaEngine::animation_1_5() { converse(8); } -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; @@ -1608,41 +1490,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) @@ -1817,14 +1664,6 @@ void DrasculaEngine::animation_14_5() { fadeToBlack(1); } -void DrasculaEngine::animation_15_5() { - talk_mus(4); - talk_mus(5); - talk_mus(6); - talk(291); - talk_mus(7); -} - void DrasculaEngine::animation_1_6() { trackProtagonist = 0; curX = 103; @@ -1943,11 +1782,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; @@ -2024,44 +1858,6 @@ void DrasculaEngine::animation_9_6() { stopMusic(); } -void DrasculaEngine::animation_10_6() { - playSound(14); - copyBackground(); - 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_14_6() { - talk_bartender(24, 1); - addObject(21); - flags[10] = 1; - breakOut = 1; -} - -void DrasculaEngine::animation_18_6() { - flags[6] = 1; - withoutVerb(); - removeObject(21); - animate("beb.bin", 10); -} - void DrasculaEngine::animation_19_6() { copyBackground(); copyBackground(140, 23, 161, 69, 35, 80, drawSurface3, screenSurface); @@ -2218,12 +2014,6 @@ void DrasculaEngine::animation_13_2() { loadPic(964, frontSurface); } -void DrasculaEngine::animation_18_2() { - talk(378); - talk_vonBraun(4, kVonBraunDoor); - converse(3); -} - void DrasculaEngine::animation_22_2() { talk(374); @@ -2658,11 +2448,6 @@ void DrasculaEngine::animation_8_4() { openDoor(7, 2); } -void DrasculaEngine::animation_9_4() { - animate("st.bin", 14); - fadeToBlack(1); -} - void DrasculaEngine::activatePendulum() { flags[1] = 2; hare_se_ve = 0; diff --git a/engines/drascula/converse.cpp b/engines/drascula/converse.cpp index da24ffd55a..fafbbe8685 100644 --- a/engines/drascula/converse.cpp +++ b/engines/drascula/converse.cpp @@ -27,6 +27,76 @@ namespace Drascula { +void DrasculaEngine::checkTalkSequence(int sequence) { + bool seen = false; + + for (int i = 0; i < _talkSequencesSize; i++) { + if (_talkSequences[i].chapter == currentChapter && + _talkSequences[i].sequence == sequence) { + seen = true; + + // do action + switch (_talkSequences[i].commandType) { + case kPause: + pause(_talkSequences[i].action); + break; + case kSetFlag: + flags[_talkSequences[i].action] = 1; + break; + case kClearFlag: + flags[_talkSequences[i].action] = 0; + break; + case kPickObject: + pickObject(_talkSequences[i].action); + break; + case kAddObject: + addObject(_talkSequences[i].action); + break; + case kBreakOut: + breakOut = 1; + break; + case kTalkerGeneral: + talk(_talkSequences[i].action); + break; + case kTalkerDrunk: + talk_drunk(_talkSequences[i].action); + break; + case kTalkerPianist: + talk_pianist(_talkSequences[i].action); + break; + case kTalkerBJ: + talk_bj(_talkSequences[i].action); + break; + case kTalkerVBNormal: + talk_vonBraun(_talkSequences[i].action, kVonBraunNormal); + break; + case kTalkerVBDoor: + talk_vonBraun(_talkSequences[i].action, kVonBraunDoor); + break; + case kTalkerIgorSeated: + talk_igor(_talkSequences[i].action, kIgorSeated); + break; + case kTalkerWerewolf: + talk_werewolf(_talkSequences[i].action); + break; + case kTalkerMus: + talk_mus(_talkSequences[i].action); + break; + case kTalkerDrascula: + talk_drascula(_talkSequences[i].action, 1); + break; + case kTalkerBartender: + talk_bartender(_talkSequences[i].action, 1); + break; + default: + error("checkTalkSequence: Unknown command"); + } + + } else if (seen) // Stop searching down the list + break; + } +} + void DrasculaEngine::cleanupString(char *string) { uint len = strlen(string); for (uint h = 0; h < len; h++) @@ -179,81 +249,21 @@ void DrasculaEngine::converse(int index) { } 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) + checkTalkSequence(function); + + if (currentChapter == 2) { + if (function == 16) animation_16_2(); - else if (function == 17) - animation_17_2(); - else if (function == 19) - talk_vonBraun(5, kVonBraunDoor); else if (function == 20) animation_20_2(); - else if (function == 21) - talk_vonBraun(6, kVonBraunDoor); 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 == 3) { grr(); - } 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) - talk_bj(22); - 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) - talk_mus(8); - else if (function == 17) - talk_mus(9); - } else if (currentChapter == 6) { - if (function == 2) - talk_drascula(24, 1); - else if (function == 3) - talk_drascula(24, 1); - else if (function == 4) - talk_drascula(25, 1); - else if (function == 11) - animation_11_6(); - else if (function == 12) - animation_12_6(); - else if (function == 13) - talk_bartender(15, 1); - else if (function == 14) - animation_14_6(); - else if (function == 15) - talk_bartender(16, 1); } } diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index ac402c82ba..ef6c9158d2 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -86,6 +86,7 @@ DrasculaEngine::~DrasculaEngine() { free(_roomPreUpdates); free(_roomUpdates); free(_roomActions); + free(_talkSequences); freeTexts(_text); freeTexts(_textd); freeTexts(_textb); @@ -440,7 +441,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); @@ -970,6 +972,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); diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h index 417674e8c3..98a48e3042 100644 --- a/engines/drascula/drascula.h +++ b/engines/drascula/drascula.h @@ -46,7 +46,7 @@ namespace Drascula { -#define DRASCULA_DAT_VER 2 +#define DRASCULA_DAT_VER 3 #define DATAALIGNMENT 4 enum DrasculaGameFeatures { @@ -157,6 +157,33 @@ enum DialogOptionStatus { kDialogOptionClicked = 3 }; +enum TalkSequenceCommands { + kPause = 0, + kSetFlag = 1, + kClearFlag = 2, + kPickObject = 3, + kAddObject = 4, + kBreakOut = 5, + kTalkerGeneral = 6, + kTalkerDrunk = 7, + kTalkerPianist = 8, + kTalkerBJ = 9, + kTalkerVBNormal = 10, + kTalkerVBDoor = 11, + kTalkerIgorSeated = 12, + kTalkerWerewolf = 13, + kTalkerMus = 14, + kTalkerDrascula = 15, + kTalkerBartender = 16 +}; + +struct TalkSequenceCommand { + int chapter; + int sequence; + int commandType; + int action; +}; + #define TEXTD_START 68 struct DrasculaGameDescription; @@ -506,6 +533,7 @@ public: void setupRoomsTable(); bool roomParse(int, int); void cleanupString(char *string); + void checkTalkSequence(int sequence); void converse(int); void print_abc_opc(const char *, int, int); void response(int); @@ -567,24 +595,16 @@ 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_20_2(); void animation_22_2(); void animation_23_2(); @@ -594,9 +614,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(); @@ -604,7 +622,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(); @@ -613,40 +630,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_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_1_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_14_6(); - void animation_18_6(); void animation_19_6(); void update_1_pre(); @@ -689,6 +688,7 @@ private: int _roomPreUpdatesSize; int _roomUpdatesSize; int _roomActionsSize; + int _talkSequencesSize; int _numLangs; char ***_text; @@ -715,6 +715,7 @@ private: int *_pianistX, *_drunkX; RoomUpdate *_roomPreUpdates, *_roomUpdates; RoomTalkAction *_roomActions; + TalkSequenceCommand *_talkSequences; char ***loadTexts(Common::File &in); void freeTexts(char ***ptr); diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp index e15d0950d1..39f7799ca5 100644 --- a/engines/drascula/rooms.cpp +++ b/engines/drascula/rooms.cpp @@ -365,11 +365,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 @@ -470,9 +473,11 @@ 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(); @@ -551,7 +556,8 @@ bool DrasculaEngine::room_21(int fl) { openDoor(0, 1); withoutVerb(); } else if (pickedObject == 21 && fl == 179) { - animation_9_4(); + animate("st.bin", 14); + fadeToBlack(1); return true; } else hasAnswer = 0; @@ -805,13 +811,19 @@ 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); + withoutVerb(); + removeObject(12); + } else if (pickedObject == 15 && fl == 52) { + flags[4] = 1; + talk(401); + withoutVerb(); + removeObject(15); + } else if (pickedObject == 16 && fl == 121) { flags[2] = 1; withoutVerb(); updateVisible(); @@ -887,10 +899,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; } @@ -964,17 +978,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(); 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; + withoutVerb(); + 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) { @@ -1822,8 +1846,26 @@ 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) { + 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); + } } updateRoom(); @@ -1831,7 +1873,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(); } @@ -1867,8 +1909,11 @@ bool DrasculaEngine::exitRoom(int l) { } 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; -- cgit v1.2.3