diff options
Diffstat (limited to 'engines/teenagent/callbacks.cpp')
-rw-r--r-- | engines/teenagent/callbacks.cpp | 4676 |
1 files changed, 2733 insertions, 1943 deletions
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 934727a478..2de81abb37 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -19,8 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "teenagent/scene.h" #include "teenagent/teenagent.h" +#include "teenagent/scene.h" +#include "teenagent/inventory.h" #include "teenagent/resources.h" #include "teenagent/dialog.h" @@ -33,159 +34,536 @@ namespace TeenAgent { #define GET_FLAG(addr) (res->dseg.get_byte(addr)) #define INC_FLAG(addr) (++*res->dseg.ptr(addr)) -void TeenAgentEngine::rejectMessage() { - Resources *res = Resources::instance(); - //random reject message: - uint i = _rnd.getRandomNumber(3); - //debug(0, "reject message: %s", (const char *)res->dseg.ptr(res->dseg.get_word(0x339e + 2 * i))); - displayMessage(res->dseg.get_word(0x339e + 2 * i)); +void TeenAgentEngine::fnIntro() { + hideActor(); + + loadScene(41, 139, 156, 3); + playSound(41, 12); + playAnimation(912, 1); + setOns(0, 108); + playSound(62, 8); + playSound(58, 40); + playAnimation(913, 1); + setOns(1, 109); + setLan(2, 1); + dialog->show(192, scene, 914, 915, textColorGoldDriver, textColorBankGuard, 2, 1); + displayCredits(dsAddr_introCredits1); + + loadScene(42, 139, 156, 3); + playSound(15, 20); + playAnimation(916, 1); + playSound(40, 18); + playSound(40, 22); + for (byte i = 27; i < 37; i += 2) + playSound(40, i); + playSound(29, 44); + playAnimation(918, 0, true); + playAnimation(917, 1, true); + waitAnimation(); + displayCredits(dsAddr_introCredits2); + + loadScene(40, 139, 156, 3); + playMusic(3); + dialog->show(193, scene, 920, 924, textColorRGBBoss, textColorFortuneTeller, 1, 2); + playSound(26, 50); + playAnimation(925, 0, true); + playAnimation(926, 1, true); + waitAnimation(); + dialog->show(194, scene, 927, 920, textColorFortuneTeller, textColorRGBBoss, 2, 1); + displayCredits(dsAddr_introCredits3); + + loadScene(39, 139, 156, 3); + playMusic(11); + playSound(81, 2); + playSound(81, 8); + playSound(81, 11); + playSound(81, 14); + playSound(81, 16); + playSound(81, 18); + playSound(81, 20); + playSound(81, 21); + playAnimation(928, 1); + setOns(0, 112); + dialog->showMono(195, scene, 929, textColorMark, 1); + showActor(); + moveTo(319, 150, 1, true); + moveTo(63, 150, 1); + displayAsyncMessage(dsAddr_HeyWtmQMsg, 4, 62, 18, 36); // hey, what's the matter? + playAnimation(851, 0, true); + playActorAnimation(930, true); + waitAnimation(); + playSound(24, 11); + playActorAnimation(931); + + displayCredits(dsAddr_introCredits4); + + playMusic(3); + loadScene(40, 50, 186, 1); + setOns(0, 113); + dialog->show(196, scene, 919, 0, textColorRGBBoss, textColorMark, 1, 0); + moveTo(196, 186, 1); + dialog->show(197, scene, 0, 920, textColorMark, textColorRGBBoss, 0, 1); + playActorAnimation(932); + dialog->show(198, scene, 0, 920, textColorMark, textColorRGBBoss, 0, 1); + playActorAnimation(932); + dialog->show(199, scene, 0, 920, textColorMark, textColorRGBBoss, 0, 1); + playActorAnimation(932); + dialog->show(200, scene, 0, 922, textColorMark, textColorRGBBoss, 0, 1); + playActorAnimation(933); + dialog->show(201, scene, 0, 920, textColorMark, textColorRGBBoss, 0, 1); + moveTo(174, 186, 1); + playAnimation(851, 0, true); + playActorAnimation(934, true); + waitAnimation(); + loadScene(10, 136, 153, 3); } +void TeenAgentEngine::fnPoleClimbFail() { + moveTo(86, 195, 1, true); + playActorAnimation(868); +} -bool TeenAgentEngine::processCallback(uint16 addr) { - if (addr == 0) - return false; +void TeenAgentEngine::fnGotAnchor() { + SET_FLAG(dsAddr_timedCallbackState, 0); + setTimerCallback(0, 0); + scene->getActorAnimation()->free(); + playSound(64, 7); + playActorAnimation(618); + disableObject(5); + setOns(0, 0); + playSound(31, 1); + playActorAnimation(619); + fnGetOutOfLake(); + inventory->add(kInvItemAnchor); + displayMessage(dsAddr_hookedAnchorMsg); // "I was really hooked on this anchor!" +} - Resources *res = Resources::instance(); - debug(0, "processCallback(%04x)", addr); - byte *code = res->cseg.ptr(addr); - - //try trivial callbacks first - if (code[0] == 0xbb && code[3] == 0xe8 && code[6] == 0xc3) { - //call display_message, r - uint16 msg = READ_LE_UINT16(code + 1); - uint16 func = 6 + addr + READ_LE_UINT16(code + 4); - debug(0, "call %04x", func); - //debug(0, "trivial callback, showing message %s", (const char *)res->dseg.ptr(addr)); - switch (func) { - case 0xa055: - displayMessage(msg); - return true; - } +void TeenAgentEngine::fnGetOutOfLake() { + loadScene(15, 156, 180, 3); + playSound(5, 5); + playSound(38, 14); + playSound(38, 20); + playSound(5, 25); + playActorAnimation(616); +} + +void TeenAgentEngine::fnGuardDrinking() { + SET_FLAG(dsAddr_timedCallbackState, 0); + setTimerCallback(0, 0); + scene->getAnimation(0)->free(); + SET_FLAG(dsAddr_scaredGuardAlreadyFlag, 1); + + displayAsyncMessage(dsAddr_BooMsg, 300, 130, 1, 5); // "Booo!" + setOns(0, 16); + enableObject(2); + + playSound(17, 5); + playAnimation(545, 0); + + dialog->show(5, scene, 0, 546, textColorMark, textColorMansionGuard, 0, 1); + SET_FLAG(dsAddr_spokenWithMansionGuardFlag, 1); + SET_FLAG(dsAddr_haveNotSpokenWithMansionGuardFlag, 0); +} + +void TeenAgentEngine::fnEgoDefaultPosition() { + if (scene->getPosition().y <= 149) + moveTo(94, 115, 4); + else + moveTo(51, 149, 4); +} + +void TeenAgentEngine::fnEnterCave() { + loadScene(24, 230, 170, 1); + playSound(52, 3); + playSound(52, 7); + playSound(52, 11); + playSound(52, 14); + playSound(52, 18); + playSound(52, 21); + playSound(52, 25); + playActorAnimation(601); + moveTo(230, 179, 3); + if (!CHECK_FLAG(dsAddr_lightOnFlag, 1)) + displayMessage(dsAddr_kindaDarkMsg); // "It's kinda dark here" +} + +void TeenAgentEngine::fnEgoScaredBySpider() { + if (CHECK_FLAG(dsAddr_egoAlreadyScaredBySpiderFlag, 1)) { + fnMoveToLadderAndLeaveCellar(); + dialog->showMark(75, scene); + } else { + dialog->showMark(73, scene); + fnMoveToLadderAndLeaveCellar(); + wait(100); + dialog->showMark(74, scene); + SET_FLAG(dsAddr_egoAlreadyScaredBySpiderFlag, 1); } +} - if (code[0] == 0xe8 && code[3] == 0xc3) { - uint func = 3 + addr + READ_LE_UINT16(code + 1); - debug(0, "call %04x and return", func); - if (func == 0xa4d6) { - rejectMessage(); +void TeenAgentEngine::fnMoveToLadderAndLeaveCellar() { + Object *objTemp = scene->getObject(3); + moveTo(objTemp); + fnLeaveCellar(); + moveTo(48, 190, 3); +} + +void TeenAgentEngine::fnLeaveCellar() { + playSound(52, 10); + playSound(52, 14); + playSound(52, 18); + playSound(52, 21); + playSound(52, 25); + playSound(52, 28); + playSound(52, 32); + playActorAnimation(600); + loadScene(21, 297, 178, 3); +} + +void TeenAgentEngine::fnPutRockInHole() { + if (CHECK_FLAG(dsAddr_timedCallbackState, 0)) { + playSound(5, 2); + playSound(15, 12); + playActorAnimation(638); + inventory->remove(kInvItemMouse); + setTimerCallback(csAddr_mouseOutOfHoleTimeout, 100); + SET_FLAG(dsAddr_timedCallbackState, 1); + } else if (CHECK_FLAG(dsAddr_timedCallbackState, 1)) { + playSound(5, 2); + playSound(52, 13); + playActorAnimation(648); + setOns(1, 46); + inventory->remove(kInvItemRock); + setTimerCallback(csAddr_mouseOutOfHoleTimeout, 100); + SET_FLAG(dsAddr_timedCallbackState, 2); + } else if (CHECK_FLAG(dsAddr_timedCallbackState, 2)) { + playActorAnimation(649); + setOns(1, 47); + wait(300); + for (byte i = 1; i <= 37; i += 4) + playSound(68, i); + playAnimation(639, 2); + setOns(0, 42); + enableObject(6); + disableObject(5); + SET_FLAG(dsAddr_mouseGotGoldNuggetFlag, 1); + SET_FLAG(dsAddr_timedCallbackState, 0); + setTimerCallback(0, 0); + } +} + +void TeenAgentEngine::fnEgoBottomRightTurn() { + Common::Point p = scene->getPosition(); + if (p.x == 208 && p.y == 151) + moveRel(0, 0, 2); + else + moveTo(208, 151, 1); +} + +bool TeenAgentEngine::fnCheckingDrawers() { + uint16 v = GET_FLAG(dsAddr_drawerPuzzleBookValue) - 1; + if (GET_FLAG(dsAddr_blueDrawerOpenFlag + v) != 1) + return false; + else { + uint16 sum = 0; + for (uint i = 0; i < 6; ++i) + sum += GET_FLAG(dsAddr_blueDrawerOpenFlag + i); + if (sum != 1) + return false; + else return true; - } } +} - if (code[0] == 0xc7 && code[1] == 0x06 && code[2] == 0xf3 && code[3] == 0xb4 && - code[6] == 0xb8 && code[9] == 0xbb && code[12] == 0xbf && - code[22] == 0xe8 && code[25] == 0xc3) { - loadScene(code[4], Common::Point( - (READ_LE_UINT16(code + 7) + READ_LE_UINT16(code + 13) + 1) / 2 , - READ_LE_UINT16(code + 10))); - scene->setOrientation(code[21]); +void TeenAgentEngine::fnDrawerOpenMessage() { + if (CHECK_FLAG(dsAddr_drawerPuzzleHintGivenFlag, 1)) + displayMessage(dsAddr_drawerOpenMsg); // "I cannot open the drawer if the next one is open!" + else { + displayMessage(dsAddr_strangeDrawerMsg); // "Strange, but the drawer is stuck if the next drawer is open" + displayMessage(dsAddr_notOrdinaryDrawersMsg); // "Maybe these are not just ordinary drawers!" + SET_FLAG(dsAddr_drawerPuzzleHintGivenFlag, 1); + } +} + +bool TeenAgentEngine::fnRobotSafeAlreadyUnlockedCheck() { + if (CHECK_FLAG(dsAddr_MansionRobotSafeUnlockedFlag, 1)) { return true; + } else { + displayMessage(dsAddr_noReasonMsg); // "There's no reason to do it" + return false; } +} - switch (addr) { +void TeenAgentEngine::fnRobotSafeUnlockCheck() { + if (CHECK_FLAG(dsAddr_MansionRobotSafeVoiceTestPassedFlag, 1) && + CHECK_FLAG(dsAddr_MansionRobotSafeScentTestPassedFlag, 1) && + CHECK_FLAG(dsAddr_MansionRobotSafeViewTestPassedFlag, 1)) { + waitLanAnimationFrame(1, 1); + playSound(89, 2); + playActorAnimation(731); + setOns(0, 70); + setLan(1, 0); + disableObject(1); + enableObject(2); + enableObject(3); + } +} - case 0x024c: //intro - hideActor(); +bool TeenAgentEngine::fnMansionIntrusionAttempt() { + wait(50); + byte attempts = res->dseg.get_byte(dsAddr_mansionEntryCount) + 1; + res->dseg.set_byte(dsAddr_mansionEntryCount, attempts); + debugC(0, kDebugCallbacks, "mansion intrusion attempt #%u", attempts); + if (attempts >= 7) + return false; + else { + byte id = scene->getId(); - loadScene(41, 139, 156, 3); - playSound(41, 12); - playAnimation(912, 1); - setOns(0, 108); - playSound(62, 8); - playSound(58, 40); - playAnimation(913, 1); - setOns(1, 109); - setLan(2, 1); - Dialog::show(scene, 0x748e, 914, 915, 0xe7, 0xd7, 2, 1); - displayCredits(0xe3c2); - - loadScene(42, 139, 156, 3); - playSound(15, 20); - playAnimation(916, 1); - playSound(40, 18); - playSound(40, 22); - for (byte i = 27; i < 37; i += 2) - playSound(40, i); - playSound(29, 44); - playAnimation(918, 0, true); - playAnimation(917, 1, true); - waitAnimation(); - displayCredits(0xe3e6); + playMusic(11); + displayCutsceneMessage(dsAddr_cutsceneMsg2, 84, 95); // "Meanwhile in the mansion" + switch (attempts) { + case 2: + fnSecondMansionIntrusion(); + break; + case 3: + fnThirdMansionIntrusion(); + break; + case 4: + fnFourthMansionIntrusion(); + break; + case 5: + fnFifthMansionIntrusion(); + break; + case 6: + fnSixthMansionIntrusion(); + break; + default: + error("mansion intrusion attempts out of range!"); + break; + } + playMusic(6); + if (getFlag(dsAddr_johnNotyOutsideMansionDoorFlag) != 1 || attempts != 6) + loadScene(id, scene->getPosition()); + return true; + } +} - loadScene(40, 139, 156, 3); - playMusic(3); - Dialog::show(scene, 0x750d, 920, 924, 0xe7, 0xeb, 1, 2); //as i told you, our organization... - playSound(26, 50); - playAnimation(925, 0, true); - playAnimation(926, 1, true); - waitAnimation(); - Dialog::show(scene, 0x78a6, 927, 920, 0xeb, 0xe7, 2, 1); - displayCredits(0xe3ff); +void TeenAgentEngine::fnSecondMansionIntrusion() { + hideActor(); + loadScene(34, scene->getPosition()); + playAnimation(986, 0, true); + playAnimation(987, 1, true); + waitAnimation(); + dialog->show(178, scene, 988, 989, textColorMansionGuard, textColorJohnNoty, 1, 2); + playAnimation(990, 0, true); + playAnimation(991, 1, true); + waitAnimation(); + showActor(); +} - loadScene(39, 139, 156, 3); - playMusic(11); - playSound(81, 2); - playSound(81, 8); - playSound(81, 11); - playSound(81, 14); - playSound(81, 16); - playSound(81, 18); - playSound(81, 20); - playSound(81, 21); - playAnimation(928, 1); - setOns(0, 112); - Dialog::showMono(scene, 0x78e1, 929, 0xd1, 1); //he's coming - showActor(); - moveTo(319, 150, 1, true); - moveTo(63, 150, 1); - displayAsyncMessage(0x5da8, 19844, 18, 36); //hey, what's the matter? - playAnimation(851, 0, true); - playActorAnimation(930, true); - waitAnimation(); - playSound(24, 11); - playActorAnimation(931); +void TeenAgentEngine::fnThirdMansionIntrusion() { + hideActor(); + loadScene(30, scene->getPosition()); + playAnimation(887, 1); + playAnimation(888, 2, true, true, true); + //waitAnimation(); + dialog->showMono(179, scene, 889, textColorMansionGuard, 2); + playSound(26, 3); + playAnimation(891, 1, true, true, true); + playAnimation(892, 2); + waitAnimation(); + dialog->show(180, scene, 890, 889, textColorJohnNoty, textColorMansionGuard, 3, 2); + showActor(); +} - displayCredits(0xe42f); +void TeenAgentEngine::fnFourthMansionIntrusion() { + hideActor(); + loadScene(32, scene->getPosition()); + playAnimation(894, 1, true, true, true); + playAnimation(893, 2, true); + waitAnimation(); + dialog->showMono(181, scene, 895, textColorMansionGuard, 3); + playSound(75, 9); + playAnimation(898, 1, true); + playAnimation(897, 2, true); + dialog->show(182, scene, 896, 895, textColorJohnNoty, textColorMansionGuard, 2, 3); + showActor(); +} - playMusic(3); - loadScene(40, 50, 186, 1); - setOns(0, 113); - Dialog::show(scene, 0x78f1, 919, 0, 0xe7, 0xd1, 1, 0); - moveTo(196, 186, 1); - Dialog::show(scene, 0x7958, 0, 920, 0xd1, 0xe7, 0, 1); - playActorAnimation(932); - Dialog::show(scene, 0x7e07, 0, 920, 0xd1, 0xe7, 0, 1); - playActorAnimation(932); - Dialog::show(scene, 0x7e1a, 0, 920, 0xd1, 0xe7, 0, 1); - playActorAnimation(932); - Dialog::show(scene, 0x7e2c, 0, 922, 0xd1, 0xe7, 0, 1); - playActorAnimation(933); - Dialog::show(scene, 0x7e70, 0, 920, 0xd1, 0xe7, 0, 1); - moveTo(174, 186, 1); - playAnimation(851, 0, true); - playActorAnimation(934, true); - waitAnimation(); - loadScene(10, 136, 153, 3); +void TeenAgentEngine::fnFifthMansionIntrusion() { + hideActor(); + loadScene(29, scene->getPosition()); + playActorAnimation(901, true); + playAnimation(900, 1, true); + waitAnimation(); + dialog->show(183, scene, 903, 902, textColorJohnNoty, textColorMansionGuard, 2, 3); + for (byte i = 3; i <= 9; i += 2) + playSound(56, i); + + playActorAnimation(905, true); + playAnimation(904, 1, true); + dialog->show(184, scene, 903, 902, textColorJohnNoty, textColorMansionGuard, 2, 3); + showActor(); +} + +void TeenAgentEngine::fnSixthMansionIntrusion() { + hideActor(); + loadScene(35, scene->getPosition()); + playAnimation(907, 2, true); + playAnimation(906, 3, true); + waitAnimation(); + dialog->show(185, scene, 908, 909, textColorMansionGuard, textColorJohnNoty, 2, 3); + dialog->show(186, scene, 910, 908, textColorJohnNoty, textColorMansionGuard, 3, 2); + loadScene(11, scene->getPosition()); + showActor(); + setOns(3, 51); + playAnimation(911, 1); + playAnimation(899, 1); + setFlag(dsAddr_johnNotyOutsideMansionDoorFlag, 1); + reloadLan(); + wait(200); + enableObject(8); + setLan(2, 8); +} +void TeenAgentEngine::fnTooDark() { + displayMessage(dsAddr_TooDarkMsg); // "It's too dark to see clearly" +} + +bool TeenAgentEngine::fnIsCookGone() { + if (CHECK_FLAG(dsAddr_MansionCookGoneFlag, 1)) { return true; + } else { + displayMessage(dsAddr_cookAroundMsg); // "I can't do anything with this cook around" + return false; + } +} + +void TeenAgentEngine::fnEgoSuspiciousPosition() { + Common::Point p = scene->getPosition(); + if (p.x != 203 && p.y != 171) + moveTo(203, 169, 2); + else + moveTo(203, 169, 1); +} + +void TeenAgentEngine::fnGivingFlowerToOldLady() { + playSound(5, 2); + dialog->show(37, scene, 0, 523, textColorMark, textColorOldLady, 0, 1); + playActorAnimation(537, true); + playAnimation(538, 0, true); + waitAnimation(); + wait(100); + dialog->show(38, scene, 0, 523, textColorMark, textColorOldLady, 0, 1); +} + +void TeenAgentEngine::fnGiveAnotherFlowerToOldLady() { + dialog->pop(scene, dsAddr_dialogStackOldLady, 0, 523, textColorMark, textColorOldLady, 0, 1); +} + +void TeenAgentEngine::fnGivingFlowerToAnne() { + dialog->show(53, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + playSound(5, 10); + playActorAnimation(540, true); + playAnimation(539, 1, true); + waitAnimation(); + wait(100); + dialog->show(54, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + wait(50); + dialog->show(55, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + dialog->show(56, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + wait(50); + moveRel(0, 1, 0); + dialog->show(57, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + moveRel(0, -1, 0); + wait(50); +} + +void TeenAgentEngine::fnGiveAnotherFlowerToAnne() { + dialog->pop(scene, dsAddr_dialogStackAnotherFlowerToAnne, 0, 524, textColorMark, textColorAnne, 0, 2); +} + +void TeenAgentEngine::rejectMessage() { + uint i = _rnd.getRandomNumber(3); + switch (i) { + case 0: + displayMessage(dsAddr_rejectMsg0); // "I have no idea what to do with it" + break; + case 1: + displayMessage(dsAddr_rejectMsg1); // "I can't imagine what I could do with this" + break; + case 2: + displayMessage(dsAddr_rejectMsg2); // "I can't figure out what I should do with this" + break; + case 3: + displayMessage(dsAddr_rejectMsg3); // "I can't find any reason to mess with it" + break; + default: + error("rejectMessage() index out of range"); + break; + } +} + +bool TeenAgentEngine::processCallback(uint16 addr) { + if (addr == 0) + return false; + + debugC(0, kDebugCallbacks, "processCallback(%04x)", addr); + + bool retVal = true; + switch (addr) { + case csAddr_intro: // intro + fnIntro(); + break; + + case 0x3fed: + loadScene(3, Common::Point(305, 104)); + scene->setOrientation(4); + break; + + case 0x4007: + loadScene(5, Common::Point(300, 131)); + scene->setOrientation(3); + break; case 0x4021: - //pulling out mysterious object - if (CHECK_FLAG(0xdbe1, 1)) { + // pulling out mysterious object + if (CHECK_FLAG(dsAddr_cutFenceFlag, 1)) { playActorAnimation(844); playActorAnimation(846); playActorAnimation(845); - displayMessage(0x5696); + displayMessage(dsAddr_pullObjMsg1); // "I can't pull it out" } else { - displayMessage(0x570f); + displayMessage(dsAddr_pullObjMsg2); // "I can't reach it" } - return true; - - case 0x4094: //climbing to the pole near mudpool - if (CHECK_FLAG(0xDBE4, 1)) { - displayMessage(0x57b2); - return true; + break; + + case 0x4048: + displayMessage(dsAddr_dontWantToTouchMsg); // "I don't want to touch it - I might get hurt" + break; + + case 0x404f: + displayMessage(dsAddr_notWantToSleepMsg); // "I don't want to sleep" + break; + + case 0x4056: + // FIXME - This is the bird use callback in the first act at + // the mudpool. Current Code based on behaviour. Need to analyse cseg data. + dialog->popMark(scene, dsAddr_dialogStackMudpoolBird); + break; + + case 0x4060: + loadScene(2, Common::Point(28, 180)); + scene->setOrientation(2); + break; + + case 0x407a: + loadScene(4, Common::Point(297, 128)); + scene->setOrientation(4); + break; + + case 0x4094: // climbing to the pole near mudpool + if (CHECK_FLAG(dsAddr_gotMugOfMudFlag, 1)) { + displayMessage(dsAddr_poleClimbDoneMsg); // "Never Again!" } else { for (byte i = 11; i <= 27; i += 4) playSound(76, i); @@ -196,39 +574,49 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(865, 1); playActorAnimation(866); //InventoryObject *obj = inventory->selectedObject(); - //if (obj != NULL && obj->id == 0x55) { + //if (obj != NULL && obj->id == kInvItemMug) { - //implement pause and using real object: - if (inventory->has(0x55)) { + // FIXME: implement pause in mudpool and using of Mug object, as per original interpreter + if (inventory->has(kInvItemMug)) { playSound(5, 4); playSound(5, 19); playSound(64, 11); playActorAnimation(867); - inventory->remove(0x55); - inventory->add(0x56); + inventory->remove(kInvItemMug); + inventory->add(kInvItemMugOfMud); moveTo(86, 195, 1, true); playActorAnimation(868); - SET_FLAG(0xDBE4, 1); + SET_FLAG(dsAddr_gotMugOfMudFlag, 1); } else { - processCallback(0x4173); - Dialog::pop(scene, 0xDB72, 0, 0, 0xd1, 0xd1, 0, 0); + fnPoleClimbFail(); + dialog->popMark(scene, dsAddr_dialogStackFallIntoMudpool); } - return true; } - case 0x4173: - //fail! - moveTo(86, 195, 1, true); - playActorAnimation(868); - return true; + break; + + case csAddr_poleClimbFail: + fnPoleClimbFail(); + break; - case 0x419c: //getting the bird + case 0x4195: + displayMessage(dsAddr_preferWaterMsg); // "I prefer water" + break; + + case 0x419c: // getting the bird setOns(0, 0); playSound(56, 10); playActorAnimation(875); disableObject(6); - inventory->add(0x5c); - return true; + inventory->add(kInvItemBird); + break; + case 0x41c3: + displayMessage(dsAddr_pullObjMsg2); // "I can't reach it" + break; + + case 0x41ca: + rejectMessage(); + break; case 0x41ce: moveTo(197, 159, 4); @@ -236,9 +624,23 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(71, 8); playActorAnimation(833); moveTo(225, 159, 4); - inventory->add(0x4e); + inventory->add(kInvItemDelicatePlant); disableObject(3); - return true; + break; + + case 0x422c: + displayMessage(dsAddr_tooWeakToClimbMsg); // "I'm too weak to climb it" + break; + + case 0x4233: + loadScene(3, Common::Point(216, 199)); + scene->setOrientation(1); + break; + + case 0x424d: + loadScene(5, Common::Point(18, 174)); + scene->setOrientation(2); + break; case 0x4267: hideActor(); @@ -252,92 +654,111 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(5, 26); playActorAnimation(842); wait(100); - //shown in different positions - displayMessage(0x5656, 0xd1, 0x5510); + // shown in different positions + displayMessage(dsAddr_fnMsg2, textColorMark, 16, 68); // "And how am I supposed to get back?" wait(50); - displayMessage(0x567a, 0xd1, 0x555c); + displayMessage(dsAddr_fnMsg3, textColorMark, 92, 68); // "Great" wait(50); - displayMessage(0x5682, 0xd1, 0x553e); + displayMessage(dsAddr_fnMsg4, textColorMark, 62, 68); // "Oh, yeah, right" wait(50); playActorAnimation(843); showActor(); moveTo(223, 149, 0, true); disableObject(7); disableObject(1); - inventory->add(0x51); - displayMessage(0x5646); - return true; + inventory->add(kInvItemShovelAct1); + displayMessage(dsAddr_fnMsg1); // "Piece of cake" + break; + + case 0x433a: + loadScene(10, Common::Point(294, 183)); + scene->setOrientation(4); + break; + + case 0x4354: + loadScene(4, Common::Point(300, 185)); + scene->setOrientation(4); + break; + + case 0x436e: + loadScene(2, Common::Point(219, 199)); + scene->setOrientation(1); + break; case 0x4388: playSound(80, 4); playActorAnimation(961); loadScene(8, 155, 199, 1); - return true; + break; - case 0x43b5: //HQ, first trial - prison + case 0x43b5: // HQ, first trial - prison playSound(70, 6); playActorAnimation(962); loadScene(7, 30, 184, 2); - if (res->dseg.get_byte(0xDBDF) < 2) { + if (res->dseg.get_byte(dsAddr_FirstActTrialState) < 2) { wait(150); moveTo(134, 167, 2); - displayMessage(0x54f7); + displayMessage(dsAddr_firstTrialMsg); // "Sir, I'm Mark. A rookie" setLan(1, 0); playAnimation(812, 0, true); playActorAnimation(811); - Dialog::show(scene, 0x6117, 0, 813, 0xd1, 0xec, 0, 1); + dialog->show(148, scene, 0, 813, textColorMark, textColorCaptain, 0, 1); loadScene(6, 230, 184); playMusic(5); - Dialog::show(scene, 0x626a, 0, 814, 0xd1, 0xec, 0, 1); + dialog->show(149, scene, 0, 814, textColorMark, textColorCaptain, 0, 1); playSound(4, 14); playAnimation(815, 0); setOns(1, 0); - Dialog::showMono(scene, 0x62dc, 0, 0xd1, 0); + dialog->showMono(150, scene, 0, textColorMark, 0); - SET_FLAG(0xDBDF, 1); + SET_FLAG(dsAddr_FirstActTrialState, 1); } - return true; + break; case 0x4482: - if (CHECK_FLAG(0xDBDF, 0)) { + if (CHECK_FLAG(dsAddr_FirstActTrialState, 0)) { playActorAnimation(968); - displayMessage(0x5511); + displayMessage(dsAddr_lockedMsg); // "It's Locked!" } else { playSound(80, 3); playSound(79, 4); playActorAnimation(968); loadScene(6, 280, 186, 4); } - return true; + break; - case 0x44fc: //pull out spring from bed + case 0x44fc: // pull out spring from bed playSound(53, 25); playSound(24, 27); playSound(5, 36); playActorAnimation(839); moveTo(278, scene->getPosition().y, 0, true); - inventory->add(0x50); + inventory->add(kInvItemSpring); disableObject(1); - return true; + break; case 0x44cb: - if (CHECK_FLAG(0xDBE5, 1)) { - displayMessage(0x57c0); + if (CHECK_FLAG(dsAddr_gotRopeAct1Flag, 1)) { + displayMessage(dsAddr_vacMsg); // "What am I? A vacuum cleaner?!" } else { playSound(49, 14); playSound(5, 21); playActorAnimation(869); - inventory->add(0x58); - SET_FLAG(0xDBE5, 1); + inventory->add(kInvItemRopeAct1); + SET_FLAG(dsAddr_gotRopeAct1Flag, 1); } - return true; + break; + + case 0x4532: + displayMessage(dsAddr_springPrickMsg); // "The springs would prick my back" + break; - case 0x4539: //prison cell: use crates - if (CHECK_FLAG(0xdbdd, 2)) { - //finished the meal - trap - displayMessage(0x55c0); + case 0x4539: // prison cell: use crates + if (CHECK_FLAG(dsAddr_JailCableAndBowlState, 2)) { + // finished the meal - trap + displayMessage(dsAddr_mealFinishedMsg); // "Hey! I finished my meal." moveTo(306, 196, 2); wait(50); //playAnimation(825, 1); //very long empty animation. what for? @@ -354,66 +775,65 @@ bool TeenAgentEngine::processCallback(uint16 addr) { loadScene(6, scene->getPosition()); setOns(3, 0x5b); wait(50); - displayMessage(0x55db); - SET_FLAG(0xdbdd, 3); + displayMessage(dsAddr_bowlWeldedMsg); // "Wow. He got welded to the bowl" + SET_FLAG(dsAddr_JailCableAndBowlState, 3); scene->getObject(4)->setName("body"); } else { - if (Dialog::pop(scene, 0xdb5c, 0, 0, 0xd1, 0xd1, 0, 0) != 0x636b) //not 'im getting hungry' - return true; - - wait(100); - playSound(52, 8); - playSound(52, 13); - playAnimation(820, 1); - setOns(3, 0x59); - wait(50); - moveTo(scene->getPosition().x, scene->getPosition().y + 1, 3); - wait(150); - moveTo(scene->getPosition().x, scene->getPosition().y - 1, 2); - wait(100); - displayMessage(0x551f); - enableObject(4); - SET_FLAG(0xdbdc, 1); + if (dialog->pop(scene, dsAddr_dialogStackJailDoorGrates, 0, 0, textColorMark, textColorMark, 0, 0) == 0x636b) { // 'im getting hungry' + wait(100); + playSound(52, 8); + playSound(52, 13); + playAnimation(820, 1); + setOns(3, 0x59); + wait(50); + moveTo(scene->getPosition().x, scene->getPosition().y + 1, 3); + wait(150); + moveTo(scene->getPosition().x, scene->getPosition().y - 1, 2); + wait(100); + displayMessage(dsAddr_ThanksMsg); // "Thanks." + enableObject(4); + SET_FLAG(dsAddr_GotFoodBowlInJailFlag, 1); + } } - return true; + break; case 0x4662: - if (CHECK_FLAG(0xDBDD, 3)) { - if (CHECK_FLAG(0xDBDE, 1)) { - displayMessage(0x5608); + if (CHECK_FLAG(dsAddr_JailCableAndBowlState, 3)) { + if (CHECK_FLAG(dsAddr_GotJailKeyFlag, 1)) { + displayMessage(dsAddr_noPocketMsg); // "I don't want to touch his pockets again." } else { moveTo(280, 179, 2); playSound(49, 7); playSound(5, 17); playActorAnimation(827); - inventory->add(0x4d); - SET_FLAG(0xDBDE, 1); + inventory->add(kInvItemJailKey); + SET_FLAG(dsAddr_GotJailKeyFlag, 1); } } else - displayMessage(0x5905); - return true; + displayMessage(dsAddr_foodAliveMsg); // "No, thanks. This food seems still alive" + break; - case 0x46af: //prison cell: use live cable - if (CHECK_FLAG(0xdbdc, 1)) { - displayMessage(0x555d); + case 0x46af: // prison cell: use live cable + if (CHECK_FLAG(dsAddr_GotFoodBowlInJailFlag, 1)) { + displayMessage(dsAddr_ideaMsg); // "That gives me an idea" setOns(2, 0); playActorAnimation(821); setOns(2, 0x5a); setOns(3, 0); playSound(22, 2); playActorAnimation(822); - displayMessage(0x5577); + displayMessage(dsAddr_checkWorksMsg); // "Now I got to check if it works" disableObject(5); - SET_FLAG(0xdbdd, 1); + SET_FLAG(dsAddr_JailCableAndBowlState, 1); } else - displayMessage(0x5528); - return true; + displayMessage(dsAddr_unkUsageMsg); // "I don't have any idea what to do with it right now" + break; - case 0x4705: //prison: getting lamp bulb + case 0x4705: // prison: getting lamp bulb wait(50); moveTo(144, 185, 4); playSound(56, 15); - setOns(0, 86); //hiding lamp + setOns(0, 86); // hiding lamp playActorAnimation(816, true); playAnimation(817, 0, true); waitAnimation(); @@ -430,69 +850,102 @@ bool TeenAgentEngine::processCallback(uint16 addr) { disableObject(6); enableObject(5); - inventory->add(0x4c); - return true; + inventory->add(kInvItemBulb); + break; - case 0x4794: //prison cell door - if (res->dseg.get_byte(0xDBDF) >= 2) { + case 0x4794: // prison cell door + if (res->dseg.get_byte(dsAddr_FirstActTrialState) >= 2) { loadScene(5, 287, 143); } else { - displayMessage(0x592f); + displayMessage(dsAddr_doorClosedMsg); // "The door is closed. What a surprise." } - return true; + break; - case 0x47bc: //prison: examining trash can + case 0x47bc: // prison: examining trash can playSound(79, 5); playSound(1, 14); playActorAnimation(966); - displayMessage(0x5955); - return true; + displayMessage(dsAddr_emptyMsg); // "It's Empty" + break; - case 0x47db: //prison: use switch - if (CHECK_FLAG(0xDBDF, 1)) { + case 0x47db: // prison: use switch + if (CHECK_FLAG(dsAddr_FirstActTrialState, 1)) { playSound(71, 4); playActorAnimation(823); - if (CHECK_FLAG(0xDBDD, 0)) { - displayMessage(0x4d80); + if (CHECK_FLAG(dsAddr_JailCableAndBowlState, 0)) { + displayMessage(dsAddr_NotHappenMsg); // "Nothing happened" } else { playSound(74, 1); playAnimation(824, 1); - if (CHECK_FLAG(0xDBDD, 1)) { + if (CHECK_FLAG(dsAddr_JailCableAndBowlState, 1)) { wait(100); - displayMessage(0x559a); - SET_FLAG(0xDBDD, 2); + displayMessage(dsAddr_timeToCallMsg); // "I think it is time to call captain" + SET_FLAG(dsAddr_JailCableAndBowlState, 2); } } } else { - displayMessage(0x52f6); + displayMessage(dsAddr_nahMsg); // "Nah" } - return true; + break; + + case 0x4836: + rejectMessage(); + break; case 0x4871: playActorAnimation(965); - displayMessage(0x5511); - return true; + displayMessage(dsAddr_lockedMsg); // "It's Locked!" + break; + + case 0x487e: + displayMessage(dsAddr_geographyClassMsg); // "I should have paid more attention in geography classes." + break; + + case 0x4885: + displayMessage(dsAddr_dontNeedMessMsg); // "I don't need this mess" + break; + + case 0x488c: + displayMessage(dsAddr_seenSofterRocksMsg); // "Thanks, but I've seen softer rocks" + break; - case 0x4893: //taking pills - if (CHECK_FLAG(0xDBE6, 1)) { - SET_FLAG(0xDBE6, 2); + case 0x4893: // taking pills + if (CHECK_FLAG(dsAddr_captainDrawerState, 1)) { + SET_FLAG(dsAddr_captainDrawerState, 2); setOns(1, 0x67); playSound(5, 9); playActorAnimation(872); - inventory->add(0x5a); + inventory->add(kInvItemMedicine); disableObject(7); } else { playActorAnimation(964); - displayMessage(0x5511); + displayMessage(dsAddr_lockedMsg); // "It's Locked!" } - return true; + break; + + case 0x48d4: + displayMessage(dsAddr_tooBluntMsg); // "They are too blunt to be of any use" + break; + + case 0x48db: + displayMessage(dsAddr_uselessModelsMsg); // "What's the use of the models?" + break; + + case 0x48e2: + case 0x48e6: + rejectMessage(); + break; + + case 0x4911: + displayMessage(dsAddr_barmanWillNoticeMsg); // "The barman will surely notice its disappearing" + break; - case 0x4918: //talking with barmen - if (CHECK_FLAG(0xDBE7, 1)) { + case 0x4918: // talking with barmen + if (CHECK_FLAG(dsAddr_birdOnBarRadioAntennaFlag, 1)) { moveTo(140, 152, 1); - if (CHECK_FLAG(0xDBE8, 1)) { - Dialog::showMono(scene, 0x6f20, 0, 0xd1, 0); //aren't you thirsty? - displayMessage(0x5883, 0xef, 21472); + if (CHECK_FLAG(dsAddr_swappedBarmanMugFlag, 1)) { + dialog->showMono(177, scene, 0, textColorMark, 0); + displayMessage(dsAddr_yeahRightMsg, textColorBarman, 32, 67); // "Yeah right!" //reloadLan(); setLan(1, 0); playAnimation(882, 0); @@ -504,86 +957,145 @@ bool TeenAgentEngine::processCallback(uint16 addr) { shakeScreen(); disableObject(1); disableObject(2); - SET_FLAG(0xDBE9, 1); + SET_FLAG(dsAddr_barmanPassedOutFlag, 1); } else - displayMessage(0x5855); + displayMessage(dsAddr_talkNotNowMsg); // "I've got no reason to talk to him right now." } else { - if (CHECK_FLAG(0xDBDF, 3)) { - if (CHECK_FLAG(0xDBE3, 1)) { - Dialog::show(scene, 0x6BD6, 0, 857, 0xd1, 0xef, 0, 1); + if (CHECK_FLAG(dsAddr_FirstActTrialState, 3)) { + if (CHECK_FLAG(dsAddr_spokeToBarmanAboutThirdTrialFlag, 1)) { + dialog->show(168, scene, 0, 857, textColorMark, textColorBarman, 0, 1); } else { - Dialog::show(scene, 0x69B5, 0, 857, 0xd1, 0xef, 0, 1); //taking mug + dialog->show(166, scene, 0, 857, textColorMark, textColorBarman, 0, 1); // taking mug playActorAnimation(859, true); playAnimation(858, 0, true); waitAnimation(); playSound(75, 6); playActorAnimation(860); - Dialog::show(scene, 0x69C2, 0, 857, 0xd1, 0xef, 0, 1); - inventory->add(0x55); - SET_FLAG(0xDBE3, 1); - SET_FLAG(0xDBF0, 0); + dialog->show(167, scene, 0, 857, textColorMark, textColorBarman, 0, 1); + inventory->add(kInvItemMug); + SET_FLAG(dsAddr_spokeToBarmanAboutThirdTrialFlag, 1); + SET_FLAG(dsAddr_gotPasswordNeedSpeakBarmanFlag, 0); } } else { - Dialog::pop(scene, 0xDB68, 0, 857, 0xd1, 0xef, 0, 1); + dialog->pop(scene, dsAddr_dialogStackBarman, 0, 857, textColorMark, textColorBarman, 0, 1); } } - return true; + break; - case 0x4f14: //use the hollow - displayMessage(CHECK_FLAG(0xDBA1, 1) ? 0x370f : 0x36c2); - return true; + case 0x4d7d: + case 0x4d81: + rejectMessage(); + break; + + case 0x4d89: + displayMessage(dsAddr_getRidOfGuardFirstMsg); // "If I want to get inside I must get rid of this guard first..." + break; + + case 0x4d90: + rejectMessage(); + break; + + case 0x4e47: + loadScene(13, Common::Point(9, 172)); + scene->setOrientation(2); + break; + + case 0x4e85: + loadScene(15, Common::Point(291, 162)); + scene->setOrientation(4); + break; + + case 0x4e9f: + loadScene(12, Common::Point(310, 152)); + scene->setOrientation(4); + break; + + case 0x4f14: // use the hollow + if (CHECK_FLAG(dsAddr_mansionTreeHollowEmptyFlag, 1)) + displayMessage(dsAddr_totalEmptyMsg); // "I can see it's totally empty" + else + displayMessage(dsAddr_noHandsMsg); // "I'd better not put my hands in there..." + break; case 0x4a64: - if (CHECK_FLAG(0xDBF0, 1)) { - displayMessage(0x5e25); - } else { + if (CHECK_FLAG(dsAddr_gotPasswordNeedSpeakBarmanFlag, 1)) + displayMessage(dsAddr_firstBusinessMsg); // "First I've got some business to take care of" + else loadScene(5, 35, 162); - } - return true; + break; case 0x4bf5: playActorAnimation(959); loadScene(8, 40, 152, 3); - return true; + break; + + case 0x4c18: + rejectMessage(); + break; + + case 0x4c29: + displayMessage(dsAddr_tooManyToSearchMsg); // "There are too many of them to search" + break; + + case 0x4c30: + case 0x4c37: + displayMessage(dsAddr_captainWouldNotFitMsg); // "Captain surely wouldn't fit them. I must look elsewhere" + break; case 0x483a: - Dialog::pop(scene, 0xdb82, 0, 0, 0xd1, 0xd1, 0, 0); - return true; + dialog->popMark(scene, dsAddr_dialogStackInterrogateCaptain); + break; case 0x4844: playSound(80, 4); playActorAnimation(963); loadScene(5, 166, 158); - return true; + break; case 0x48ea: setOns(0, 0); playSound(5, 9); playActorAnimation(836); - inventory->add(0x4f); + inventory->add(kInvItemSwissArmyKnife); disableObject(12); - return true; + break; case 0x4a8c: - if (CHECK_FLAG(0xDBE9, 1)) { + if (CHECK_FLAG(dsAddr_barmanPassedOutFlag, 1)) { playSound(89, 5); playActorAnimation(958); loadScene(9, 240, 182, 4); - } else if (CHECK_FLAG(0xDBE7, 1)) { - displayMessage(0x5894); + } else if (CHECK_FLAG(dsAddr_birdOnBarRadioAntennaFlag, 1)) { + displayMessage(dsAddr_barmanTooCloseMsg); // "The barman is too close" } else { - Dialog::pop(scene, 0xDB8A, 0, 857, 0xd1, 0xef, 0, 1); + dialog->pop(scene, dsAddr_dialogStackBarCellarDoor, 0, 857, textColorMark, textColorBarman, 0, 1); } - return true; + break; - case 0x4af4: //taking the crumbs + case 0x4aed: + displayMessage(dsAddr_tooBigMsg); // "It's too big and I doubt if I'll ever need it" + break; + + case 0x4af4: // taking the crumbs setOns(0, 0); playSound(49, 6); playSound(5, 13); playActorAnimation(861); - inventory->add(0x57); + inventory->add(kInvItemCrumbs); disableObject(6); - return true; + break; + + case 0x4b23: + rejectMessage(); + break; + + case 0x4b27: + displayMessage(dsAddr_tooMuchToDrinkMsg); // "It'd take too much time to drink it..." + break; + + case 0x4b2e: + displayMessage(dsAddr_notThiefMsg); // "I'm not a thief. And it's empty, by the way." + break; case 0x4b35: playSound(15, 7); @@ -591,140 +1103,149 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(55, 1); playSound(24, 12); playAnimation(885, 0); - Dialog::show(scene, 0x67e5, 886, 0, 0xd0, 0xd1, 1, 0); + dialog->show(164, scene, 886, 0, textColorJohnNoty, textColorMark, 1, 0); playMusic(3); loadScene(40, 198, 186, 1); - Dialog::show(scene, 0x7f20, 0, 920, 0xd1, 0xe7, 0, 1); + dialog->show(202, scene, 0, 920, textColorMark, textColorRGBBoss, 0, 1); inventory->clear(); - inventory->add(0x1d); - displayCredits(0xe45c); + inventory->add(kInvItemSuperGlue); + displayCredits(dsAddr_credits5); loadScene(1, 198, 186); hideActor(); playActorAnimation(956); - Dialog::showMono(scene, 0x8bc4, 957, 0xd1, 1); + dialog->showMono(212, scene, 957, textColorMark, 1); waitAnimation(); loadScene(15, 157, 199, 1); playMusic(6); - return true; + break; - case 0x4c3e: //get the grenade + case 0x4c3e: // get the grenade playSound(32, 24); playActorAnimation(862); reloadLan(); playAnimation(863, 1); - inventory->add(0x54); + inventory->add(kInvItemGrenade); disableObject(1); - SET_FLAG(0xDBE2, 2); - return true; + SET_FLAG(dsAddr_act1GuardState, 2); + break; case 0x4c70: - if (CHECK_FLAG(0xDBE2, 0)) { - if (CHECK_FLAG(0xDBDA, 1)) { //papers are shown - Dialog::pop(scene, 0xDB4C, 0, 809, 0xd1, 0xd0, 0, 1); + if (CHECK_FLAG(dsAddr_act1GuardState, 0)) { + if (CHECK_FLAG(dsAddr_ShownPassToGuardFlag, 1)) { // papers are shown + dialog->pop(scene, dsAddr_dialogStackCampGuardReadingNews, 0, 809, textColorMark, textColorCampGuard, 0, 1); } else { - Dialog::pop(scene, 0xDB40, 0, 809, 0xd1, 0xd0, 0, 1); + dialog->pop(scene, dsAddr_dialogStackCampGuardWantsDocuments, 0, 809, textColorMark, textColorCampGuard, 0, 1); } } else { - displayMessage(0x5722); + displayMessage(dsAddr_helloQMsg); // "Hello?" wait(100); - displayMessage(0x572a); + displayMessage(dsAddr_totallyAddictedMsg); // "He's totally addicted" } - return true; + break; case 0x4c1c: playActorAnimation(960); - displayMessage(0x5511); - return true; + displayMessage(dsAddr_lockedMsg); // "It's Locked!" + break; + + case 0x4ca5: + displayMessage(dsAddr_chickenNeverMsg); // "Chickening? Me? Never!" + break; case 0x4cac: - if (CHECK_FLAG(0xdbda, 1)) { //papers are shown + if (CHECK_FLAG(dsAddr_ShownPassToGuardFlag, 1)) { // papers are shown loadScene(5, 124, 199); } else { - Dialog::show(scene, 0x5FE9, 0, 809, 0xd1, 0xd0, 0, 1); + dialog->show(144, scene, 0, 809, textColorMark, textColorCampGuard, 0, 1); moveTo(269, 175, 4); - Dialog::pop(scene, 0xDB56, 0, 809, 0xd1, 0xd0, 0, 1); + dialog->pop(scene, dsAddr_dialogStackCampGuardShowPass, 0, 809, textColorMark, textColorCampGuard, 0, 1); } - return true; - - case 0x4cf1: { //talking with mansion guard - SET_FLAG(0xda96, 1); - if (Dialog::pop(scene, 0xdaa6, 0, 529, 0xd1, 0xd9, 0, 1) != 0x1b4) - return true; + break; - Common::Point p = scene->getPosition(); - moveTo(189, 159, 0); - //waitLanAnimationFrame(1, 1); + case 0x4cf1: // talking with mansion guard + SET_FLAG(dsAddr_spokenWithMansionGuardFlag, 1); + if (dialog->pop(scene, dsAddr_dialogStackPleadingToMansionGuard, 0, 529, textColorMark, textColorMansionGuard, 0, 1) == 0x01b4) { // 2nd try + Common::Point p = scene->getPosition(); + moveTo(189, 159, 0); + //waitLanAnimationFrame(1, 1); - playSound(5, 2); - playSound(5, 19); - playActorAnimation(550, true); - playAnimation(551, 0, true); - waitAnimation(); + playSound(5, 2); + playSound(5, 19); + playActorAnimation(550, true); + playAnimation(551, 0, true); + waitAnimation(); - moveTo(p, 2); - inventory->add(0x13); - Dialog::pop(scene, 0xdaa6, 0, 529, 0xd1, 0xd9, 0, 1); - } - return true; + moveTo(p, 2); + inventory->add(kInvItemChocCandy); + dialog->pop(scene, dsAddr_dialogStackPleadingToMansionGuard, 0, 529, textColorMark, textColorMansionGuard, 0, 1); + } + break; - case 0x4d94: //talking with fatso - Dialog::show(scene, 0x33bd, 0, 666, 0xd1, 0xd0, 0, 2); - displayAsyncMessage(0x49ae, /*25060*/ 35000, 1, 10, 0xd0); + case 0x4d94: // talking with fatso + dialog->show(87, scene, 0, 666, textColorMark, textColorJohnNoty, 0, 2); + displayAsyncMessage(dsAddr_BribeMsg, 120, 109, 1, 10, textColorJohnNoty); // FIXME: Original (x,y) was (100, 78), rather than (120, 109)? playSound(5, 3); playAnimation(667, 1); playAnimation(668, 1); setOns(2, 50); - Dialog::show(scene, 0x36c7, 0, 666, 0xd1, 0xd0, 0, 2); + dialog->show(88, scene, 0, 666, textColorMark, textColorJohnNoty, 0, 2); setOns(3, 0); - setFlag(0xDBEC, 0); + setFlag(dsAddr_johnNotyOutsideMansionDoorFlag, 0); reloadLan(); playSound(82, 19); playAnimation(669, 1); - Dialog::showMark(scene, 0x3779); + dialog->showMark(89, scene); enableObject(15); disableObject(8); - return true; + break; case 0x4e61: loadScene(14, 280, 198); - return true; + break; case 0x4ee5: setOns(2, 0); playSound(5, 12); playActorAnimation(676); - displayMessage(0x4ab0); + displayMessage(dsAddr_WimpMsg); // "I'm a pathetic little wimp" disableObject(15); - inventory->add(51); - return true; + inventory->add(kInvItemBanknote); + break; case 0x4d56: - inventory->add(16); + inventory->add(kInvItemWhisky); disableObject(2); setOns(0, 0); playSound(5, 12); playActorAnimation(547); - return true; + break; + case 0x4d85: + rejectMessage(); + break; - case 0x4eb9://Pick up wrapper + case 0x4eb9: // Pick up wrapper playSound(5, 12); playSound(5, 18); - inventory->add(0x12); + inventory->add(kInvItemWrapper); setOns(1, 0); playActorAnimation(549); disableObject(13); - return true; + break; + + case 0x4ee1: + rejectMessage(); + break; case 0x4f25: playActorAnimation(967); - displayMessage(0x3542); - return true; + displayMessage(dsAddr_tooHardWoodMsg); // "This wood is too hard to break" + break; - case 0x4f32: //use tree near the mansion - if (CHECK_FLAG(0xDBA1, 1)) { - if (CHECK_FLAG(0xDBA2, 1)) { - displayMessage(0x3766); + case 0x4f32: // use tree near the mansion + if (CHECK_FLAG(dsAddr_mansionTreeHollowEmptyFlag, 1)) { + if (CHECK_FLAG(dsAddr_climbedMansionTreeAlreadyFlag, 1)) { + displayMessage(dsAddr_noChanceMsg); // "I won't take my chances a second time" } else { playSound(26, 13); playSound(26, 15); @@ -739,95 +1260,126 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(60, 16); playActorAnimation(591); wait(50); - displayMessage(0x372e); - SET_FLAG(0xDBA2, 1); - processCallback(0x9d45); + displayMessage(dsAddr_oneSmallStepMsg); // "One small step for man, one big pain in the head" + SET_FLAG(dsAddr_climbedMansionTreeAlreadyFlag, 1); + fnMansionIntrusionAttempt(); } } else { playActorAnimation(49); playSound(56, 8); playSound(56, 12); playSound(49, 10); - displayAsyncMessage(0x4652, 31579, 16, 24); + displayAsyncMessage(dsAddr_laughterMsg, 219, 98, 16, 24); // "(laughter)" playActorAnimation(587); moveRel(0, 0, 2); wait(100); - displayMessage(0x3668); + displayMessage(dsAddr_tickledMsg); // "Something tickled me!" } - return true; + break; - case 0x500d: //picking up wild plant - if (CHECK_FLAG(0xDB9E, 1)) { - displayMessage(0x35E8); //there are no more + case 0x500d: // picking up wild plant + if (CHECK_FLAG(dsAddr_gotPotatoAlreadyFlag, 1)) { + displayMessage(dsAddr_noPotatoMsg); // "There are no more potatoes" } else { - SET_FLAG(0xDB9E, 1); + SET_FLAG(dsAddr_gotPotatoAlreadyFlag, 1); setOns(2, 0); playSound(21, 9); playSound(34, 21); playSound(26, 30); playActorAnimation(552); setOns(2, 0x12); - inventory->add(0x14); + inventory->add(kInvItemPotato); } - return true; + break; + + case 0x505f: + displayMessage(dsAddr_wallTooSmoothMsg); // "The wall surface is too smooth to climb" + break; + + case 0x5066: + loadScene(11, Common::Point(183, 109)); + scene->setOrientation(3); + break; + + case 0x5080: + loadScene(13, Common::Point(290, 181)); + scene->setOrientation(4); + break; + + case 0x50f6: + displayMessage(dsAddr_tooMuchResinToClimbMsg); // "I could climb it if there wasn't so much resin" + break; + + case 0x50fd: + displayMessage(dsAddr_onlyGreenRectMsg); // "The only green stuff that I like is that rectangular piece of paper with..." + break; case 0x5104: loadScene(11, 319, 198, 4); - if (CHECK_FLAG(0xDB9C, 1)) - return true; - - //guard's drinking - SET_FLAG(0, 3); - setTimerCallback(0x516d, 40); - playAnimation(544, 0, true, true); //ignore busy flag for this animation - return true; + if (!CHECK_FLAG(dsAddr_scaredGuardAlreadyFlag, 1)) { + // guard is drinking + SET_FLAG(dsAddr_timedCallbackState, 3); + setTimerCallback(csAddr_guardScareTimeout, 40); + playAnimation(544, 0, true, true); // ignore busy flag for this animation + } + break; - case 0x516d: //too late to scare guard, resetting - SET_FLAG(0, 0); - return true; + case csAddr_guardScareTimeout: // too late to scare guard, resetting + SET_FLAG(dsAddr_timedCallbackState, 0); + break; - case 0x5189: //guard's drinking, boo! - SET_FLAG(0, 0); - setTimerCallback(0, 0); - scene->getAnimation(0)->free(); - SET_FLAG(0xDB9C, 1); + case csAddr_guardDrinking: + fnGuardDrinking(); + break; - displayAsyncMessage(0x3563, 320 * 130 + 300, 1, 5); - setOns(0, 16); - enableObject(2); + case 0x51c8: + displayMessage(dsAddr_wallTooSmoothMsg); // "The wall surface is too smooth to climb" + break; - playSound(17, 5); - playAnimation(545, 0); + case 0x51cf: + loadScene(12, Common::Point(15, 189)); + scene->setOrientation(2); + break; - Dialog::show(scene, 0x0917, 0, 546, 0xd1, 0xd9, 0, 1); - SET_FLAG(0xDA96, 1); - SET_FLAG(0xDA97, 0); - return true; + case 0x51e9: + displayMessage(dsAddr_dontWannaTouchHedgehogMsg); // "I don't wanna touch it. Its spines could hurt my delicate hands" + break; case 0x51f0: setOns(0, 0); playSound(5, 11); playActorAnimation(637); disableObject(7); - inventory->add(49); - return true; + inventory->add(kInvItemRock); + break; case 0x5217: - displayMessage(CHECK_FLAG(0xDB9F, 1) ? 0x402e : 0x34e1); - return true; + if (CHECK_FLAG(dsAddr_beesGoneFlag, 1)) + displayMessage(dsAddr_notHungryMsg); // "Thanks, I'm not hungry" + else + displayMessage(dsAddr_avoidBeesMsg); // "I'm going to stay at least five meters away from these bees!" + break; + + case 0x522c: + displayMessage(dsAddr_avoidBeesMsg); // "I'm going to stay at least five meters away from these bees!" + break; + + case 0x5233: + rejectMessage(); + break; case 0x5237: - if (!CHECK_FLAG(0xDB9F, 1)) { - displayMessage(0x34e1); - } else if (CHECK_FLAG(0xDBA0, 1)) - displayMessage(0x3E31); + if (!CHECK_FLAG(dsAddr_beesGoneFlag, 1)) { + displayMessage(dsAddr_avoidBeesMsg); // "I'm going to stay at least five meters away from these bees!" + } else if (CHECK_FLAG(dsAddr_mansionTunnelDoneFlag, 1)) + displayMessage(dsAddr_roadNowhereMsg); // "Nah. It's a road to nowhere" else { moveTo(173, 138, 2); playSound(28, 5); playActorAnimation(583); playActorAnimation(584); - loadScene(0, 0, 0, 0); //clear background + loadScene(0, 0, 0, 0); // clear background playSound(72, 18); playSound(73, 39); @@ -837,82 +1389,257 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(28, 2); playActorAnimation(586); moveTo(138, 163, 3); - displayMessage(0x3650); - SET_FLAG(0xDBA0, 1); - processCallback(0x9d45); //another mansion try + displayMessage(dsAddr_lifeBrutalMsg); // "Life is really brutal" + SET_FLAG(dsAddr_mansionTunnelDoneFlag, 1); + fnMansionIntrusionAttempt(); } - return true; - - case 0x55a8: { - uint16 d = Dialog::pop(scene, 0xdb08, 0, 0, 0xd1, 0xd1, 0, 0); - if (d == 0x2c5d) { - waitLanAnimationFrame(1, 0x23); - setOns(0, 0); - playSound(52, 9); - playSound(52, 11); - playSound(52, 13); - playSound(53, 32); - playAnimation(570, 0); - wait(50); - displayMessage(0x551f); - disableObject(5); - SET_FLAG(0xDBB0, 1); - } else if (d != 0x2c9b) { - waitLanAnimationFrame(1, 0x23); - playSound(52, 9); - playSound(52, 11); - playSound(52, 13); - playAnimation(569, 0); + break; + + case 0x5320: + loadScene(11, Common::Point(30, 124)); + scene->setOrientation(2); + break; + + case 0x533a: + displayMessage(dsAddr_noLongHandsMsg); // "I really don't have such long hands" + break; + + case 0x5341: + displayMessage(dsAddr_tooFarToSwimMsg); // "It's too far to swim there" + break; + + case 0x5403: + displayMessage(dsAddr_noBucketMsg); // "It's not a barrel-organ. And there's no bucket." + break; + + case 0x540a: + loadScene(20, Common::Point(10, 185)); + scene->setOrientation(2); + break; + + case 0x5424: + loadScene(11, Common::Point(30, 170)); + scene->setOrientation(2); + break; + + case 0x543e: + loadScene(18, Common::Point(224, 199)); + scene->setOrientation(4); + break; + + case 0x5547: + loadScene(15, Common::Point(15, 172)); + scene->setOrientation(2); + break; + + case 0x55a8: + { + uint16 d = dialog->popMark(scene, dsAddr_dialogStackSquirrel); + if (d == 0x2c5d) { // 4th try - Throw Nut + waitLanAnimationFrame(1, 0x23); + setOns(0, 0); + playSound(52, 9); + playSound(52, 11); + playSound(52, 13); + playSound(53, 32); + playAnimation(570, 0); + wait(50); + displayMessage(dsAddr_ThanksMsg); // "Thanks." + disableObject(5); + SET_FLAG(dsAddr_squirrelNutState, 1); + } else if (d != 0x2c9b) { // 5th (last) try + waitLanAnimationFrame(1, 0x23); + playSound(52, 9); + playSound(52, 11); + playSound(52, 13); + playAnimation(569, 0); + } } - } - return true; + break; case 0x5663: - displayMessage(CHECK_FLAG(0xDBB0, 1) ? 0x41b1 : 0x417e); - return true; + if (CHECK_FLAG(dsAddr_squirrelNutState, 1)) + displayMessage(dsAddr_findNutMsg); // "I won't find the nut just like that. The grass is too dense" + else + displayMessage(dsAddr_hmmGrassMsg); // "Hmmm. Grass..." + break; + + case 0x5674: + loadScene(18, Common::Point(94, 115)); + scene->setOrientation(3); + break; + + case 0x568e: + displayMessage(dsAddr_notHornyMsg); // "I'm not horny" + break; + + case 0x5695: + displayMessage(dsAddr_dontNeedToOpenMsg); // "I don't need to open it" + break; case 0x569c: playSound(67, 5); playActorAnimation(983); - displayMessage(0x5955); - return true; + displayMessage(dsAddr_emptyMsg); // "It's Empty" + break; + + case 0x56b3: + rejectMessage(); + break; case 0x56b7: playSound(66, 5); playSound(67, 11); playActorAnimation(984); - displayMessage(0x5955); - return true; + displayMessage(dsAddr_emptyMsg); // "It's Empty" + break; + + case 0x56d6: + displayMessage(dsAddr_CantJumpMsg); // "No way I can jump so high, cause, err, white men can't jump" + break; + + case 0x56dd: + displayMessage(dsAddr_dontNeedItMsg); // "I don't need it" + break; + + case 0x56e4: + displayMessage(dsAddr_notSantaClausMsg); // "I'm not Santa Claus" + break; + + case 0x56eb: + displayMessage(dsAddr_noPlasticImitationsMsg); // "I don't need plastic imitations" + break; + + case 0x56f2: + rejectMessage(); + break; + + case 0x5721: + displayMessage(dsAddr_dontNeedItMsg); // "I don't need it" + break; case 0x5728: - inventory->add(0x0d); + inventory->add(kInvItemChainsaw); disableObject(14); setOns(0, 0); playSound(5, 10); playActorAnimation(566); - return true; + break; + + case 0x574f: + displayMessage(dsAddr_tooFragileMsg); // "It's too fragile to carry around" + break; case 0x5793: - if (!CHECK_FLAG(0xDB94, 1)) { - displayMessage(0x3e63); - } else if (CHECK_FLAG(0xDB95, 1)) { - displayMessage(0x3e75); + if (!CHECK_FLAG(dsAddr_alreadyPulledTrunkReleaseLeverFlag, 1)) { + displayMessage(dsAddr_shutTightMsg); // "It's shut tight" + } else if (CHECK_FLAG(dsAddr_carTrunkEmptyFlag, 1)) { + displayMessage(dsAddr_bootEmptyMsg); // "There's nothing else in the boot" } else { - SET_FLAG(0xDB95, 1); + SET_FLAG(dsAddr_carTrunkEmptyFlag, 1); moveTo(188, 179, 0); playSound(7, 16); playActorAnimation(519); wait(150); moveTo(168, 179, 2); - inventory->add(3); + inventory->add(kInvItemToolboxFull); } - return true; + break; + + case 0x57fa: + displayMessage(dsAddr_dontNeedItMsg); // "I don't need it" + break; + + case 0x5801: + rejectMessage(); + break; + + case 0x583f: + case 0x5846: + displayMessage(dsAddr_dontNeedToOpenMsg); + break; + + case 0x584d: + displayMessage(dsAddr_pullObjMsg2); + break; + + case 0x5854: + loadScene(15, Common::Point(157, 199)); + scene->setOrientation(1); + break; + + case 0x586e: + loadScene(21, Common::Point(24, 187)); + scene->setOrientation(2); + break; + + case 0x5888: + loadScene(27, Common::Point(108, 199)); + scene->setOrientation(2); + break; + + case 0x5903: + displayMessage(dsAddr_keepItOpenMsg); // "I'd like to keep it open" + break; + + case 0x590a: + loadScene(20, Common::Point(304, 190)); + scene->setOrientation(4); + break; + + case 0x5924: + loadScene(25, Common::Point(298, 146)); + scene->setOrientation(4); + break; + + case 0x5978: + displayMessage(dsAddr_notTakingSocksMsg); // "I really don't want to walk around with someone else's socks" + break; + + case 0x597f: + case 0x5986: + case 0x598d: + displayMessage(dsAddr_dontNeedToOpenMsg); // "I don't need to open it" + break; + + case 0x5b44: + // FIXME - This is the doorbell use callback on House #2 + // i.e. Granny and Anne's House. Need to analyse cseg data properly. + // Current code inferred from behaviour. + // FIXME - Add animation call for Ego pushing doorbell. + displayMessage(dsAddr_ItsOpenMsg); + break; + + case 0x5c72: + displayMessage(dsAddr_notTiredMsg); // "Thanks, I'm not tired" + break; + + case 0x5c79: + displayMessage(dsAddr_dontNeedToOpenMsg); // "I don't need to open it" + break; + + case 0x5c80: + rejectMessage(); + break; + + case 0x5cdb: + case 0x5ce2: + displayMessage(dsAddr_dontNeedItMsg); // "I don't need it" + break; + + case 0x5ce9: + displayMessage(dsAddr_tooBigMsg); // "It's too big and I doubt if I'll ever need it" + break; + + case 0x5d1d: + displayMessage(dsAddr_CantJumpMsg); // "No way I can jump so high, cause, err, white men can't jump" + break; case 0x5d88: - if (CHECK_FLAG(0xDBA5, 1)) { //dry laundry - SET_FLAG(0xDBA5, 2); - Dialog::show(scene, 0x1F4F, 0, 523, 0xd1, 0xe5, 0, 1); - //waitLanAnimationFrame(1, 1); //another long waiting + if (CHECK_FLAG(dsAddr_laundryState, 1)) { // dry laundry + SET_FLAG(dsAddr_laundryState, 2); + dialog->show(46, scene, 0, 523, textColorMark, textColorOldLady, 0, 1); + //waitLanAnimationFrame(1, 1); // another long waiting playAnimation(604, 0); loadScene(21, scene->getPosition()); @@ -924,184 +1651,393 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(0, 33); loadScene(23, scene->getPosition()); playAnimation(605, 0); - Dialog::show(scene, 0x2002, 0, 523, 0xd1, 0xe5, 0, 1); + dialog->show(47, scene, 0, 523, textColorMark, textColorOldLady, 0, 1); } else { - uint16 d = Dialog::pop(scene, 0xdada, 0, 523, 0xd1, 0xe5, 0, 1); - if (d == 0x1913) { + uint16 d = dialog->pop(scene, dsAddr_dialogStackAskOldLadyOK, 0, 523, textColorMark, textColorOldLady, 0, 1); + if (d == 0x1913) { // 3rd time wait(100); moveRel(0, 0, 3); wait(50); - displayMessage(0x34d5); //I give up + displayMessage(dsAddr_giveUpMsg); // "I give up" wait(50); } } - return true; + break; + + case 0x5f9a: + case 0x5fa1: + displayMessage(dsAddr_dontNeedToOpenMsg); // "I don't need to open it" + break; - case 0x5ff3: //get duster - if (CHECK_FLAG(0xDB9A, 0)) { - Dialog::pop(scene, 0xdaf6, 0, 523, 0xd1, 0xe5, 0, 1); + case 0x5fa8: + displayMessage(dsAddr_CantJumpMsg); // "No way I can jump so high, cause, err, white men can't jump" + break; + + case 0x5faf: + displayMessage(dsAddr_noSecretPassageMsg); // "I don't think there's any secret passage inside" + break; + + case 0x5fe5: + displayMessage(dsAddr_jugMeMsg); // "They can jug me if I steal this" + break; + + case 0x5fec: + displayMessage(dsAddr_leaveFlowersAloneMsg); // "I'd better leave it. Women are really oversensitive about flowers." + break; + + case 0x5ff3: // get duster + if (CHECK_FLAG(dsAddr_givenFlowerToOldLadyAlreadyFlag, 0)) { + dialog->pop(scene, dsAddr_dialogStackBorrowDusterFromOldLady, 0, 523, textColorMark, textColorOldLady, 0, 1); } else { - Dialog::show(scene, 0x1e1e, 0, 523, 0xd1, 0xe5, 0, 1); + dialog->show(43, scene, 0, 523, textColorMark, textColorOldLady, 0, 1); wait(50); - inventory->add(12); + inventory->add(kInvItemFeatherDusterClean); disableObject(12); setOns(0, 0); playSound(5, 6); playActorAnimation(541); } - return true; + break; + + case 0x603a: + rejectMessage(); + break; case 0x603e: - if (CHECK_FLAG(0xDBB3, 1)) { - displayMessage(0x44a7); + if (CHECK_FLAG(dsAddr_spokenToMirrorFlag, 1)) { + displayMessage(dsAddr_busyThinkingMsg); // "I'd better not interrupt it's thought process" } else { - displayMessage(0x4412); + displayMessage(dsAddr_mirrorMirrorMsg); // "Mirror, Mirror on the wall...." wait(150); - displayMessage(0x444f); + displayMessage(dsAddr_thinkTooLongMsg); // "Hey, don't think too long" wait(150); - displayMessage(0x446b); + displayMessage(dsAddr_HintMaleMsg); // "A hint: Someone in this room, a male" wait(150); - displayMessage(0x4492); + displayMessage(dsAddr_okWaitMsg); // "OK, take your time" wait(150); - SET_FLAG(0xDBB3, 1); + SET_FLAG(dsAddr_spokenToMirrorFlag, 1); } - return true; + break; + + case 0x6074: + rejectMessage(); + break; + + case 0x6078: + displayMessage(dsAddr_tooBigMsg); // "It's too big and I doubt if I'll ever need it" + break; case 0x6205: - if (CHECK_FLAG(0xDBA4, 1)) - displayMessage(0x450e); + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + displayMessage(dsAddr_tooHeavyMsg); // "It's too heavy. Not that I'm wimp" else - processCallback(0x61fe); - return true; + fnTooDark(); + break; case 0x6217: - if (CHECK_FLAG(0xDBA4, 1)) - displayMessage(0x44d6); + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + displayMessage(dsAddr_noDentistsMsg); // "I don't want to have anything in common with dentists" else - processCallback(0x61fe); - return true; + fnTooDark(); + break; case 0x62c1: - if (CHECK_FLAG(0xDBA4, 1)) - return false; + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + retVal = false; + else + fnTooDark(); + break; - processCallback(0x61fe); - return true; + case 0x634a: + displayMessage(dsAddr_noHandsSharpThornsMsg); // "I can't remove it with my hands. these thorns look really sharp" + break; + + case 0x637f: + loadScene(21, Common::Point(201, 199)); + scene->setOrientation(1); + break; + + case 0x6399: + displayMessage(dsAddr_rockWalkingGeeMsg); // "Yeah, great idea. Let's take this rock and walk around a bit. Gee..." + break; + + case 0x63a0: + case 0x63a7: + displayMessage(dsAddr_butterflyMsg); // "I'd better leave them alone, they make this place beautiful" + break; + + case 0x63ae: + displayMessage(dsAddr_notSureIfAliveMsg); // "I'm not sure if it's alive" + break; case 0x63bc: playMusic(6); loadScene(25, 151, 156, 2); - return true; + break; case 0x63dc: - Dialog::showMono(scene, 0x3375, 0, 0xd1, 0); - return true; + dialog->showMono(86, scene, 0, textColorMark, 0); + break; + + case 0x63e3: + displayMessage(dsAddr_holeTooNarrowMsg); // "The hole is too narrow to fit my hand" + break; case 0x646e: case 0x6475: - Dialog::showMono(scene, 0x32C1, 0, 0xd1, 0); - return true; + dialog->showMono(85, scene, 0, textColorMark, 0); + break; case 0x6479: - Dialog::showMono(scene, 0x325e, 0, 0xd1, 0); - return true; + dialog->showMono(84, scene, 0, textColorMark, 0); + break; case 0x6507: - if (CHECK_FLAG(0xDB96, 1)) { + if (CHECK_FLAG(dsAddr_birdsGoneFromScarecrowFlag, 1)) rejectMessage(); - } else - displayMessage(0x47e7); - return true; + else + displayMessage(dsAddr_birdAttackMsg); // "Hey You! Wake up! Bird attack!" + break; + + case 0x6541: + loadScene(20, Common::Point(10, 131)); + scene->setOrientation(3); + break; + + case 0x6635: + displayMessage(dsAddr_uninterestingHaystackMsg); // "I don't see anything interesting about this haystack" + break; + + case 0x666a: + displayMessage(dsAddr_moreComplicatedMsg); // "It's more complicated than that" + break; case 0x65c3: - if (CHECK_FLAG(0xDBA9, 1)) { + if (CHECK_FLAG(dsAddr_mouseHoleState, 1)) { playActorAnimation(635); setOns(5, 0); playSound(63, 11); playSound(15, 20); playSound(32, 31); playActorAnimation(636); - inventory->add(47); - inventory->add(48); + inventory->add(kInvItemHandkerchief); + inventory->add(kInvItemMouse); moveTo(scene->getPosition().x - 1, 139, 1, true); - displayMessage(0x3b83); - SET_FLAG(0xDBA9, 2); - SET_FLAG(0xDBA8, 0); + displayMessage(dsAddr_yikesMsg); // "Yikes!" + SET_FLAG(dsAddr_mouseHoleState, 2); + SET_FLAG(dsAddr_HankerchiefInMouseholeFlag, 0); } else - displayMessage(0x4808); - return true; + displayMessage(dsAddr_noSearchWarrantMsg); // "I don't have a search-warrant" + break; + + case 0x6671: + displayMessage(dsAddr_cantOpenItMsg); // "I can't open it" + break; + + case 0x6678: + rejectMessage(); + break; + + case 0x670f: + displayMessage(dsAddr_dontNeedThemMsg); // "I don't need them" + break; + + case 0x6716: + displayMessage(dsAddr_pullObjMsg2); // "I can't reach it" + break; + + case 0x6772: + loadScene(31, Common::Point(20, 188)); + scene->setOrientation(2); + break; + + case 0x678c: + loadScene(28, Common::Point(189, 153)); + scene->setOrientation(4); + break; + + case 0x67fa: + rejectMessage(); + break; + + case 0x67fe: + displayMessage(dsAddr_troubleWithStairsMsg); // "If I put it on I might have trouble walking up the stairs" + break; + + case 0x6911: + displayMessage(dsAddr_9LivesToReadMsg); // "I'd need 9 lives to read them all" + break; + + case 0x6954: + displayMessage(dsAddr_thanksNotTiredMsg); // "Thanks, I'm not so tired" + break; + + case 0x695b: + displayMessage(dsAddr_noNeedToTurnOnMsg); // "There's no need to turn it on" + break; + + case 0x6ba6: + displayMessage(dsAddr_wontBearWeightMsg); // "It won't bear my weight" + break; + + case 0x6bda: + displayMessage(dsAddr_peepingTomMsg); // "What am I? A Peeping Tom?" + break; + + case 0x6c1c: + case 0x6c20: + rejectMessage(); + break; + + case 0x6c24: + displayMessage(dsAddr_dontNeedThemMsg); // "I don't need them" + break; + + case 0x6c2b: + loadScene(29, Common::Point(300, 188)); + scene->setOrientation(4); + break; + + case 0x6c7c: + displayMessage(dsAddr_bigPocketsMsg); // "I have big pockets, but there are limits" + break; + + case 0x724e: + displayMessage(dsAddr_soSharpMsg); // "They're so sharp they'd rip my trousers!" + break; + + case 0x72be: + rejectMessage(); + break; + + case 0x7305: + rejectMessage(); + break; + + case 0x7328: + displayMessage(dsAddr_noTimeForPleasuresMsg); // "I don't have time for pleasures" + break; + + case 0x732f: + displayMessage(dsAddr_notSocksWithBareHandsMsg); // "I won't touch these socks with my bare hands!" + break; + + case 0x739c: + displayMessage(dsAddr_notHalloweenMsg); // "It's not Halloween" + break; + + case 0x7401: + displayMessage(dsAddr_NotManualMsg); // "It can't be controlled manually! I hate it!" + break; + + case 0x746f: + displayMessage(dsAddr_nothingToPlayMsg); // "I have nothing to play" + break; + + case 0x74b3: + loadScene(29, Common::Point(256, 171)); + scene->setOrientation(3); + break; + + case 0x74cd: + rejectMessage(); + break; + + case 0x74f9: + loadScene(38, Common::Point(160, 199)); + scene->setOrientation(1); + break; + + case 0x784a: + displayMessage(dsAddr_notMineMsg); // "I can't take it. It's not mine." + break; + + case 0x7851: + displayMessage(dsAddr_lockedMsg); // "It's Locked!" + break; + + case 0x7858: + displayMessage(dsAddr_lockedMsg); // "It's Locked!" + break; + + case 0x785f: + displayMessage(dsAddr_pullObjMsg2); // "I can't reach it" + break; case 0x7866: - if (CHECK_FLAG(0xdbdd, 3)) { - displayMessage(0x55ff); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_JailCableAndBowlState, 3)) + displayMessage(dsAddr_gotchaMsg); // "Gotcha" + else + retVal = false; + break; - case 0x7878: { - byte v = res->dseg.get_byte(0xDBDB) + 1; - if (v <= 6) - SET_FLAG(0xDBDB, v); + case 0x7878: + { + byte v = res->dseg.get_byte(dsAddr_graffitiMsgId) + 1; + if (v <= 6) + SET_FLAG(dsAddr_graffitiMsgId, v); - switch (v) { - case 1: - displayMessage(0x5411); - return true; - case 2: - displayMessage(0x5463); - return true; - case 3: - displayMessage(0x5475); - return true; - case 4: - displayMessage(0x5484); - return true; - case 5: - displayMessage(0x54c4); - return true; - default: - displayMessage(0x54d5); - return true; + switch (v) { + case 1: + displayMessage(dsAddr_SavingFineMsg); // "Saving is a very fine thing..." + break; + case 2: + displayMessage(dsAddr_loveCaptainMsg); // "I love captain" + break; + case 3: + displayMessage(dsAddr_soccerRulzMsg); // "Soccer rulz" + break; + case 4: + displayMessage(dsAddr_treeCutMsg); // "Don't cut the trees..." + break; + case 5: + displayMessage(dsAddr_visaAcceptedMsg); // "VISA Accepted" + break; + default: + displayMessage(dsAddr_otherGraffitiMsg); // "The rest of graffiti is obscene" + break; + } } - } + break; case 0x78a9: - if (CHECK_FLAG(0xDBE6, 1)) { - displayMessage(0x5827); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_captainDrawerState, 1)) + displayMessage(dsAddr_nowOpenMsg); // "Now it's open" + else + retVal = false; + break; case 0x78bb: - if (CHECK_FLAG(0xDBE8, 1)) { - displayMessage(0x58b0); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_swappedBarmanMugFlag, 1)) + displayMessage(dsAddr_yuckMsg); // "Yuck!" + else + retVal = false; + break; case 0x78ce: - if (!CHECK_FLAG(0xDBA1, 1)) { - displayMessage(0x3694); - return true; - } else - return false; + if (!CHECK_FLAG(dsAddr_mansionTreeHollowEmptyFlag, 1)) + displayMessage(dsAddr_monstersMsg); // "Who knows what monsters live in there" + else + retVal = false; + break; - case 0x792b: //left click on ann + case 0x792b: // left click on ann moveTo(245, 198, 1); - if (CHECK_FLAG(0xDBAF, 1)) - return false; - - Dialog::showMono(scene, 0x2193, 0, 0xd1, 0); - SET_FLAG(0xDBAF, 1); - return true; + if (!CHECK_FLAG(dsAddr_alreadySaidAnneBeautifulFlag, 1)) { + dialog->showMono(50, scene, 0, textColorMark, 0); + SET_FLAG(dsAddr_alreadySaidAnneBeautifulFlag, 1); + } else + retVal = false; + break; case 0x79c3: - if (CHECK_FLAG(0xDBA4, 1)) - return false; - processCallback(0x61fe); - return true; + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + retVal = false; + else + fnTooDark(); + break; - case 0x7b26: //cutting the fence + case 0x7b26: // cutting the fence setOns(0, 0); playSound(5, 2); playSound(51, 11); @@ -1114,11 +2050,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(0, 0x60); moveTo(281, scene->getPosition().y, 0, true); disableObject(4); - SET_FLAG(0xDBE1, 1); - return true; + SET_FLAG(dsAddr_cutFenceFlag, 1); + break; - case 0x7b89: //digging mysterious object - if (CHECK_FLAG(0xDBE1, 1)) { + case 0x7b89: // digging mysterious object + if (CHECK_FLAG(dsAddr_cutFenceFlag, 1)) { playActorAnimation(844); setOns(1, 0); playSound(5, 5); @@ -1130,11 +2066,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(1, 0x64); playActorAnimation(845); disableObject(3); - inventory->add(0x52); - inventory->remove(0x51); + inventory->add(kInvItemKaleidoscope); + inventory->remove(kInvItemShovelAct1); } else - displayMessage(0x56da); - return true; + displayMessage(dsAddr_fenceBlocksMsg); // "The fence blocks the way" + break; + + case 0x7bf6: + displayMessage(dsAddr_noDiggingKnifeMsg); // "Digging it out with the knife could take a hundred years" + break; case 0x7bfd: playSound(76, 18); @@ -1149,7 +2089,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(76, 63); playActorAnimation(873); moveTo(240, 163, 4); - displayMessage(0x5837); + displayMessage(dsAddr_cmonBabyMsg); // "C'mon baby, it's all yours!" waitLanAnimationFrame(1, 0x22); playSound(77, 2); playSound(77, 12); @@ -1164,23 +2104,36 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(1, 0); playAnimation(874, 1); setOns(0, 0x68); - inventory->remove(0x5b); + inventory->remove(kInvItemDruggedFood); enableObject(6); disableObject(1); - return true; + break; + + case 0x7cc9: + case 0x7cd0: + displayMessage(dsAddr_throwCrumbsToBirdQMsg); // "Should I throw the crumbs to the bird?" + break; + + case 0x7cd7: + displayMessage(dsAddr_dontWasteCrumbs); // "I don't want to waste these tasty crumbs" + break; - case 0x7ce5: //put spring on the solid ground + case 0x7cde: + displayMessage(dsAddr_mightSlipFallInMsg); // "Better not... I might slip and fall in..." + break; + + case 0x7ce5: // put spring on the solid ground playSound(5, 2); playSound(19, 11); playActorAnimation(840); setOns(1, 0x61); - inventory->remove(0x50); + inventory->remove(kInvItemSpring); disableObject(2); enableObject(7); - return true; + break; - case 0x7d1a: //captain's key + door - if (res->dseg.get_byte(0xDBDF) <= 1) { + case 0x7d1a: // captain's key + door + if (res->dseg.get_byte(dsAddr_FirstActTrialState) <= 1) { playSound(5, 2); playSound(57, 12); playSound(70, 19); @@ -1198,24 +2151,23 @@ bool TeenAgentEngine::processCallback(uint16 addr) { wait(200); playAnimation(0, 1); setOns(0, 0); - Dialog::showMono(scene, 0x63a5, 830, 0xd0, 1); + dialog->showMono(156, scene, 830, textColorShockedCaptain, 1); loadScene(7, 130, 195, 2); playMusic(4); setLan(1, 1); wait(100); - Dialog::show(scene, 0x6406, 0, 832, 0xd1, 0xec, 0, 1); + dialog->show(157, scene, 0, 832, textColorMark, textColorCaptain, 0, 1); //playAnimation(831, 1); - SET_FLAG(0xDBDF, 2); - + SET_FLAG(dsAddr_FirstActTrialState, 2); } else - displayMessage(0x52f6); - return true; + displayMessage(dsAddr_nahMsg); // "Nah" + break; - case 0x7e02: //tickling the captain - if (CHECK_FLAG(0xdbe0, 1)) { - displayMessage(0x5632); + case 0x7e02: // tickling the captain + if (CHECK_FLAG(dsAddr_AlreadyTickledCaptainFlag, 1)) { + displayMessage(dsAddr_doesNotWorkMsg); // "That doesn't work" } else { playSound(5, 6); playSound(27, 49); @@ -1224,37 +2176,37 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); setOns(0, 94); - Dialog::show(scene, 0x65e9, 0, 832, 0xd1, 0xec, 0, 1); + dialog->show(161, scene, 0, 832, textColorMark, textColorCaptain, 0, 1); enableObject(12); - SET_FLAG(0xdbe0, 1); + SET_FLAG(dsAddr_AlreadyTickledCaptainFlag, 1); } - return true; + break; - case 0x7e4f: //giving magazine to captain - Dialog::show(scene, 0x66c0, 0, 856, 0xd1, 0xec, 0, 1); + case 0x7e4f: // giving magazine to captain + dialog->show(162, scene, 0, 856, textColorMark, textColorCaptain, 0, 1); playSound(5, 3); playActorAnimation(852, true); playActorAnimation(853, true); - displayMessage(0x5742); - displayMessage(0x5757); - displayMessage(0x5770); - displayMessage(0x5782); - displayMessage(0x5799); + displayMessage(dsAddr_whatAboutMsg); // "What about a new" + displayMessage(dsAddr_hotOffMsg); // "hot off the press" + displayMessage(dsAddr_fullColorMsg); // "full-color" + displayMessage(dsAddr_specialEdMsg); // "special edition" + displayMessage(dsAddr_soldierNewsMsg); // "of Soldier News?!" playAnimation(856, 1); playSound(5, 3); //playActorAnimation(854); - Dialog::show(scene, 0x66fe, 0, 856, 0xd1, 0xec, 0, 1); + dialog->show(163, scene, 0, 856, textColorMark, textColorCaptain, 0, 1); playAnimation(855, 1); wait(200); moveTo(30, 181, 0); disableObject(1); setLan(1, 0); - SET_FLAG(0xDBDF, 3); - SET_FLAG(0xDBF0, 1); + SET_FLAG(dsAddr_FirstActTrialState, 3); + SET_FLAG(dsAddr_gotPasswordNeedSpeakBarmanFlag, 1); loadScene(8, 155, 199); - return true; + break; - case 0x7fbd: //using bird & bartender + case 0x7fbd: // using bird & bartender playSound(5, 3); playActorAnimation(876); setOns(1, 0); @@ -1263,15 +2215,15 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(877, 1); playAnimation(880, 1, true); - Dialog::show(scene, 0x6f0e, 0, 857, 0xd1, 0xef, 0, 1); + dialog->show(176, scene, 0, 857, textColorMark, textColorBarman, 0, 1); setOns(2, 0x6a); reloadLan(); playAnimation(878, 0); - //playAnimation(879, 0); //background bartender animation - inventory->remove(0x5c); + //playAnimation(879, 0); // background bartender animation + inventory->remove(kInvItemBird); enableObject(1); - SET_FLAG(0xDBE7, 1); - return true; + SET_FLAG(dsAddr_birdOnBarRadioAntennaFlag, 1); + break; case 0x8047: playSound(32, 5); @@ -1279,27 +2231,26 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(52, 23); playActorAnimation(881); setOns(2, 0x6b); - inventory->remove(0x56); - inventory->add(0x55); - SET_FLAG(0xDBE8, 1); - return true; + inventory->remove(kInvItemMugOfMud); + inventory->add(kInvItemMug); + SET_FLAG(dsAddr_swappedBarmanMugFlag, 1); + break; case 0x808b: - if (CHECK_FLAG(0xDBDA, 1)) { - //alredy shown - displayMessage(0x53F2); + if (CHECK_FLAG(dsAddr_ShownPassToGuardFlag, 1)) { + displayMessage(dsAddr_gotPermissionMsg); // "I already got the permission" } else { - displayMessage(0x53DD); + displayMessage(dsAddr_showPapersMsg); // "Here are my papers" playSound(5, 2); playSound(5, 18); playActorAnimation(810); - Dialog::show(scene, 0x60BF, 0, 809, 0xd1, 0xd0, 0, 1); - SET_FLAG(0xDBDA, 1); + dialog->show(147, scene, 0, 809, textColorMark, textColorCampGuard, 0, 1); + SET_FLAG(dsAddr_ShownPassToGuardFlag, 1); } - return true; + break; - case 0x80c3: //show kaleydoscope to the guard - Dialog::show(scene, 0x6811, 0, 809, 0xd1, 0xd0, 0, 1); + case 0x80c3: // show kaleidoscope to the guard + dialog->show(165, scene, 0, 809, textColorMark, textColorCampGuard, 0, 1); playSound(5, 3); playSound(5, 30); playSound(26, 14); @@ -1309,124 +2260,146 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(851, 0); playAnimation(850, 0); reloadLan(); - inventory->add(0x53); - inventory->remove(0x52); + inventory->add(kInvItemSoldierNews); + inventory->remove(kInvItemKaleidoscope); enableObject(1); - SET_FLAG(0xDBE2, 1); - return true; + SET_FLAG(dsAddr_act1GuardState, 1); + break; + + case 0x8398: + displayMessage(dsAddr_trySomewhereElseMsg); // "I'd better try somewhere else - I suppose this side is heavily guarded" + break; + + case 0x85dd: + displayMessage(dsAddr_branchNotPaddleMsg); // "This branch is not a paddle. It doesn't even look like one" + break; + + case 0x85e4: + displayMessage(dsAddr_sharpenNotPulverizeMsg); // "I needed to sharpen it, not pulverize" + break; + + case 0x8d42: + displayMessage(dsAddr_bluntSickleMsg); // "The sickle is too blunt" + break; - //Shore + case 0x8d49: + displayMessage(dsAddr_noChainsawFuelMsg); // "There's no fuel in the chainsaw" + break; + + case 0x8d50: + displayMessage(dsAddr_thornsTooThinMsg); // "Thorns are too thin, the chainsaw is useless here" + break; + + // Shore case 0x5348: - if (CHECK_FLAG(0xdb99, 1)) { //got broken paddle from boat - displayMessage(0x351f); + if (CHECK_FLAG(dsAddr_alreadyGotBrokenPaddleFlag, 1)) { // got broken paddle from boat + displayMessage(dsAddr_boatEmptyMsg); // "There's nothing else in the boat" } else { - SET_FLAG(0xDB99, 1); + SET_FLAG(dsAddr_alreadyGotBrokenPaddleFlag, 1); playSound(57, 6); playActorAnimation(536); - Dialog::showMono(scene, 0x30c3, 0, 0xd1, 0); - inventory->add(0x8); + dialog->showMono(77, scene, 0, textColorMark, 0); + inventory->add(kInvItemBrokenPaddle); } - return true; + break; case 0x53a1: - if (CHECK_FLAG(0xdbb2, 1)) { //spoken to man in well - displayMessage(0x411d); + if (CHECK_FLAG(dsAddr_spokenToManInWellFlag, 1)) { // spoken to man in well + displayMessage(dsAddr_stillThereMsg); // "Are you still there?" } else { - displayMessage(0x408a); - displayMessage(0x4091, 0xe5, 52728); - displayMessage(0x4098); - displayMessage(0x40a7, 0xe5, 52705); - displayMessage(0x40b6); - displayMessage(0x40ce, 0xe5, 52652); - displayMessage(0x40e8); - displayMessage(0x410f, 0xe5, 52712); + displayMessage(dsAddr_echoMsg); // "Echo!" + displayMessage(dsAddr_loudEchoMsg, textColorWellEcho, 248, 164); // "ECHO!" + displayMessage(dsAddr_whoThereMsg); // "Who's there?!" + displayMessage(dsAddr_loudWhoThereMsg, textColorWellEcho, 225, 164); // "WHO'S THERE?!" + displayMessage(dsAddr_dontCopyMsg); // "DON'T COPY ME!" + displayMessage(dsAddr_loudDontCopyMsg, textColorWellEcho, 172, 164); // "DON'T COPY ME!!!" + displayMessage(dsAddr_throwRockMsg); // "OR I WILL THROW A ROCK DOWN THERE!" + displayMessage(dsAddr_orIWillMsg, textColorWellEcho, 232, 164); // "OR I WILL" wait(100); - displayMessage(0x4091, 0xe5, 52728); - SET_FLAG(0xDBB2, 1); + displayMessage(dsAddr_loudEchoMsg, textColorWellEcho, 248, 164); + SET_FLAG(dsAddr_spokenToManInWellFlag, 1); } - return true; + break; + case 0x5458: + { + setOns(2, 0); + playSound(34, 7); + playActorAnimation(535); + inventory->add(kInvItemSecondFlower); + disableObject(1); - case 0x5458: { - setOns(2, 0); - playSound(34, 7); - playActorAnimation(535); - inventory->add(11); - disableObject(1); - - byte *scene_15_ons = scene->getOns(15); //patch ons for the scene 15 - scene_15_ons[0] = 0; + byte *scene_15_ons = scene->getOns(15); // patch ons for the scene 15 + scene_15_ons[0] = 0; - byte f = GET_FLAG(0xDB98) + 1; - SET_FLAG(0xDB98, f); - if (f >= 2) { - //disable object boat for scene 15!! - disableObject(1, 15); + byte f = GET_FLAG(dsAddr_flowerIsleState) + 1; + SET_FLAG(dsAddr_flowerIsleState, f); + if (f >= 2) { + // disable object boat for scene 15!! + disableObject(1, 15); + } } - } - return true; + break; - case 0x54b3: { - setOns(1, 0); - setOns(3, 0); - playSound(33, 6); - playActorAnimation(534); - inventory->add(10); - disableObject(2); - setOns(1, 10); - setOns(1, 0, 15); - byte f = GET_FLAG(0xDB98) + 1; - SET_FLAG(0xDB98, f); - if (f >= 2) { - //disable object boat for scene 15!! - disableObject(1, 15); + case 0x54b3: + { + setOns(1, 0); + setOns(3, 0); + playSound(33, 6); + playActorAnimation(534); + inventory->add(kInvItemFirstFlower); + disableObject(2); + setOns(1, 10); + setOns(1, 0, 15); + byte f = GET_FLAG(dsAddr_flowerIsleState) + 1; + SET_FLAG(dsAddr_flowerIsleState, f); + if (f >= 2) { + // disable object boat for scene 15!! + disableObject(1, 15); + } } - } - return true; + break; case 0x5502: setOns(0, 0); loadScene(15, 115, 180, 1); playMusic(6); playActorAnimation(568); - return true; + break; - case 0x5561://Enter lakeside house - moveTo(94, 115, 4); //call 557e, but it's not needed I guess + case 0x5561: // Enter lakeside house + fnEgoDefaultPosition(); loadScene(19, 223, 199, 1); - return true; + break; case 0x55a1: - processCallback(0x557e); + fnEgoDefaultPosition(); rejectMessage(); - return true; + break; - case 0x557e: - if (scene->getPosition().y <= 149) - moveTo(94, 115, 4); - else - moveTo(51, 149, 4); - return true; + case csAddr_egoDefaultPosition: + fnEgoDefaultPosition(); + break; case 0x563b: playSound(5, 10); setOns(1, 0); playActorAnimation(561); - inventory->add(26); + inventory->add(kInvItemNut); disableObject(6); - return true; + break; case 0x56f6: playSound(32, 7); setOns(1, 0); playActorAnimation(626); disableObject(12); - inventory->add(45); - displayMessage(0x3b04); - return true; + inventory->add(kInvItemCheese); + displayMessage(dsAddr_foundFoodMsg); // "People leave food in unbelievable places" + break; - case 0x5756://Open car door + case 0x5756: // Open car door playSound(11, 4); playActorAnimation(514); setOns(4, 8); @@ -1435,106 +2408,94 @@ bool TeenAgentEngine::processCallback(uint16 addr) { enableObject(15); enableObject(16); disableObject(1); - return true; + break; - case 0x5805://Enter basketball house + case 0x5805: // Enter basketball house playSound(70, 6); playActorAnimation(513); loadScene(22, 51, 180, 2); - return true; + break; - case 0x5832://Ring doorbell + case 0x5832: // Ring doorbell playActorAnimation(509); - displayMessage(0x5dce); - return true; + displayMessage(dsAddr_outOfOrderMsg); // "It's out of order" + break; case 0x58a2: - Dialog::pop(scene, 0xdaba, 0, 502, 0xd1, 0xe5, 0, 1); - scene->getObject(13)->setName((const char *)res->dseg.ptr(0x92e5)); - return true; + dialog->pop(scene, dsAddr_dialogStackSonny, 0, 502, textColorMark, textColorSonny, 0, 1); + scene->getObject(13)->setName((const char *)res->dseg.ptr(dsAddr_scnObjNameSonny)); + break; - case 0x58b7://Get comb from car + case 0x58b7: // Get comb from car disableObject(14); setOns(4, 0); playSound(5, 7); playActorAnimation(521); setOns(4, 0); - inventory->add(0x6); - return true; + inventory->add(kInvItemComb); + break; - case 0x58df://Pull trunk lever in car - SET_FLAG(0xDB94, 1); + case 0x58df: // Pull trunk lever in car + SET_FLAG(dsAddr_alreadyPulledTrunkReleaseLeverFlag, 1); playSound(6, 1); setOns(3, 6); playActorAnimation(515); - return true; + break; - case 0x593e://Enter annes house + case 0x593e: // Enter annes house playSound(89, 4); playActorAnimation(980); loadScene(23, 76, 199, 1); - if (CHECK_FLAG(0xDBEE, 1)) + if (CHECK_FLAG(dsAddr_lovestruckByAnneFlag, 1)) playMusic(7); - return true; + break; case 0x5994: - processCallback(0x599b); - processCallback(0x5a21); - return true; + fnEnterCave(); + break; - case 0x599b: - return true; + case csAddr_caveNOP: + break; - case 0x5a21: - loadScene(24, 230, 170, 1); - playSound(52, 3); - playSound(52, 7); - playSound(52, 11); - playSound(52, 14); - playSound(52, 18); - playSound(52, 21); - playSound(52, 25); - playActorAnimation(601); - moveTo(230, 179, 3); - if (!CHECK_FLAG(0xDBA4, 1)) - displayMessage(0x37ea); //it's kinda dark here - return true; + case csAddr_enterCave: + fnEnterCave(); + break; case 0x5a8b: - if (!CHECK_FLAG(0xDBAD, 1)) { - playSound(43, 4); //grrrrrr + if (!CHECK_FLAG(dsAddr_dogHasBoneFlag, 1)) { + playSound(43, 4); // grrrrrr playSound(42, 15); playSound(42, 17); playSound(42, 19); playAnimation(656, 0); wait(50); - displayMessage(0x3c16); - } else if (!CHECK_FLAG(0xDBA3, 1)) {//Dog has bone + displayMessage(dsAddr_goodDoggyMsg); // "I understand. Good doggy" + } else if (!CHECK_FLAG(dsAddr_cellarDoorOpenFlag, 1)) { // Dog has bone playSound(28, 3); playActorAnimation(596); setOns(1, 30); - SET_FLAG(0xDBA3, 1); + SET_FLAG(dsAddr_cellarDoorOpenFlag, 1); enableObject(8); } else { setOns(1, 0); playSound(4, 4); playActorAnimation(597); - SET_FLAG(0xDBA3, 0); + SET_FLAG(dsAddr_cellarDoorOpenFlag, 0); disableObject(8); - displayMessage(0x37b8); + displayMessage(dsAddr_wallShakenMsg); // "Wow! This must have shaken all the nearby walls!" setOns(1, 32, 24); enableObject(4, 24); } - return true; + break; - case 0x5b3a://Click on dog - Dialog::popMark(scene, 0xDB14); - return true; + case 0x5b3a: // Click on dog + dialog->popMark(scene, dsAddr_dialogStackDog); + break; - case 0x5b59: //picking up the rope - Dialog::showMark(scene, 0x2cbd); + case 0x5b59: // picking up the rope + dialog->showMark(70, scene); wait(150); - Dialog::showMark(scene, 0x2dc2); + dialog->showMark(71, scene); moveRel(0, -12, 0); playSound(34, 5); playActorAnimation(607); @@ -1545,81 +2506,81 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(5, 25); playActorAnimation(611); moveTo(16, scene->getPosition().y, 4, true); - inventory->add(38); + inventory->add(kInvItemRopeAct2); disableObject(12); - return true; + break; - case 0x5be1://Talk to grandpa - Dialog::pop(scene, 0xDAC4, 0, 522, 0xd1, 0xd8, 0, 1); - return true; + case 0x5be1: // Talk to grandpa + dialog->pop(scene, dsAddr_dialogStackGrandpa, 0, 522, textColorMark, textColorGrandpa, 0, 1); + break; case 0x5bee: playSound(89, 5); playSound(67, 11); playActorAnimation(982); - displayMessage(0x5955); - return true; + displayMessage(dsAddr_emptyMsg); // "It's Empty" + break; - case 0x5c0d: //grandpa - drawers - if (CHECK_FLAG(0xDBA7, 1)) { - displayMessage(0x3bac); + case 0x5c0d: // grandpa - drawers + if (CHECK_FLAG(dsAddr_SearchedGrandpaDrawersFlag, 1)) { + displayMessage(dsAddr_drawersEmptyMsg); // "There's nothing else in the drawers" } else { - if (!CHECK_FLAG(0xDB92, 1)) - Dialog::show(scene, 0x15a0, 0, 522, 0xd1, 0xd8, 0, 1); //can I search your drawers? + if (!CHECK_FLAG(dsAddr_alreadyAdjustedHoopPoleFlag, 1)) + dialog->show(24, scene, 0, 522, textColorMark, textColorGrandpa, 0, 1); playSound(66, 5); playSound(67, 20); playSound(5, 23); playActorAnimation(631); - inventory->add(47); - SET_FLAG(0xDBA7, 1); + inventory->add(kInvItemHandkerchief); + SET_FLAG(dsAddr_SearchedGrandpaDrawersFlag, 1); } - return true; + break; case 0x5c84: - if (CHECK_FLAG(0xDB92, 1)) { - inventory->add(2); + if (CHECK_FLAG(dsAddr_alreadyAdjustedHoopPoleFlag, 1)) { + inventory->add(kInvItemShotgun); disableObject(7); playSound(32, 7); setOns(0, 0); playActorAnimation(520); } else { - Dialog::pop(scene, 0xDACE, 0, 522, 0xd1, 0xd8, 0, 1); + dialog->pop(scene, dsAddr_dialogStackGrandpaShotgun, 0, 522, textColorMark, textColorGrandpa, 0, 1); } - return true; + break; - case 0x5cf0://Exit basketball house + case 0x5cf0:// Exit basketball house playSound(88, 5); playActorAnimation(981); loadScene(20, 161, 165); - return true; + break; - case 0x5d24: //getting the fan - if (CHECK_FLAG(0xDB92, 1)) { + case 0x5d24: // getting the fan + if (CHECK_FLAG(dsAddr_alreadyAdjustedHoopPoleFlag, 1)) { setLan(2, 0); playSound(32, 7); playActorAnimation(508); disableObject(13); - inventory->add(7); + inventory->add(kInvItemFan); } else { - Dialog::pop(scene, 0xDAD4, 0, 522, 0xd1, 0xd8, 0, 1); + dialog->pop(scene, dsAddr_dialogStackGrandpaFan, 0, 522, textColorMark, textColorGrandpa, 0, 1); } - return true; + break; - case 0x5e4d: //right click on ann - if (!CHECK_FLAG(0xDB97, 0)) { - displayMessage(0x3d59); + case 0x5e4d: // right click on ann + if (!CHECK_FLAG(dsAddr_alreadySpokenToAnneFlag, 0)) { + displayMessage(dsAddr_girlTalkMsg); // "I really don't know how to talk to girls" } else { moveTo(245, 198, 1); - Dialog::show(scene, 0x21d7, 0, 524, 0xd1, 0xe5, 0, 2); - //waitLanAnimationFrame(2, 1); //too long, about 200 frames! seems to be present in original game (sic) - SET_FLAG(0xDB97, 1); + dialog->show(51, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + //waitLanAnimationFrame(2, 1); // too long, about 200 frames! seems to be present in original game (sic) + SET_FLAG(dsAddr_alreadySpokenToAnneFlag, 1); for (byte i = 10; i <= 20; i += 2) playSound(13, i); playAnimation(528, 1); wait(50); playMusic(7); - SET_FLAG(0xDBEE, 1); + SET_FLAG(dsAddr_lovestruckByAnneFlag, 1); for (byte i = 3; i <= 17; i += 2) playSound(56, i); playActorAnimation(525); @@ -1633,163 +2594,146 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(55, 5); playActorAnimation(527); wait(50); - Dialog::show(scene, 0x2219, 0, 524, 0xd1, 0xe5, 0, 2); - scene->getObject(2)->setName((const char *)res->dseg.ptr(0x9820)); + dialog->show(52, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + scene->getObject(2)->setName((const char *)res->dseg.ptr(dsAddr_scnObjNameAnne)); } - return true; + break; - case 0x5f73: //exiting ann's house - if (CHECK_FLAG(0xDBEE, 1)) + case 0x5f73: // exiting ann's house + if (CHECK_FLAG(dsAddr_lovestruckByAnneFlag, 1)) playMusic(6); loadScene(21, 99, 180, 3); - return true; + break; case 0x5fba: - if (CHECK_FLAG(0xDBB1, 1)) { - displayMessage(0x4380); + if (CHECK_FLAG(dsAddr_nutSwappedForAppleFlag, 1)) { + displayMessage(dsAddr_noFruitMsg); // "There are no more interesting fruits here" } else { - Dialog::pop(scene, 0xDAFC, 0, 523, 0xd1, 0xe5, 0, 1); + dialog->pop(scene, dsAddr_dialogStackGetAppleOldLady, 0, 523, textColorMark, textColorOldLady, 0, 1); } - return true; + break; case 0x607f: - return processCallback(0x60b5); + fnEgoScaredBySpider(); + break; case 0x6083: - if (CHECK_FLAG(0xDBA4, 1)) { + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) { setOns(0, 0); playSound(56, 10); playActorAnimation(599); - inventory->add(37); + inventory->add(kInvItemShovelAct2); disableObject(2); } else - processCallback(0x60b5); - return true; + fnEgoScaredBySpider(); + break; - case 0x60b5: - if (CHECK_FLAG(0xDBAE, 1)) { - processCallback(0x60d9); - Dialog::showMark(scene, 0x2fdd); - } else { - Dialog::showMark(scene, 0x2e41); - processCallback(0x60d9); - wait(100); - Dialog::showMark(scene, 0x2e6d); - } - return true; + case csAddr_egoScaredBySpider: + fnEgoScaredBySpider(); + break; - case 0x60d9: { - Object *obj = scene->getObject(3); - moveTo(obj); - processCallback(0x612b); - moveTo(48, 190, 3); - } - return true; + case csAddr_moveToLadderAndLeaveCellar: + fnMoveToLadderAndLeaveCellar(); + break; - case 0x612b: - playSound(52, 10); - playSound(52, 14); - playSound(52, 18); - playSound(52, 21); - playSound(52, 25); - playSound(52, 28); - playSound(52, 32); - playActorAnimation(600); - loadScene(21, 297, 178, 3); - return true; + case csAddr_leaveCellar: + fnLeaveCellar(); + break; case 0x6176: - if (CHECK_FLAG(0xDBA4, 1)) { - displayMessage(0x3801); - return true; + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) { + displayMessage(dsAddr_notInDarkMsg); // "I'm not going to wander here in the dark again" + } else { + playSound(71, 6); + playActorAnimation(598); + loadScene(24, scene->getPosition()); + setOns(2, 0); + setLan(1, 0); + playAnimation(660, 0); + disableObject(1); + SET_FLAG(dsAddr_lightOnFlag, 1); + loadScene(24, scene->getPosition()); } - playSound(71, 6); - playActorAnimation(598); - loadScene(24, scene->getPosition()); - setOns(2, 0); - setLan(1, 0); - playAnimation(660, 0); - disableObject(1); - SET_FLAG(0xDBA4, 1); - loadScene(24, scene->getPosition()); - - return true; + break; case 0x61e9: - if (CHECK_FLAG(0xDBA4, 1)) { - Dialog::popMark(scene, 0xdb1e); - } else - processCallback(0x61fe); + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + dialog->popMark(scene, dsAddr_dialogStackTakeAxe); + else + fnTooDark(); + break; - return true; + case csAddr_TooDark: + displayMessage(dsAddr_TooDarkMsg); // "It's too dark to see clearly" + break; - case 0x6229: //shelves in cellar - if (CHECK_FLAG(0xDBA4, 1)) { + case 0x6229: // shelves in cellar + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) { Common::Point p = scene->getPosition(); - byte v = GET_FLAG(0xDBB4); + byte v = GET_FLAG(dsAddr_cellarShelfExamineCount); switch (v) { case 0: - displayMessage(0x4532); + displayMessage(dsAddr_whatGotMsg); // "Let's look what we've got here" moveRel(-34, 0, 1); - displayMessage(0x4555); + displayMessage(dsAddr_strawberryJamMsg); // "Strawberry jam" moveRel(20, 0, 1); - displayMessage(0x4568); + displayMessage(dsAddr_gooseberryJamMsg); // "Gooseberry jam" moveRel(20, 0, 1); - displayMessage(0x457b); + displayMessage(dsAddr_blackberryJamMsg); // "Blackberry jam" moveRel(20, 0, 1); - displayMessage(0x458e); + displayMessage(dsAddr_bilberryJamMsg); // "Bilberry jam" moveTo(p, 3); - displayMessage(0x459f); - SET_FLAG(0xDBB4, 1); + displayMessage(dsAddr_getMeOutJamMsg); // "Get me out of this jam!" + SET_FLAG(dsAddr_cellarShelfExamineCount, 1); break; case 1: - displayMessage(0x45b8); + displayMessage(dsAddr_rosemaryJamMsg); // "Oh, and there is Rosemary jam" wait(100); - displayMessage(0x45da); - SET_FLAG(0xDBB4, 2); + displayMessage(dsAddr_knowRosemaryMsg); // "I used to know someone called Rosemary" + SET_FLAG(dsAddr_cellarShelfExamineCount, 2); break; default: - displayMessage(0x4603); + displayMessage(dsAddr_unwantedJamsMsg); // "I don't want those jams" + break; } } else - processCallback(0x61fe); - - return true; + fnTooDark(); + break; - case 0x6480: //dive mask - if (CHECK_FLAG(0xDB96, 1)) { + case 0x6480: // dive mask + if (CHECK_FLAG(dsAddr_birdsGoneFromScarecrowFlag, 1)) { playSound(56, 7); playSound(5, 15); playActorAnimation(613); setOns(3, 36); - inventory->add(39); + inventory->add(kInvItemMask); disableObject(5); - displayMessage(0x387c); + displayMessage(dsAddr_needSunglassesMsg); // "Sorry buddy, but I need your sunglasses" } else - displayMessage(0x3eb2); - return true; + displayMessage(dsAddr_crowKillMsg); // "I'm sure these crows will kill me" + break; - case 0x64c4: //flippers - if (CHECK_FLAG(0xDB96, 1)) { + case 0x64c4: // flippers + if (CHECK_FLAG(dsAddr_birdsGoneFromScarecrowFlag, 1)) { setOns(2, 35); playSound(63, 8); playSound(24, 10); playActorAnimation(612); - inventory->add(40); + inventory->add(kInvItemFins); disableObject(6); } else - displayMessage(0x3eb2); - return true; + displayMessage(dsAddr_crowKillMsg); // "I'm sure these crows will kill me" + break; - case 0x7907://Describe car lever - if (CHECK_FLAG(0xdb94, 1)) {//Already pulled lever? - displayMessage(0x3e4f); - return true; + case 0x7907: // Describe car lever + if (CHECK_FLAG(dsAddr_alreadyPulledTrunkReleaseLeverFlag, 1)) { // Already pulled lever? + displayMessage(dsAddr_openBootMsg); // "It opens the boot" } else - return false; + retVal = false; + break; - case 0x62d0://Get bone from under rock - displayAsyncMessage(0x463c, 30938, 16, 24); + case 0x62d0: // Get bone from under rock + displayAsyncMessage(dsAddr_yeowMsg, 218, 96, 16, 24); // "YEEEOOOWWWW!" playSound(26, 6); playSound(26, 10); playSound(24, 13); @@ -1798,35 +2742,34 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(594); setOns(0, 29); disableObject(1); - inventory->add(36); + inventory->add(kInvItemBone); playSound(5, 2); playActorAnimation(595); - displayMessage(0x3790); - return true; + displayMessage(dsAddr_dinoBoneMsg); // "I really hope this is DINOSAUR bone" + break; case 0x6351: - if (CHECK_FLAG(0xdaca, 1)) { //cave bush is cut down + if (CHECK_FLAG(dsAddr_caveThornsCutDownFlag, 1)) { // cave bush is cut down playMusic(8); loadScene(26, 319, 169, 4); } else - displayMessage(0x3bd2); - return true; + displayMessage(dsAddr_ridBushMsg); // "I must get rid of this bush first" + break; case 0x63ea: playSound(5, 10); setOns(0, 0); playActorAnimation(640); - inventory->add(50); + inventory->add(kInvItemNugget); disableObject(6); - return true; + break; - case 0x6411://Kick hen - if (CHECK_FLAG(0xdb93, 1)) { //already kicked hen - displayMessage(0x3e08); - return true; + case 0x6411: // Kick hen + if (CHECK_FLAG(dsAddr_alreadyKickedHenFlag, 1)) { // already kicked hen + displayMessage(dsAddr_ridFrustationsMsg); // "I'd already got rid of my frustrations" } else { - SET_FLAG(0xdb93, 1); - displayMessage(0x3dc6); + SET_FLAG(dsAddr_alreadyKickedHenFlag, 1); + displayMessage(dsAddr_henFlyMsg); // "I wonder if hens can fly. Come here, baby" waitLanAnimationFrame(1, 87); playSound(30, 26); playSound(29, 49); @@ -1835,198 +2778,191 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); setOns(0, 1); enableObject(14); - displayMessage(0x3df4); - return true; + displayMessage(dsAddr_firstTestFailMsg); // "First test failed" } + break; - case 0x6592: //Rake + case 0x6592: // Rake setOns(1, 0); playSound(18, 10); playActorAnimation(553); - inventory->add(0x15); + inventory->add(kInvItemRakeBroken); wait(50); - displayMessage(0x3605); + displayMessage(dsAddr_trousersMsg); // "Good I always asked mum for trousers with BIG pockets" disableObject(11); - return true; + break; case 0x66b5: playSound(89, 5); playActorAnimation(969); loadScene(33, 319, 181, 4); - return true; + break; - case 0x6519://Sickle + case 0x6519: // Sickle setOns(4, 0); playSound(5, 11); playActorAnimation(625); - inventory->add(0x2c); + inventory->add(kInvItemSickleBlunt); disableObject(8); - return true; + break; - case 0x655b://Get needle from haystack - if (CHECK_FLAG(0xdb9d, 1)) { //already have needle - displayMessage(0x356a); - return true; + case 0x655b: // Get needle from haystack + if (CHECK_FLAG(dsAddr_gotNeedleAlreadyFlag, 1)) { // already have needle + displayMessage(dsAddr_dontPushLuckMsg); // "I don't think I should push my luck" } else { - SET_FLAG(0xdb9d, 1); + SET_FLAG(dsAddr_gotNeedleAlreadyFlag, 1); playSound(49, 3); playActorAnimation(548); - inventory->add(0x11); - displayMessage(0x35b2); - return true; + inventory->add(kInvItemNeedle); + displayMessage(dsAddr_needleHaystackMsg); // "And they say you can't find a needle in a haystack" } + break; - case 0x663c://Feather + case 0x663c: // Feather setOns(0, 0); playSound(5, 9); playActorAnimation(511); - inventory->add(1); + inventory->add(kInvItemFeather); disableObject(15); - return true; + break; case 0x667c: playSound(70, 4); playActorAnimation(972); loadScene(29, 160, 199, 1); - return true; + break; case 0x66a9: - displayMessage(0x4a7e); + displayMessage(dsAddr_dontLeaveMansionMsg); // "I don't want to leave the mansion, I want blood!" disableObject(4); - return true; + break; case 0x66e2: playSound(88, 4); playActorAnimation(970); loadScene(35, 160, 199, 1); - return true; + break; case 0x70bb: - Dialog::pop(scene, 0xdb24, 0, 709, 0xd1, 0xef, 0, 1); - return true; + dialog->pop(scene, dsAddr_dialogStackBusyCook, 0, 709, textColorMark, textColorCook, 0, 1); + break; case 0x71ae: - if (CHECK_FLAG(0xDBCD, 1)) { - if (CHECK_FLAG(0xDBCE, 1)) { - displayMessage(0x4f9b); + if (CHECK_FLAG(dsAddr_MansionRadioBrokenFlag, 1)) { + if (CHECK_FLAG(dsAddr_MansionGotRadioBatteriesFlag, 1)) { + displayMessage(dsAddr_restUselessMsg); // "The rest is useless" } else { - displayMessage(0x4fb1); + displayMessage(dsAddr_twoBatteriesMsg); // "Wow! Two 1.5V batteries!" playSound(32, 6); playActorAnimation(717); - inventory->add(66); - SET_FLAG(0xDBCE, 1); + inventory->add(kInvItemBatteries); + SET_FLAG(dsAddr_MansionGotRadioBatteriesFlag, 1); } } else - Dialog::showMark(scene, 0x3c9d); - return true; + dialog->showMark(97, scene); + break; case 0x70c8: - if (!processCallback(0x70e0)) - return true; - moveTo(81, 160, 4); - displayMessage(0x5cac); - return true; - - case 0x70e0: - if (!CHECK_FLAG(0xDBCC, 1)) { - displayMessage(0x4ece); - return false; + if (fnIsCookGone()) { + moveTo(81, 160, 4); + displayMessage(dsAddr_cognacMsg); // "Pfui! The cognac really didn't do any good" } - return true; + break; + + case csAddr_isCookGone: + retVal = fnIsCookGone(); + break; case 0x70ef: - if (!processCallback(0x70e0)) - return true; - displayMessage(0x5046); - return true; + if (fnIsCookGone()) + displayMessage(dsAddr_tooHotMsg); // "It's too hot to touch!" + break; case 0x70f9: - if (inventory->has(68)) { - inventory->remove(68); + if (inventory->has(kInvItemBurningPaper)) { + inventory->remove(kInvItemBurningPaper); loadScene(29, 40, 176, 2); - displayMessage(0x500a); + displayMessage(dsAddr_paperBurntMsg); // "The paper burnt out completely!" } else loadScene(29, 40, 176, 2); - return true; + break; case 0x712c: - if (!processCallback(0x70e0)) - return true; - - if (CHECK_FLAG(0xDBCF, 1)) { - playSound(89, 4); - playActorAnimation(719); - setOns(4, 67); - ++ *res->dseg.ptr(READ_LE_UINT16(res->dseg.ptr(0x6746 + (scene->getId() - 1) * 2))); - disableObject(5); - enableObject(12); - } else { - playSound(89, 4); - playSound(89, 4); - playSound(87, 45); - displayAsyncMessage(0x4fcb, 34672, 11, 35, 0xe5); - playActorAnimation(718); - wait(100); - displayMessage(0x4fe2); - SET_FLAG(0xDBCF, 1); + if (fnIsCookGone()) { + if (CHECK_FLAG(dsAddr_MansionHaveOpenedFridgeBeforeFlag, 1)) { + playSound(89, 4); + playActorAnimation(719); + setOns(4, 67); + ++ *res->dseg.ptr(READ_LE_UINT16(res->dseg.ptr(dsAddr_sceneWalkboxTablePtr + (scene->getId() - 1) * 2))); + disableObject(5); + enableObject(12); + } else { + playSound(89, 4); + playSound(89, 4); + playSound(87, 45); + displayAsyncMessage(dsAddr_oneTakenMsg, 112, 108, 11, 35, textColorEskimo); // "This one's taken, OK?" + playActorAnimation(718); + wait(100); + displayMessage(dsAddr_slightMadMsg); // "It finally happened. I'm slightly mad" + SET_FLAG(dsAddr_MansionHaveOpenedFridgeBeforeFlag, 1); + } } - return true; + break; case 0x71eb: setOns(2, 0); playSound(32, 7); playActorAnimation(710); - inventory->add(62); + inventory->add(kInvItemChilliWithLabel); disableObject(7); enableObject(8); - return true; + break; case 0x7244: - if (!processCallback(0x70e0)) - return true; - displayMessage(0x5c60); - return true; + if (fnIsCookGone()) + displayMessage(dsAddr_neverLearntMsg); // "I never learnt to how use one" + break; case 0x7255: - if (CHECK_FLAG(0xDBD0, 1)) { + if (CHECK_FLAG(dsAddr_MansionPutBurningPaperInFridgeFlag, 1)) { setOns(4, 69); playSound(32, 5); playActorAnimation(725); disableObject(12); - inventory->add(69); + inventory->add(kInvItemMeat); } else { playActorAnimation(721); - displayMessage(0x505e); + displayMessage(dsAddr_frozenShelfMsg); // "It has frozen hard onto the shelf!" } - return true; + break; case 0x721c: setOns(3, 0); playSound(32, 7); playActorAnimation(715); - inventory->add(63); + inventory->add(kInvItemPastryRoller); disableObject(9); - return true; + break; case 0x7336: setOns(1, 0); playSound(5, 42); - displayAsyncMessage(0x4d02, 32642, 20, 38); + displayAsyncMessage(dsAddr_noDepraveMsg, 2, 102, 20, 38); // "Nah, I don't want to deprave the kids" playActorAnimation(697); - inventory->add(56); + inventory->add(kInvItemCognac); disableObject(1); - return true; + break; case 0x7381: playSound(5, 12); playActorAnimation(704); disableObject(2); - inventory->add(58); - return true; + inventory->add(kInvItemIceTongs); + break; case 0x7408: - if (CHECK_FLAG(0xDBC4, 1)) { - displayMessage(0x4d2a); + if (CHECK_FLAG(dsAddr_mansionReadNewspaperFlag, 1)) { + displayMessage(dsAddr_noReadAgainMsg); // "I don't want to read it again. I might like it." } else { setOns(0, 0); playSound(26, 17); @@ -2038,45 +2974,45 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(698); setOns(0, 52); setOns(2, 61); - Dialog::showMark(scene, 0x38b6); + dialog->showMark(92, scene); enableObject(11); - SET_FLAG(0xDBC4, 1); + SET_FLAG(dsAddr_mansionReadNewspaperFlag, 1); } - return true; + break; case 0x7476: - if (CHECK_FLAG(0xDBC9, 1)) { - displayMessage(0x4dbb); + if (CHECK_FLAG(dsAddr_mansionExaminedCouchBeforeFlag, 1)) { + displayMessage(dsAddr_noSleepMsg); // "I don't want to sleep" } else { - SET_FLAG(0xDBC9, 1); - Dialog::showMark(scene, 0x3aca); + SET_FLAG(dsAddr_mansionExaminedCouchBeforeFlag, 1); + dialog->showMark(94, scene); playSound(61, 5); playSound(5, 14); playActorAnimation(705); - displayMessage(0x4dd3); - inventory->add(59); + displayMessage(dsAddr_justCorkMsg); // "It's just a cork" + inventory->add(kInvItemCork); } - return true; + break; case 0x74d1: setOns(2, 0); playSound(5, 12); playActorAnimation(699); - inventory->add(57); + inventory->add(kInvItemRemoteControl); disableObject(11); - return true; + break; - case 0x7513: //fatso + doctor: pre-final - if (CHECK_FLAG(0xDBD7, 1)) { - if (CHECK_FLAG(0xDBD8, 1)) { + case 0x7513: // fatso + doctor: pre-final + if (CHECK_FLAG(dsAddr_MansionThruFanByTimePillFlag, 1)) { + if (CHECK_FLAG(dsAddr_MansionVentFanStoppedFlag, 1)) { playSound(88, 4); playActorAnimation(979); loadScene(37, 51, 183); - Dialog::show(scene, 0x54ea, 768, 769, 0xd9, 0xe5, 1, 2); + dialog->show(125, scene, 768, 769, textColorMansionGuard, textColorProfessor, 1, 2); playAnimation(770, 0, true, true, true); playAnimation(771, 1, true, true, true); - Dialog::showMono(scene, 0x5523, 0, 0xd1, 0); + dialog->showMono(126, scene, 0, textColorMark, 0); playAnimation(770, 0, true, true, true); playAnimation(771, 1, true, true, true); playSound(5, 3); @@ -2090,11 +3026,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); setOns(0, 74); hideActor(); - Dialog::showMono(scene, 0x5556, 775, 0xd0, 1); + dialog->showMono(127, scene, 775, textColorJohnNoty, 1); playAnimation(771, 1, true, true, true); playAnimation(776, 0); - Dialog::show(scene, 0x55f7, 777, 778, 0xd0, 0xe5, 1, 2); //i have to kill you anyway + dialog->show(128, scene, 777, 778, textColorJohnNoty, textColorProfessor, 1, 2); playAnimation(779, 0, true, true, true); playAnimation(780, 1, true, true, true); @@ -2151,7 +3087,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(0, 80); playAnimation(792, 3, true, true, true); - Dialog::show(scene, 0x5665, 0, 791, 0xd1, 0xd0, 0, 4); + dialog->show(129, scene, 0, 791, textColorMark, textColorJohnNoty, 0, 4); playAnimation(792, 3, true, true, true); moveTo(40, 171, 4); @@ -2161,43 +3097,47 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(0, 3); loadScene(31, 298, 177, 4); - SET_FLAG(0xDBD9, 1); - } else { - displayMessage(0x52fe); - } + SET_FLAG(dsAddr_MansionJohnNotyEscapingFlag, 1); + } else + displayMessage(dsAddr_ventFirstMsg); // "I'd better stop this ventilator first" } else - displayMessage(0x52cb); - return true; + displayMessage(dsAddr_noSaladMsg); // "I don't want to turn myself into a salad" + break; case 0x783d: - Dialog::pop(scene, 0xdb36, 0, 797, 0xd1, 0xd0, 0, 1); - return true; + dialog->pop(scene, dsAddr_dialogStackJohnNotyEndgame, 0, 797, textColorMark, textColorJohnNoty, 0, 1); + break; case 0x7966: - if (CHECK_FLAG(0xDBA4, 1)) - return false; - return processCallback(0x60b5); + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + retVal = false; + else + fnEgoScaredBySpider(); + break; case 0x7ad0: case 0x7ad7: - return !processCallback(0x70e0); + retVal = !fnIsCookGone(); + break; case 0x7ab9: - if (CHECK_FLAG(0xDBB6, 1)) - return false; - Dialog::showMono(scene, 0x37d0, 0, 0xd1, 0); - SET_FLAG(0xDBB6, 1); - return true; + if (CHECK_FLAG(dsAddr_vgaArtistQuipAlreadySaidFlag, 1)) + retVal = false; + else { + dialog->showMono(90, scene, 0, textColorMark, 0); + SET_FLAG(dsAddr_vgaArtistQuipAlreadySaidFlag, 1); + } + break; case 0x7ade: - if (CHECK_FLAG(0xdbcd, 1)) { - displayMessage(0x4f69); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_MansionRadioBrokenFlag, 1)) + displayMessage(dsAddr_whatInsideMsg); // "I was always curious what's inside these things" + else + retVal = false; + break; - case 0x7f23://Use grenade on captains drawer - if (CHECK_FLAG(0xDBDF, 3)) { + case 0x7f23: // Use grenade on captains drawer + if (CHECK_FLAG(dsAddr_FirstActTrialState, 3)) { enableOn(false); playSound(5, 3); playSound(58, 11); @@ -2207,123 +3147,120 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(870); playSound(54, 15); playActorAnimation(871); - SET_FLAG(0xDBE6, 1); + SET_FLAG(dsAddr_captainDrawerState, 1); setOns(1, 0x66); moveTo(224, 194, 0, true); - displayCutsceneMessage(0x57df, 30423); - inventory->remove(0x59); + displayCutsceneMessage(dsAddr_cutsceneMsg1, 23, 95); // "sixty seven rude words later" + inventory->remove(kInvItemRopeAndGrenade); enableOn(true); - } else { - displayMessage(0x5de2); - } - return true; + } else + displayMessage(dsAddr_captainWatchingMsg); // "with captain watching? Better not" + break; - case 0x505c: { - //suspicious stuff - Common::Point p = scene->getPosition(); - if (p.x != 203 && p.y != 171) - moveTo(203, 169, 2); - else - moveTo(203, 169, 1); - } - return true; + case csAddr_egoSuspiciousPosition: + fnEgoSuspiciousPosition(); + break; case 0x509a: - processCallback(0x505c); + fnEgoSuspiciousPosition(); setOns(1, 0); playSound(5, 10); playActorAnimation(543); - inventory->add(15); + inventory->add(kInvItemBranch); disableObject(9); - return true; + break; case 0x7802: - if (CHECK_FLAG(0xDBD7, 1)) { - if (CHECK_FLAG(0xDBD8, 1)) - displayMessage(0x52f6); + if (CHECK_FLAG(dsAddr_MansionThruFanByTimePillFlag, 1)) { + if (CHECK_FLAG(dsAddr_MansionVentFanStoppedFlag, 1)) + displayMessage(dsAddr_nahMsg); // "Nah" else { playSound(71, 4); playActorAnimation(796); setLan(1, 0); - SET_FLAG(0xDBD8, 1); + SET_FLAG(dsAddr_MansionVentFanStoppedFlag, 1); } } else - displayMessage(0x52cb); - return true; + displayMessage(dsAddr_noSaladMsg); // "I don't want to turn myself into a salad" + break; case 0x78e0: - processCallback(0x505c); - return false; + fnEgoSuspiciousPosition(); + retVal = false; + break; case 0x78e7: - processCallback(0x557e); - return false; - case 0x78ee: - processCallback(0x557e); - return false; + fnEgoDefaultPosition(); + retVal = false; + break; case 0x78f5: - if (CHECK_FLAG(0xDB95, 1)) { - displayMessage(0x3E75); - return true; + if (CHECK_FLAG(dsAddr_carTrunkEmptyFlag, 1)) { + displayMessage(dsAddr_bootEmptyMsg); // "There's nothing else in the boot" } else - return false; + retVal = false; + break; case 0x7919: - if (!CHECK_FLAG(0xDBA5, 1)) - return false; - displayMessage(0x3E98); - return true; + if (!CHECK_FLAG(dsAddr_laundryState, 1)) + retVal = false; + else + displayMessage(dsAddr_clothesDryMsg); // "The clothes are dry now." + break; case 0x7950: - if (!CHECK_FLAG(0xDBB1, 1)) - return false; - - displayMessage(0x3DAF); - return true; + if (CHECK_FLAG(dsAddr_nutSwappedForAppleFlag, 1)) + displayMessage(dsAddr_nutRealMsg); // "Only the nut is real" + else + retVal = false; + break; case 0x7975: - if (CHECK_FLAG(0xDBA4, 1)) - return false; - displayMessage(0x3832); - return true; + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + retVal = false; + else + displayMessage(dsAddr_shutValveMsg); // "Shutting the valve shook the dirt from the wall..." + break; case 0x7987: case 0x7996: case 0x79a5: case 0x79b4: - if (CHECK_FLAG(0xDBA4, 1)) - return false; - return processCallback(0x61fe); + if (CHECK_FLAG(dsAddr_lightOnFlag, 1)) + retVal = false; + else + fnTooDark(); + break; case 0x79d2: - if (!CHECK_FLAG(0xDB9D, 1)) - return false; - displayMessage(0x3590); - return true; + if (!CHECK_FLAG(dsAddr_gotNeedleAlreadyFlag, 1)) + retVal = false; + else + displayMessage(dsAddr_ordinaryHaystackMsg); // "Just an ordinary hay stack. Now." + break; case 0x7af0: - if (!processCallback(0x70e0)) - return true; - return false; + if (fnIsCookGone()) + retVal = false; + break; case 0x8117: - Dialog::show(scene, 0x0a41, 0, 529, 0xd1, 0xd9, 0, 1); + dialog->show(9, scene, 0, 529, textColorMark, textColorMansionGuard, 0, 1); playSound(5, 2); playSound(5, 44); playAnimation(642, 0, true); playActorAnimation(641, true); waitAnimation(); - Dialog::show(scene, 0x0aff, 0, 529, 0xd1, 0xd9, 0, 1); + dialog->show(10, scene, 0, 529, textColorMark, textColorMansionGuard, 0, 1); wait(170); - Dialog::show(scene, 0x0ba0, 0, 529, 0xd1, 0xd9, 0, 1); + dialog->show(11, scene, 0, 529, textColorMark, textColorMansionGuard, 0, 1); moveRel(0, 1, 0); wait(100); - Dialog::show(scene, 0x0c10, 0, 529, 0xd1, 0xd9, 0, 1); - inventory->remove(50); - processCallback(0x9d45); - return true; + dialog->show(12, scene, 0, 529, textColorMark, textColorMansionGuard, 0, 1); + inventory->remove(kInvItemNugget); + fnMansionIntrusionAttempt(); + break; case 0x8174: setOns(0, 0); @@ -2336,7 +3273,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(1, 15); disableObject(3); enableObject(9); - return true; + break; case 0x81c2: playSound(56, 11); @@ -2353,12 +3290,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(588, true); waitAnimation(); wait(50); - displayMessage(0x367f); - inventory->remove(34); - SET_FLAG(0xDBA1, 1); - return true; + displayMessage(dsAddr_itsGoneMsg); // "At least it's gone" + inventory->remove(kInvItemPaintedPotato); + SET_FLAG(dsAddr_mansionTreeHollowEmptyFlag, 1); + break; - case 0x823d: //grappling hook on the wall + case 0x823d: // grappling hook on the wall playSound(5, 3); for (byte i = 16; i <= 28; i += 2) playSound(65, i); @@ -2367,27 +3304,26 @@ bool TeenAgentEngine::processCallback(uint16 addr) { for (byte i = 3; i <= 18; i += 3) playSound(56, i); - displayAsyncMessage(0x3ace, 3878, 20, 37, 0xd9); + displayAsyncMessage(dsAddr_heyLetGoMsg, 38, 12, 20, 37, textColorMansionGuard); // "Hey, let go, will ya?!" playActorAnimation(621, true); playAnimation(623, 1, true); waitAnimation(); - displayAsyncMessage(0x3ae6, 3870, 1, 9, 0xd9); + displayAsyncMessage(dsAddr_aaahhhMsg, 30, 12, 1, 9, textColorMansionGuard); // "Aaaaaaaaaaaaahhh!" playSound(35, 1); playActorAnimation(622, true); playAnimation(624, 0, true); waitAnimation(); wait(150); - displayMessage(0x3afd); - - inventory->remove(43); - processCallback(0x9d45); - return true; + displayMessage(dsAddr_oopsMsg); // "Oops" + inventory->remove(kInvItemGrapplingHook); + fnMansionIntrusionAttempt(); + break; - case 0x8312: //hedgehog + plastic apple - Dialog::showMark(scene, 0x3000); + case 0x8312: // hedgehog + plastic apple + dialog->showMark(76, scene); setLan(1, 0); playSound(5, 24); playSound(26, 32); @@ -2405,13 +3341,13 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); disableObject(6); - displayMessage(0x363f); - inventory->remove(27); - inventory->add(28); - return true; + displayMessage(dsAddr_lifeIsBrutalMsg); // "Life is brutal" + inventory->remove(kInvItemPlasticApple); + inventory->add(kInvItemCone); + break; case 0x839f: - inventory->remove(32); + inventory->remove(kInvItemDart); playSound(37, 14); playSound(16, 17); playActorAnimation(564, true); @@ -2437,10 +3373,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(55, 18); playAnimation(581, 1); disableObject(2); - SET_FLAG(0xDB9F, 1); - return true; + SET_FLAG(dsAddr_beesGoneFlag, 1); + break; - case 0x84c7: //using paddle on boat + case 0x84c7: // using paddle on boat playSound(20, 9); playActorAnimation(530); loadScene(16, 236, 95, 1); @@ -2451,12 +3387,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(533); setOns(0, 9); moveTo(236, 95, 1, true); - return true; + break; - case 0x8538://Sharpen sickle on well + case 0x8538: // Sharpen sickle on well moveTo(236, 190, 0); setOns(2, 0); - //TODO: Remove handle sprite + // FIXME: Add code to Remove handle sprite (visible GFX glitch) playSound(5, 4); playSound(14, 14); playSound(14, 33); @@ -2464,52 +3400,58 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(643); setOns(2, 43); moveTo(236, 179, 3); - inventory->remove(0x2c); - inventory->add(0x2e); - return true; + inventory->remove(kInvItemSickleBlunt); + inventory->add(kInvItemSickleSharp); + break; + + case 0x85d6: + displayMessage(dsAddr_paddleBrokenMsg); // "The paddle is BROKEN" + break; case 0x85eb: - if (CHECK_FLAG(0xDBB0, 1)) { + if (CHECK_FLAG(dsAddr_squirrelNutState, 1)) { enableObject(6); playSound(25, 10); playSound(25, 14); playSound(25, 18); playActorAnimation(559); setOns(1, 23); - SET_FLAG(0xDBB0, 2); + SET_FLAG(dsAddr_squirrelNutState, 2); } else - displayMessage(0x3d86); - - return true; + displayMessage(dsAddr_dontWorkPurposeMsg); // "I usually don't work without a purpose" + break; case 0x863d: playSound(12, 4); playSound(50, 20); playSound(50, 29); playActorAnimation(554); - inventory->remove(19); - inventory->add(22); - return true; + inventory->remove(kInvItemChocCandy); + inventory->add(kInvItemHeartShapedCandy); + break; case 0x8665: playSound(5, 3); for (byte i = 12; i <= 24; i += 2) playSound(56, i); playActorAnimation(567); - inventory->remove(12); - inventory->add(33); - return true; + inventory->remove(kInvItemFeatherDusterClean); + inventory->add(kInvItemFeatherDusterDirty); + break; case 0x862c: - displayMessage(CHECK_FLAG(0xDBB0, 1) ? 0x4882 : 0x3457); - return true; + if (CHECK_FLAG(dsAddr_squirrelNutState, 1)) + displayMessage(dsAddr_nutRakeMsg); // "It's pointless, the nut will slip between the rake's teeth" + else + displayMessage(dsAddr_objErrorMsg); // "That's no good" + break; - case 0x86a9: //correcting height of the pole with spanner - if (CHECK_FLAG(0xDB92, 1)) { - displayMessage(0x3d40); + case 0x86a9: // correcting height of the pole with spanner + if (CHECK_FLAG(dsAddr_alreadyAdjustedHoopPoleFlag, 1)) { + displayMessage(dsAddr_noNeedMsg); // "No need to do it again" } else { - SET_FLAG(0xDB92, 1); - Dialog::show(scene, 0x0fcd, 0, 502, 0xd0, 0xe5, 0, 1); + SET_FLAG(dsAddr_alreadyAdjustedHoopPoleFlag, 1); + dialog->show(17, scene, 0, 502, textColorMark, textColorSonny, 0, 1); waitLanAnimationFrame(1, 7); playSound(5, 16); playSound(1, 25); @@ -2528,7 +3470,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(5, 43); playSound(61, 70); playSound(61, 91); - displayAsyncMessage(0x3cfb, 28877, 6, 17); + displayAsyncMessage(dsAddr_ConfusionMsg, 77, 90, 6, 17); // "!?&!" playActorAnimation(505, true); playAnimation(507, 0, true); waitAnimation(); @@ -2552,8 +3494,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) { disableObject(15); disableObject(16); moveTo(162, 164, 2); - displayMessage(0x3d01, 0xe5, 24390); - displayMessage(0x3d20, 0xd8, 24410); + displayMessage(dsAddr_grandpaPromiseMsg, textColorSonny, 70, 76); // "But grandpa, you promised!" + displayMessage(dsAddr_ohLetsGoMsg, textColorGrandpa, 90, 76); // "Oh all right. Let's go" moveTo(162, 191, 2); setOns(1, 0); setOns(2, 0); @@ -2572,133 +3514,118 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(512, 0); wait(100); - displayMessage(0x3d3a); + displayMessage(dsAddr_byeMsg); // "Bye." { Object *obj = scene->getObject(7); - obj->actor_rect.left = obj->actor_rect.right = 228; - obj->actor_rect.top = obj->actor_rect.bottom = 171; - obj->actor_rect.save(); + obj->actorRect.left = obj->actorRect.right = 228; + obj->actorRect.top = obj->actorRect.bottom = 171; + obj->actorRect.save(); } { Object *obj = scene->getObject(8); - obj->actor_rect.left = obj->actor_rect.right = 290; - obj->actor_rect.top = obj->actor_rect.bottom = 171; - obj->actor_rect.save(); + obj->actorRect.left = obj->actorRect.right = 290; + obj->actorRect.top = obj->actorRect.bottom = 171; + obj->actorRect.save(); } } - return true; + break; - case 0x88c9: //give flower to old lady - if (CHECK_FLAG(0xDB9A, 1)) - return processCallback(0x890b); - - inventory->remove(10); - SET_FLAG(0xDB9A, 1); - processCallback(0x88DE); - return true; - - case 0x88de: - playSound(5, 2); - Dialog::show(scene, 0x1B5F, 0, 523, 0xd1, 0xe5, 0, 1); - playActorAnimation(537, true); - playAnimation(538, 0, true); - waitAnimation(); - wait(100); - Dialog::show(scene, 0x1BE0, 0, 523, 0xd1, 0xe5, 0, 1); - return true; + case 0x88c9: // give flower to old lady + if (CHECK_FLAG(dsAddr_givenFlowerToOldLadyAlreadyFlag, 1)) + fnGiveAnotherFlowerToOldLady(); + else { + inventory->remove(kInvItemFirstFlower); + SET_FLAG(dsAddr_givenFlowerToOldLadyAlreadyFlag, 1); + fnGivingFlowerToOldLady(); + } + break; - case 0x890b: - Dialog::pop(scene, 0xDAF0, 0, 523, 0xd1, 0xe5, 0, 1); - return true; + case csAddr_givingFlowerToOldLady: + fnGivingFlowerToOldLady(); + break; - case 0x8918://give flower to old lady - if (CHECK_FLAG(0xDB9A, 1)) - return processCallback(0x890B); + case csAddr_giveAnotherFlowerToOldLady: + fnGiveAnotherFlowerToOldLady(); + break; - inventory->remove(11); - SET_FLAG(0xDB9A, 1); - processCallback(0x88DE); - return true; + case 0x8918: // give flower to old lady + if (CHECK_FLAG(dsAddr_givenFlowerToOldLadyAlreadyFlag, 1)) + fnGiveAnotherFlowerToOldLady(); + else { + inventory->remove(kInvItemSecondFlower); + SET_FLAG(dsAddr_givenFlowerToOldLadyAlreadyFlag, 1); + fnGivingFlowerToOldLady(); + } + break; case 0x892d: - if (CHECK_FLAG(0xDB9B, 1)) - return processCallback(0x89aa); + if (CHECK_FLAG(dsAddr_givenFlowerToAnneAlreadyFlag, 1)) + fnGiveAnotherFlowerToAnne(); + else { + fnGivingFlowerToAnne(); + inventory->remove(kInvItemFirstFlower); + SET_FLAG(dsAddr_givenFlowerToAnneAlreadyFlag, 1); + } + break; - processCallback(0x8942); - inventory->remove(10); - SET_FLAG(0xDB9B, 1); - return true; + case csAddr_givingFlowerToAnne: + fnGivingFlowerToAnne(); + break; - case 0x8942: - Dialog::show(scene, 0x2293, 0, 524, 0xd1, 0xe5, 0, 2); - playSound(5, 10); - playActorAnimation(540, true); - playAnimation(539, 1, true); - waitAnimation(); - wait(100); - Dialog::show(scene, 0x24b1, 0, 524, 0xd1, 0xe5, 0, 2); - wait(50); - Dialog::show(scene, 0x24d7, 0, 524, 0xd1, 0xe5, 0, 2); - Dialog::show(scene, 0x2514, 0, 524, 0xd1, 0xe5, 0, 2); - wait(50); - moveRel(0, 1, 0); - Dialog::show(scene, 0x2570, 0, 524, 0xd1, 0xe5, 0, 2); - moveRel(0, -1, 0); - wait(50); - return true; - - case 0x89aa: - Dialog::pop(scene, 0xdb02, 0, 524, 0xd1, 0xe5, 0, 2); - return true; + case csAddr_giveAnotherFlowerToAnne: + fnGiveAnotherFlowerToAnne(); + break; case 0x89b7: - if (CHECK_FLAG(0xDB9B, 1)) - return processCallback(0x89aa); - - processCallback(0x8942); - inventory->remove(11); - SET_FLAG(0xDB9B, 1); - return true; + if (CHECK_FLAG(dsAddr_givenFlowerToAnneAlreadyFlag, 1)) + fnGiveAnotherFlowerToAnne(); + else { + fnGivingFlowerToAnne(); + inventory->remove(kInvItemSecondFlower); + SET_FLAG(dsAddr_givenFlowerToAnneAlreadyFlag, 1); + } + break; case 0x89cc: - inventory->remove(23); + inventory->remove(kInvItemWrappedCandy); playSound(5, 6); - Dialog::show(scene, 0x2634, 0, 524, 0xd1, 0xe5, 0, 2); + dialog->show(60, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + // FIXME - Dialog #61 not explicitly called. Does Dialog #60 run on somehow? playActorAnimation(555, true); playAnimation(556, 1, true); waitAnimation(); playActorAnimation(557, true); playAnimation(558, 1, true); waitAnimation(); - Dialog::show(scene, 0x2971, 0, 524, 0xd1, 0xe5, 0, 2); - inventory->add(24); - return true; + dialog->show(62, scene, 0, 524, textColorMark, textColorAnne, 0, 2); + inventory->add(kInvItemRibbon); + break; case 0x8a22: playSound(45, 16); playActorAnimation(560); - inventory->remove(26); - inventory->add(27); + inventory->remove(kInvItemNut); + inventory->add(kInvItemPlasticApple); wait(50); - Dialog::show(scene, 0x1ecd, 0, 523, 0xd1, 0xe5, 0, 1); - Dialog::show(scene, 0x1f09, 0, 523, 0xd1, 0xe5, 0, 1); - SET_FLAG(0xDBB1, 1); - return true; - - case 0x8a6f: //banknote + ann - if (CHECK_FLAG(0xDBB5, 1)) { - Dialog::show(scene, 0x2992, 0, 524, 0xd1, 0xe5, 0, 2); + dialog->show(44, scene, 0, 523, textColorMark, textColorOldLady, 0, 1); + dialog->show(45, scene, 0, 523, textColorMark, textColorOldLady, 0, 1); + SET_FLAG(dsAddr_nutSwappedForAppleFlag, 1); + break; + + case 0x8a6f: // banknote + ann + if (CHECK_FLAG(dsAddr_examinedBanknoteFlag, 1)) { + dialog->show(63, scene, 0, 524, textColorMark, textColorAnne, 0, 2); playSound(5, 3); playSound(5, 20); playAnimation(671, 1, true); playActorAnimation(670, true); waitAnimation(); //playAnimation(672, 1); - Dialog::show(scene, 0x2a00, 524, 672, 0xd1, 0xe5, 0, 2); + dialog->show(64, scene, 524, 672, textColorMark, textColorAnne, 0, 2); //playAnimation(672, 1); playSound(83, 12); - displayAsyncMessage(0x4a5b, 36684, 23, 38, 0xe5); + displayAsyncMessage(dsAddr_hundredBucksMsg, 204, 114, 23, 38, textColorAnne); // "A hundred bucks!!!" playActorAnimation(673); loadScene(11, scene->getPosition()); playSound(24, 31); @@ -2710,14 +3637,14 @@ bool TeenAgentEngine::processCallback(uint16 addr) { loadScene(28, 0, 167, 2); playMusic(10); moveTo(66, 167, 2); - displayMessage(0x4a6f); + displayMessage(dsAddr_wantBloodMsg); // "I want Blood!" inventory->clear(); - inventory->add(29); + inventory->add(kInvItemSuperGlue); } else - displayMessage(0x4a29); - return true; + displayMessage(dsAddr_showHerMoneyMsg); // "If I just show her the money, she might take it" + break; - case 0x8b82: //use fan on laundry + case 0x8b82: // use fan on laundry setOns(0, 0); playSound(5, 3); playSound(5, 6); @@ -2725,16 +3652,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(92, 20); playSound(92, 38); playSound(92, 58); - displayAsyncMessage(0x464a, 36510, 58, 67); + displayAsyncMessage(dsAddr_yawnMsg, 30, 114, 58, 67); // "(yawn)" playActorAnimation(602); playSound(5, 3); playActorAnimation(603); setOns(0, 27); - SET_FLAG(0xDBA5, 1); - return true; + SET_FLAG(dsAddr_laundryState, 1); + break; - case 0x8bfc://Give bone to dog - displayMessage(0x3c31); + case 0x8bfc: // Give bone to dog + displayMessage(dsAddr_hereBoyMsg); // "Here, boy" playSound(5, 3); playSound(26, 13); playActorAnimation(657, true); @@ -2744,20 +3671,20 @@ bool TeenAgentEngine::processCallback(uint16 addr) { reloadLan(); playAnimation(659, 0); - inventory->remove(36); - SET_FLAG(0xDBAD, 1); + inventory->remove(kInvItemBone); + SET_FLAG(dsAddr_dogHasBoneFlag, 1); { Object *o = scene->getObject(7); - o->actor_rect.left = o->actor_rect.right = 297; - o->actor_rect.top = o->actor_rect.bottom = 181; - o->actor_orientation = 1; + o->actorRect.left = o->actorRect.right = 297; + o->actorRect.top = o->actorRect.bottom = 181; + o->actorOrientation = 1; o->save(); } { Object *o = scene->getObject(9); - o->actor_rect.left = o->actor_rect.right = 297; - o->actor_rect.top = o->actor_rect.bottom = 181; - o->actor_orientation = 1; + o->actorRect.left = o->actorRect.right = 297; + o->actorRect.top = o->actorRect.bottom = 181; + o->actorOrientation = 1; o->save(); } { @@ -2767,10 +3694,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) { w->save(); } wait(100); - displayMessage(0x3c3d); - return true; + displayMessage(dsAddr_friendsNowMsg); // "I hope we're friends now" + break; - case 0x8c6e://Use car jack on rock + case 0x8c6e: // Use car jack on rock playSound(5, 3); playSound(26, 13); playSound(24, 22); @@ -2782,10 +3709,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(593); setOns(0, 28); enableObject(1); - inventory->remove(35); - return true; + inventory->remove(kInvItemCarJack); + break; - case 0x8cc8://Cut bush with sickle + case 0x8cc8: // Cut bush with sickle playSound(5, 3); playActorAnimation(644); setOns(1, 45); @@ -2799,16 +3726,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(646); playSound(5, 21); playActorAnimation(647); - SET_FLAG(0xdaca, 1); - inventory->remove(0x2e); + SET_FLAG(dsAddr_caveThornsCutDownFlag, 1); + inventory->remove(kInvItemSickleSharp); disableObject(2); - scene->getObject(3)->actor_rect.right = 156; + scene->getObject(3)->actorRect.right = 156; scene->getObject(3)->save(); - return true; + break; - case 0x8d79: //mouse falls back from the hole (cave) - if (CHECK_FLAG(0, 1)) { - inventory->add(48); + case csAddr_mouseOutOfHoleTimeout: // mouse falls back from the hole (cave) + if (CHECK_FLAG(dsAddr_timedCallbackState, 1)) { + inventory->add(kInvItemMouse); playSound(24, 26); playActorAnimation(650, true); playAnimation(651, 2, true); @@ -2824,54 +3751,26 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(654, true); playAnimation(655, 2, true); waitAnimation(); - displayMessage(0x3bf6); - inventory->add(49); + displayMessage(dsAddr_mouseGoneMsg); // "The mouse has gone!" + inventory->add(kInvItemRock); setLan(2, 4, 27); enableObject(4, 27); - SET_FLAG(0xdba9, 0); + SET_FLAG(dsAddr_mouseHoleState, 0); } - SET_FLAG(0, 0); - return true; + SET_FLAG(dsAddr_timedCallbackState, 0); + break; - case 0x8d57: - if (CHECK_FLAG(0, 0)) { - playSound(5, 2); - playSound(15, 12); - playActorAnimation(638); - inventory->remove(48); - setTimerCallback(0x8d79, 100); - SET_FLAG(0, 1); - } else if (CHECK_FLAG(0, 1)) { - playSound(5, 2); - playSound(52, 13); - playActorAnimation(648); - setOns(1, 46); - inventory->remove(49); - setTimerCallback(0x8d79, 100); - SET_FLAG(0, 2); - } else if (CHECK_FLAG(0, 2)) { - playActorAnimation(649); - setOns(1, 47); - wait(300); - for (byte i = 1; i <= 37; i += 4) - playSound(68, i); - playAnimation(639, 2); - setOns(0, 42); - enableObject(6); - disableObject(5); - SET_FLAG(0xDBAB, 1); - SET_FLAG(0, 0); - setTimerCallback(0, 0); - } - return true; + case csAddr_putRockInHole: + fnPutRockInHole(); + break; case 0x8f1d: - Dialog::showMark(scene, 0x2dd6); + dialog->showMark(72, scene); for (uint i = 16; i <= 30; i += 2) playSound(56, i); playSound(2, 64); playSound(3, 74); - displayAsyncMessage(0x34c7, 25812, 35, 50); + displayAsyncMessage(dsAddr_lastChanceMsg, 212, 80, 35, 50); // "Last chance?" playActorAnimation(516, true); playAnimation(517, 2, true); playAnimation(518, 3, true); @@ -2880,12 +3779,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(4, 0); disableObject(2); disableObject(3); - inventory->remove(2); - SET_FLAG(0xDB96, 1); - return true; + inventory->remove(kInvItemShotgun); + SET_FLAG(dsAddr_birdsGoneFromScarecrowFlag, 1); + break; case 0x8fc8: - displayMessage(0x3b2f); + displayMessage(dsAddr_comeHereMsg); // "Come here, I've got something for you" waitLanAnimationFrame(2, 4); playSound(5, 3); playActorAnimation(627, true); @@ -2894,25 +3793,25 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(41, 10); playSound(41, 47); playSound(55, 52); - if (CHECK_FLAG(0xDBA8, 1)) { + if (CHECK_FLAG(dsAddr_HankerchiefInMouseholeFlag, 1)) { setLan(2, 0); playActorAnimation(628, true); playAnimation(634, 1, true); waitAnimation(); disableObject(4); - displayMessage(0x3b6c); - SET_FLAG(0xDBA9, 1); + displayMessage(dsAddr_trappedMouseMsg); // "The mouse is trapped!" + SET_FLAG(dsAddr_mouseHoleState, 1); } else { playActorAnimation(628, true); playAnimation(630, 1, true); waitAnimation(); - displayMessage(0x3b59); + displayMessage(dsAddr_cantCatchMsg); // "I can't catch it!" } - return true; + break; - case 0x9054: //mouse hole - if (CHECK_FLAG(0xDBAB, 1)) { - displayMessage(0x3c0b); + case 0x9054: // mouse hole + if (CHECK_FLAG(dsAddr_mouseGotGoldNuggetFlag, 1)) { + displayMessage(dsAddr_nonsenseMsg); // "Nonsense" } else { playSound(5, 11); playSound(49, 21); @@ -2920,50 +3819,48 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(5, 40); moveTo(239, 139, 0, true); playActorAnimation(633); - SET_FLAG(0xDBA8, 1); - inventory->remove(47); - if (!CHECK_FLAG(0xDBAA, 1)) { - SET_FLAG(0xDBAA, 1); - displayMessage(0x3b8b); + SET_FLAG(dsAddr_HankerchiefInMouseholeFlag, 1); + inventory->remove(kInvItemHandkerchief); + if (!CHECK_FLAG(dsAddr_mouseNerveMsgSaidFlag, 1)) { + SET_FLAG(dsAddr_mouseNerveMsgSaidFlag, 1); + displayMessage(dsAddr_mouseNerveMsg); // "Boy, this mouse has some nerve!" } } - return true; + break; case 0x933d: - if (!processCallback(0x70e0)) - return true; - - if (CHECK_FLAG(0xdbcd, 1)) { - displayMessage(0x4f3d); - return true; + if (fnIsCookGone()) { + if (CHECK_FLAG(dsAddr_MansionRadioBrokenFlag, 1)) + displayMessage(dsAddr_breakFlattenMsg); // "I wanted to break it, not to flatten it!" + else { + setOns(1, 0); + playSound(5, 3); + playSound(5, 33); + playSound(24, 13); + playSound(24, 19); + playSound(24, 23); + playSound(24, 26); + playSound(24, 29); + playSound(23, 21); + playSound(74, 25); + playActorAnimation(716); + setOns(1, 66); + SET_FLAG(dsAddr_MansionRadioBrokenFlag, 1); + } } + break; - setOns(1, 0); - playSound(5, 3); - playSound(5, 33); - playSound(24, 13); - playSound(24, 19); - playSound(24, 23); - playSound(24, 26); - playSound(24, 29); - playSound(23, 21); - playSound(74, 25); - playActorAnimation(716); - setOns(1, 66); - SET_FLAG(0xDBCD, 1); - return true; - - case 0x93af: //sheet + hot plate - if (!processCallback(0x70e0)) - return true; - playSound(5, 3); - playSound(86, 11); - playActorAnimation(720); - inventory->add(68); - inventory->remove(55); - return true; + case 0x93af: // sheet + hot plate + if (fnIsCookGone()) { + playSound(5, 3); + playSound(86, 11); + playActorAnimation(720); + inventory->add(kInvItemBurningPaper); + inventory->remove(kInvItemSheetOfPaper); + } + break; - case 0x93d5: //burning sheet + plate + case 0x93d5: // burning sheet + plate setOns(4, 0); playSound(87, 7); playActorAnimation(722); @@ -2971,323 +3868,298 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(88, 12); playSound(87, 24); playActorAnimation(723); - displayMessage(0x502b); + displayMessage(dsAddr_burnBabyMsg); // "Burn, baby, burn!" wait(100); playSound(89, 4); playActorAnimation(724); setOns(4, 68); - displayMessage(0x503e); - inventory->remove(68); - SET_FLAG(0xDBD0, 1); - return true; - - case 0x98fa://Right click to open toolbox - inventory->remove(3); - inventory->add(4); - inventory->add(35); + displayMessage(dsAddr_voilaMsg); // "Voila" + inventory->remove(kInvItemBurningPaper); + SET_FLAG(dsAddr_MansionPutBurningPaperInFridgeFlag, 1); + break; + + case csAddr_openFullToolbox: // Right click to open toolbox + inventory->remove(kInvItemToolboxFull); + inventory->add(kInvItemToolboxHalfEmpty); + inventory->add(kInvItemCarJack); inventory->activate(false); inventory->resetSelectedObject(); - displayMessage(0x3468); - return true; + displayMessage(dsAddr_carJackMsg); // "Wow! There's a car jack inside! Great!" + break; - case 0x9910: - inventory->remove(4); - inventory->add(5); + case csAddr_openHalfEmptyToolbox: + inventory->remove(kInvItemToolboxHalfEmpty); + inventory->add(kInvItemSpanner); inventory->activate(false); inventory->resetSelectedObject(); - displayMessage(0x3490); - return true; + displayMessage(dsAddr_spannerMsg); // "There's something else inside the toolbox! A spanner!" + break; - - //very last part of the game: - case 0x671d: + case 0x671d: // very last part of the game moveTo(153, 163, 4); playActorAnimation(973); - if (CHECK_FLAG(0xDBC1, 0)) { - SET_FLAG(0xDBC1, _rnd.getRandomNumber(5) + 1); + if (CHECK_FLAG(dsAddr_drawerPuzzleBookValue, 0)) { + SET_FLAG(dsAddr_drawerPuzzleBookValue, _rnd.getRandomNumber(5) + 1); } loadScene(30, 18, 159, 2); - return true; + break; case 0x67a6: loadScene(29, 149, 163, 1); playActorAnimation(974); moveTo(160, 188, 0); - return true; + break; case 0x6805: - processCallback(0x6849); + fnEgoBottomRightTurn(); playSound(32, 12); playActorAnimation(694); playSound(15, 8); playAnimation(693, 0); setOns(6, 0); - displayMessage(0x4cc7); - inventory->add(54); + displayMessage(dsAddr_fullAutomaticMsg); // "Fully Automatic" + inventory->add(kInvItemVideoTape); disableObject(4); - return true; + break; - case 0x6849: { - Common::Point p = scene->getPosition(); - if (p.x == 208 && p.y == 151) { - moveRel(0, 0, 2); - } else - moveTo(208, 151, 1); - } - return true; + case csAddr_egoBottomRightTurn: + fnEgoBottomRightTurn(); + break; - case 0x687a: //using the book - if (CHECK_FLAG(0xDBC2, 1)) { - displayMessage(0x4ca0); + case 0x687a: // using the book + if (CHECK_FLAG(dsAddr_drawerPuzzleSolvedFlag, 1)) { + displayMessage(dsAddr_dontMessMsg); // "I don't need to mess with it anymore" } else { playSound(49, 5); playSound(49, 17); playActorAnimation(691); - if (!processCallback(0x68e6)) { - if (!CHECK_FLAG(0xDBC0, 1)) { - displayMessage(0x4c61); - SET_FLAG(0xDBC0, 1); + if (!fnCheckingDrawers()) { + if (!CHECK_FLAG(dsAddr_drawerPuzzleBookMessageFlag, 1)) { + displayMessage(dsAddr_bookHeldMsg); // "Something's got hold of the book!" + SET_FLAG(dsAddr_drawerPuzzleBookMessageFlag, 1); } } else { - playSound(15, 8); //secret compartment + playSound(15, 8); // secret compartment playAnimation(692, 0); setOns(6, 59); enableObject(4); - displayMessage(0x4c84); - SET_FLAG(0xDBC2, 1); + displayMessage(dsAddr_secretCompartmentMsg); // "Wow! A secret compartment!" + SET_FLAG(dsAddr_drawerPuzzleSolvedFlag, 1); } } - return true; + break; - case 0x68e6: { //checking drawers - uint16 v = GET_FLAG(0xDBC1) - 1; - uint bx = 0xDBB7; - if (GET_FLAG(bx + v) != 1) - return false; - - uint16 sum = 0; - for (uint i = 0; i < 6; ++i) { - sum += GET_FLAG(bx + i); - } - return sum == 1; - } + case csAddr_checkingDrawers: + fnCheckingDrawers(); + break; case 0x6918: - if (inventory->has(55)) { - displayMessage(0x4cd9); - return true; - } - if (!CHECK_FLAG(0xDBC3, 1)) { - playActorAnimation(695); - Dialog::showMark(scene, 0x386a); - SET_FLAG(0xDBC3, 1); - } + if (inventory->has(kInvItemSheetOfPaper)) + displayMessage(dsAddr_noMoreSheetsMsg); // "Right now I don't need any more sheets" + else { + if (!CHECK_FLAG(dsAddr_mansionTrashcanSearchedFlag, 1)) { + playActorAnimation(695); + dialog->showMark(91, scene); + SET_FLAG(dsAddr_mansionTrashcanSearchedFlag, 1); + } - playSound(5, 11); - playActorAnimation(696); - inventory->add(55); - return true; + playSound(5, 11); + playActorAnimation(696); + inventory->add(kInvItemSheetOfPaper); + } + break; case 0x6962: - if (CHECK_FLAG(0xDBB7, 1)) { + if (CHECK_FLAG(dsAddr_blueDrawerOpenFlag, 1)) { setOns(0, 0); playSound(67, 4); playActorAnimation(678); - SET_FLAG(0xDBB7, 0); - } else if (CHECK_FLAG(0xDBB8, 1)) { - processCallback(0x6b86); + SET_FLAG(dsAddr_blueDrawerOpenFlag, 0); + } else if (CHECK_FLAG(dsAddr_redDrawerOpenFlag, 1)) { + fnDrawerOpenMessage(); } else { playSound(66, 4); playActorAnimation(677); setOns(0, 53); - SET_FLAG(0xDBB7, 1); + SET_FLAG(dsAddr_blueDrawerOpenFlag, 1); } - return true; + break; case 0x69b8: - if (CHECK_FLAG(0xDBB8, 1)) { + if (CHECK_FLAG(dsAddr_redDrawerOpenFlag, 1)) { setOns(1, 0); playSound(67, 4); playActorAnimation(680); - SET_FLAG(0xDBB8, 0); - } else if (CHECK_FLAG(0xDBB7, 1)) { - processCallback(0x6b86); - } else if (CHECK_FLAG(0xDBB9, 1)) { - processCallback(0x6b86); + SET_FLAG(dsAddr_redDrawerOpenFlag, 0); + } else if (CHECK_FLAG(dsAddr_blueDrawerOpenFlag, 1)) { + fnDrawerOpenMessage(); + } else if (CHECK_FLAG(dsAddr_greyDrawerOpenFlag, 1)) { + fnDrawerOpenMessage(); } else { playSound(66, 5); playActorAnimation(679); setOns(1, 54); - SET_FLAG(0xDBB8, 1); + SET_FLAG(dsAddr_redDrawerOpenFlag, 1); } - return true; + break; case 0x6a1b: - if (CHECK_FLAG(0xDBB9, 1)) { + if (CHECK_FLAG(dsAddr_greyDrawerOpenFlag, 1)) { setOns(2, 0); playSound(67, 5); playActorAnimation(682); - SET_FLAG(0xDBB9, 0); - } else if (CHECK_FLAG(0xDBB8, 1)) { - processCallback(0x6b86); + SET_FLAG(dsAddr_greyDrawerOpenFlag, 0); + } else if (CHECK_FLAG(dsAddr_redDrawerOpenFlag, 1)) { + fnDrawerOpenMessage(); } else { playSound(67, 5); playActorAnimation(681); setOns(2, 55); - SET_FLAG(0xDBB9, 1); + SET_FLAG(dsAddr_greyDrawerOpenFlag, 1); } - return true; + break; case 0x6a73: - if (CHECK_FLAG(0xDBBA, 1)) { + if (CHECK_FLAG(dsAddr_greenDrawerOpenFlag, 1)) { setOns(3, 0); playSound(67, 4); playActorAnimation(684); - SET_FLAG(0xDBBA, 0); - } else if (!CHECK_FLAG(0xDBBB, 1)) { + SET_FLAG(dsAddr_greenDrawerOpenFlag, 0); + } else if (!CHECK_FLAG(dsAddr_brownDrawerOpenFlag, 1)) { playSound(66, 4); playActorAnimation(683); setOns(3, 56); - SET_FLAG(0xDBBA, 1); + SET_FLAG(dsAddr_greenDrawerOpenFlag, 1); } else - processCallback(0x6b86); - return true; + fnDrawerOpenMessage(); + break; case 0x6acb: - if (CHECK_FLAG(0xDBBB, 1)) { + if (CHECK_FLAG(dsAddr_brownDrawerOpenFlag, 1)) { setOns(4, 0); playSound(67, 4); playActorAnimation(686); - SET_FLAG(0xDBBB, 0); - } else if (CHECK_FLAG(0xDBBA, 1)) { - processCallback(0x6b86); - } else if (CHECK_FLAG(0xDBBC, 1)) { - processCallback(0x6b86); + SET_FLAG(dsAddr_brownDrawerOpenFlag, 0); + } else if (CHECK_FLAG(dsAddr_greenDrawerOpenFlag, 1)) { + fnDrawerOpenMessage(); + } else if (CHECK_FLAG(dsAddr_pinkDrawerOpenFlag, 1)) { + fnDrawerOpenMessage(); } else { playSound(66, 5); playActorAnimation(685); setOns(4, 57); - SET_FLAG(0xDBBB, 1); + SET_FLAG(dsAddr_brownDrawerOpenFlag, 1); } - return true; + break; case 0x6b2e: - if (CHECK_FLAG(0xdbbc, 1)) { + if (CHECK_FLAG(dsAddr_pinkDrawerOpenFlag, 1)) { setOns(5, 0); playSound(67, 5); playActorAnimation(688); - SET_FLAG(0xdbbc, 0); - } else if (CHECK_FLAG(0xdbbb, 1)) { - processCallback(0x6b86); + SET_FLAG(dsAddr_pinkDrawerOpenFlag, 0); + } else if (CHECK_FLAG(dsAddr_brownDrawerOpenFlag, 1)) { + fnDrawerOpenMessage(); } else { playSound(66, 6); playActorAnimation(687); setOns(5, 58); - SET_FLAG(0xDBBC, 1); + SET_FLAG(dsAddr_pinkDrawerOpenFlag, 1); } - return true; - + break; - case 0x6b86: - if (CHECK_FLAG(0xDBBD, 1)) { - displayMessage(0x4b39); - } else { - displayMessage(0x4acd); - displayMessage(0x4b0d); - SET_FLAG(0xDBBD, 1); - } - return true; + case csAddr_DrawerOpenMessage: + fnDrawerOpenMessage(); + break; - case 0x6be1: //handle to the bathroom - if (CHECK_FLAG(0xDBD9, 1)) { - displayMessage(0x5326); //i'd better catch johnny - } else { + case 0x6be1: // handle to the bathroom + if (CHECK_FLAG(dsAddr_MansionJohnNotyEscapingFlag, 1)) + displayMessage(dsAddr_catchJohnFirstMsg); // "I'd better catch John Noty first" + else { playSound(88, 4); playActorAnimation(808); loadScene(36, 41, 195, 2); } - return true; + break; case 0x6bad: playSound(80, 4); playActorAnimation(971); loadScene(32, 139, 199, 1); - return true; + break; case 0x6c45: playSound(89, 6); - playActorAnimation(CHECK_FLAG(0xDBEF, 1) ? 985 : 806); + playActorAnimation(CHECK_FLAG(dsAddr_mansionHandleInDoorHoleFlag, 1) ? 985 : 806); loadScene(34, 40, 133, 2); - return true; + break; case 0x6c83: waitLanAnimationFrame(1, 1); - Dialog::pop(scene, 0xdb2e, 0, 727, 0xd1, 0xef, 0, 1); - scene->getObject(1)->setName((const char *)res->dseg.ptr(0xaa94)); - SET_FLAG(0xDBD1, 1); - return true; + dialog->pop(scene, dsAddr_dialogStackRobotSafe, 0, 727, textColorMark, textColorMike, 0, 1); + scene->getObject(1)->setName((const char *)res->dseg.ptr(dsAddr_scnObjNameMike)); + SET_FLAG(dsAddr_MansionRobotSafeUnlockedFlag, 1); + break; - case 0x6c9d: //getting jar + case 0x6c9d: // getting jar setOns(0, 71); playSound(32, 5); playActorAnimation(732); disableObject(2); - inventory->add(72); - return true; + inventory->add(kInvItemTimePills); + break; - case 0x6cc4: //secret diary + case 0x6cc4: // secret diary playActorAnimation(754); hideActor(); - displayCutsceneMessage(0x517b, 30430); + displayCutsceneMessage(dsAddr_cutsceneMsg0, 30, 95); // "A secret diary of ..." playMusic(3); loadScene(11, scene->getPosition()); playAnimation(750, 2); - Dialog::show(scene, 0x4f50, 751, 529, 0xe5, 0xd9, 2, 1); + dialog->show(117, scene, 751, 529, textColorProfessor, textColorMansionGuard, 2, 1); playAnimation(752, 0, true); playAnimation(753, 1, true); waitAnimation(); - Dialog::show(scene, 0x5168, 529, 751, 0xd9, 0xe5, 1, 2); + dialog->show(118, scene, 529, 751, textColorMansionGuard, textColorProfessor, 1, 2); loadScene(30, scene->getPosition()); - Dialog::show(scene, 0x449e, 733, 734, 0xe5, 0xd0, 2, 3); + dialog->show(108, scene, 733, 734, textColorProfessor, textColorJohnNoty, 2, 3); playSound(75, 13); playSound(32, 22); playAnimation(735, 1, true); playAnimation(736, 2, true); waitAnimation(); - Dialog::show(scene, 0x46cf, 737, 738, 0xd0, 0xe5, 3, 2); - + dialog->show(109, scene, 737, 738, textColorJohnNoty, textColorProfessor, 3, 2); playSound(32, 1); playAnimation(739, 1, true); playAnimation(740, 2, true); waitAnimation(); - Dialog::show(scene, 0x4772, 733, 734, 0xe5, 0xd0, 2, 3); + dialog->show(110, scene, 733, 734, textColorProfessor, textColorJohnNoty, 2, 3); playAnimation(742, 1, true); playAnimation(741, 2, true); waitAnimation(); - Dialog::show(scene, 0x481c, 743, 733, 0xd0, 0xe5, 3, 2); //where's my wallet?? + dialog->show(111, scene, 743, 733, textColorJohnNoty, textColorProfessor, 3, 2); playAnimation(744, 1, true); playAnimation(745, 2, true); waitAnimation(); - Dialog::show(scene, 0x4873, 734, 733, 0xd0, 0xe5, 3, 2); + dialog->show(112, scene, 734, 733, textColorJohnNoty, textColorProfessor, 3, 2); playAnimation(746, 1, true); playAnimation(747, 2, true); waitAnimation(); - - Dialog::show(scene, 0x4da5, 734, 734, 0xd0, 0xd0, 3, 3); - Dialog::show(scene, 0x4eb9, 748, 748, 0xd0, 0xd0, 3, 3); - Dialog::show(scene, 0x4f15, 749, 749, 0xd0, 0xd0, 3, 3); - Dialog::show(scene, 0x4f2f, 748, 748, 0xd0, 0xd0, 3, 3); + dialog->show(113, scene, 734, 734, textColorJohnNoty, textColorJohnNoty, 3, 3); + dialog->show(114, scene, 748, 748, textColorJohnNoty, textColorJohnNoty, 3, 3); + dialog->show(115, scene, 749, 749, textColorJohnNoty, textColorJohnNoty, 3, 3); + dialog->show(116, scene, 748, 748, textColorJohnNoty, textColorJohnNoty, 3, 3); playMusic(10); loadScene(32, scene->getPosition()); @@ -3296,35 +4168,34 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(755); moveRel(0, 0, 3); - Dialog::show(scene, 0x51bf, 0, 0, 0xd1, 0xd1, 0, 0); + dialog->showMark(119, scene); hideActor(); loadScene(31, scene->getPosition()); - Dialog::show(scene, 0x539f, 763, 764, 0xd9, 0xd0, 1, 2); + dialog->show(123, scene, 763, 764, textColorMansionGuard, textColorJohnNoty, 1, 2); loadScene(32, scene->getPosition()); showActor(); - Dialog::show(scene, 0x52c3, 0, 0, 0xd1, 0xd1, 0, 0); //i have to hide somewhere + dialog->showMark(120, scene); disableObject(3); enableObject(7); - SET_FLAG(0xDBD5, 1); - return true; + SET_FLAG(dsAddr_MansionJohnNotyOutsideBathroomFlag, 1); + break; case 0x6f20: - if (CHECK_FLAG(0xDBD5, 1)) { - displayMessage(0x51a7); - } else { + if (CHECK_FLAG(dsAddr_MansionJohnNotyOutsideBathroomFlag, 1)) + displayMessage(dsAddr_cantHideMsg); // "I can't hide here!" + else rejectMessage(); - } - return true; + break; - case 0x6f75: //hiding in left corner + case 0x6f75: // hiding in left corner moveRel(0, 0, 3); playActorAnimation(756); hideActor(); playAnimation(758, 1); - Dialog::show(scene, 0x52e6, 759, 759, 0xd0, 0xd0, 2, 2); //I have to buy... + dialog->show(121, scene, 759, 759, textColorJohnNoty, textColorJohnNoty, 2, 2); playSound(40, 5); playSound(52, 13); @@ -3340,272 +4211,265 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(58, 12); playSound(58, 14); playAnimation(765, 1); - Dialog::show(scene, 0x5443, 766, 766, 0xd9, 0xd9, 1, 1); + dialog->show(124, scene, 766, 766, textColorMansionGuard, textColorMansionGuard, 1, 1); loadScene(32, scene->getPosition()); - Dialog::show(scene, 0x5358, 761, 761, 0xd0, 0xd0, 2, 2); + dialog->show(122, scene, 761, 761, textColorJohnNoty, textColorJohnNoty, 2, 2); playAnimation(762, 1); setOns(2, 0); showActor(); playActorAnimation(757); moveRel(0, 0, 1); - displayMessage(0x51e7); + displayMessage(dsAddr_wasCloseMsg); // "That was close" enableObject(8); disableObject(7); - SET_FLAG(0xDBD5, 0); - return true; + SET_FLAG(dsAddr_MansionJohnNotyOutsideBathroomFlag, 0); + break; case 0x6f4d: - if (CHECK_FLAG(0xDBD5, 1)) { - displayMessage(0x51bb); - } else { + if (CHECK_FLAG(dsAddr_MansionJohnNotyOutsideBathroomFlag, 1)) + displayMessage(dsAddr_johnOutsideMsg); // "There's John Noty outside! I can't go out!" + else loadScene(31, 139, 172, 3); - } - return true; + break; case 0x6f32: - if (CHECK_FLAG(0xDBD5, 1)) { - displayMessage(0x51a7); + if (CHECK_FLAG(dsAddr_MansionJohnNotyOutsideBathroomFlag, 1)) { + displayMessage(dsAddr_cantHideMsg); // "I can't hide here!" } else { playActorAnimation(977); - displayMessage(0x5511); + displayMessage(dsAddr_lockedMsg); // "It's Locked!" } - return true; + break; case 0x7096: playSound(32, 5); playActorAnimation(767); setOns(1, 0); - inventory->add(73); + inventory->add(kInvItemHandle); disableObject(8); - return true; + break; + + case 0x7218: + rejectMessage(); + break; case 0x7291: playSound(89, 3); playActorAnimation(975); loadScene(31, 298, 177, 4); - return true; + break; case 0x72c2: - if (CHECK_FLAG(0xDBD6, 2)) { - displayMessage(0x522c); + if (CHECK_FLAG(dsAddr_MansionSinkState, 2)) { + displayMessage(dsAddr_enoughWaterMsg); // "There's enough water in the sink" } else { playSound(79, 6); playSound(84, 9); playActorAnimation(801); wait(50); - if (CHECK_FLAG(0xDBD6, 1)) { - displayMessage(0x538d); - SET_FLAG(0xDBD6, 2); + if (CHECK_FLAG(dsAddr_MansionSinkState, 1)) { + displayMessage(dsAddr_sinkFullMsg); // "The sink is full of hot water" + SET_FLAG(dsAddr_MansionSinkState, 2); } else - displayMessage(0x5372); + displayMessage(dsAddr_waterHotMsg); // "The water looks very hot" } - return true; + break; case 0x7309: playSound(66, 5); playSound(67, 11); playActorAnimation(976); - displayMessage(0x5955); - return true; + displayMessage(dsAddr_emptyMsg); // "It's Empty" + break; case 0x77d5: - if (CHECK_FLAG(0xdbd7, 1) && !CHECK_FLAG(0xdbd8, 1)) { //disallow exiting through the first door until switch turned on, not present in original game - displayMessage(0x52cb); - return true; + if (CHECK_FLAG(dsAddr_MansionThruFanByTimePillFlag, 1) && !CHECK_FLAG(dsAddr_MansionVentFanStoppedFlag, 1)) { // disallow exiting through the first door until switch turned on, not present in original game + displayMessage(dsAddr_noSaladMsg); // "I don't want to turn myself into a salad" + } else { + playSound(89, 6); + playActorAnimation(978); + loadScene(31, 298, 177, 4); } - playSound(89, 6); - playActorAnimation(978); - loadScene(31, 298, 177, 4); - return true; + break; case 0x79e4: - processCallback(0x6849); - return false; + fnEgoBottomRightTurn(); + retVal = false; + break; - case 0x79eb: //color of the book - displayMessage(res->dseg.get_word(0x5f3c + GET_FLAG(0xDBC1) * 2 - 2)); - return true; + case 0x79eb: // color of the book + // FIXME - Replace with internal lookup and switch + displayMessage(res->dseg.get_word(dsAddr_bookColorMsgPtr + GET_FLAG(dsAddr_drawerPuzzleBookValue) * 2 - 2)); + break; case 0x79fd: - if (CHECK_FLAG(0xDBB7, 1)) { - displayMessage(0x4b6c); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_blueDrawerOpenFlag, 1)) + displayMessage(dsAddr_blueInteriorMsg); // "It's got a blue interior" + else + retVal = false; + break; case 0x7a0f: - if (CHECK_FLAG(0xDBB8, 1)) { - if (!CHECK_FLAG(0xDBBF, 1)) { - displayMessage(0x4c32); + if (CHECK_FLAG(dsAddr_redDrawerOpenFlag, 1)) { + if (!CHECK_FLAG(dsAddr_drawerGotPolaroidFlag, 1)) { + displayMessage(dsAddr_foundPolaroidMsg); // "There's a polaroid inside! I might need that" playSound(5, 11); playActorAnimation(690); - inventory->add(53); - SET_FLAG(0xDBBF, 1); + inventory->add(kInvItemPolaroidCamera); + SET_FLAG(dsAddr_drawerGotPolaroidFlag, 1); } - displayMessage(0x4b87); - return true; + displayMessage(dsAddr_redInteriorMsg); // "It's got a red interior" } else - return false; + retVal = false; + break; case 0x7a49: - if (CHECK_FLAG(0xDBB9, 1)) { - displayMessage(0x4ba1); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_greyDrawerOpenFlag, 1)) + displayMessage(dsAddr_greyInteriorMsg); // "It's got a grey interior" + else + retVal = false; + break; case 0x7a5b: - if (CHECK_FLAG(0xDBBA, 1)) { - displayMessage(0x4bbc); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_greenDrawerOpenFlag, 1)) + displayMessage(dsAddr_greenInteriorMsg); // "It's got a green interior" + else + retVal = false; + break; case 0x7a6d: - if (CHECK_FLAG(0xDBBB, 1)) { - displayMessage(0x4bd8); - return true; - } else - return false; + if (CHECK_FLAG(dsAddr_brownDrawerOpenFlag, 1)) + displayMessage(dsAddr_brownInteriorMsg); // "It's got a brown interior" + else + retVal = false; + break; case 0x7a7f: - if (CHECK_FLAG(0xDBBC, 1)) { - if (!CHECK_FLAG(0xDBBE, 1)) { - displayMessage(0x4c0f); //there's dictaphone inside! + if (CHECK_FLAG(dsAddr_pinkDrawerOpenFlag, 1)) { + if (!CHECK_FLAG(dsAddr_drawerGotDictaphoneFlag, 1)) { + displayMessage(dsAddr_dictaphoneInsideMsg); // "Wow! There's a dictaphone inside!" playSound(5, 12); playActorAnimation(689); - inventory->add(52); - SET_FLAG(0xDBBE, 1); + inventory->add(kInvItemDictaphoneNoBatteries); + SET_FLAG(dsAddr_drawerGotDictaphoneFlag, 1); } - displayMessage(0x4bf4); - return true; + displayMessage(dsAddr_pinkInteriorMsg); // "It's got a pink interior" } else - return false; + retVal = false; + break; case 0x7af7: - if (CHECK_FLAG(0xDBD0, 1)) { - displayMessage(0x5082); - return true; - } else - return false; - - case 0x7b09: { - byte v = GET_FLAG(0xDBD6); - switch (v) { - case 1: - displayMessage(0x51f8); - return true; - case 2: - displayMessage(0x538d); - return true; - default: - return false; - } - } + if (CHECK_FLAG(dsAddr_MansionPutBurningPaperInFridgeFlag, 1)) + displayMessage(dsAddr_yummyMsg); // "Yummy" + else + retVal = false; + break; - case 0x9166: - if (CHECK_FLAG(0xDBD1, 1)) { - return true; - } else { - displayMessage(0x50a6); - return false; + case 0x7b09: + { + byte v = GET_FLAG(dsAddr_MansionSinkState); + switch (v) { + case 1: + displayMessage(dsAddr_corkInHoleMsg); // "The cork is stuck in the hole" + break; + case 2: + displayMessage(dsAddr_sinkFullMsg); // "The sink is full of hot water" + break; + default: + retVal = false; + break; + } } + break; - case 0x9175: - if (CHECK_FLAG(0xDBD2, 0) || CHECK_FLAG(0xDBD3, 0) || CHECK_FLAG(0xDBD4, 0)) - return true; + case csAddr_robotSafeAlreadyUnlockedCheck: + fnRobotSafeAlreadyUnlockedCheck(); + break; - waitLanAnimationFrame(1, 1); - playSound(89, 2); - playActorAnimation(731); - setOns(0, 70); - setLan(1, 0); - disableObject(1); - enableObject(2); - enableObject(3); - return true; + case csAddr_robotSafeUnlockCheck: + fnRobotSafeUnlockCheck(); + break; - case 0x90bc: //handle on the hole + case 0x90bc: // handle on the hole playSound(5, 3); playSound(6, 9); playActorAnimation(807); setOns(0, 83); - inventory->remove(73); + inventory->remove(kInvItemHandle); disableObject(2); enableObject(3); - SET_FLAG(0xDBEF, 1); - return true; - - case 0x90fc: //dictaphone on robot - if (!processCallback(0x9166)) - return true; - - if (CHECK_FLAG(0xDBD2, 1)) { - displayMessage(0x50c3); - return true; - } + SET_FLAG(dsAddr_mansionHandleInDoorHoleFlag, 1); + break; - if (!CHECK_FLAG(0xDBCB, 1)) { - displayMessage(0x5101); - return true; + case 0x90fc: // dictaphone on robot + if (fnRobotSafeAlreadyUnlockedCheck()) { + if (CHECK_FLAG(dsAddr_MansionRobotSafeVoiceTestPassedFlag, 1)) { + displayMessage(dsAddr_fooledOnceMsg); // "I'd already fooled him once" + } else { + if (!CHECK_FLAG(dsAddr_usedDictaphoneOnTVFlag, 1)) { + displayMessage(dsAddr_notMyVoiceMsg); // "I won't cheat Mike with MY voice" + } else { + displayMessage(dsAddr_mikeVoiceTestMsg); // "Mike, activate the voice test" + waitLanAnimationFrame(1, 1); + + playSound(5, 3); + playSound(5, 39); + displayAsyncMessage(dsAddr_singingMsg, 68, 126, 9, 35, textColorJohnNoty); // "siiiiinging!" + playActorAnimation(728); + + waitLanAnimationFrame(1, 1); + dialog->show(98, scene, 0, 727, textColorMark, textColorMike, 0, 1); + SET_FLAG(dsAddr_MansionRobotSafeVoiceTestPassedFlag, 1); + fnRobotSafeUnlockCheck(); + } + } } + break; - displayMessage(0x50e1); - waitLanAnimationFrame(1, 1); - - playSound(5, 3); - playSound(5, 39); - displayAsyncMessage(0x5124, 40388, 9, 35, 0xd0); - playActorAnimation(728); - - waitLanAnimationFrame(1, 1); - Dialog::show(scene, 0x3d17, 0, 727, 0xd1, 0xef, 0, 1); - SET_FLAG(0xDBD2, 1); - processCallback(0x9175); - return true; + case 0x91cb: // use socks on robot + if (fnRobotSafeAlreadyUnlockedCheck()) { + if (CHECK_FLAG(dsAddr_MansionRobotSafeScentTestPassedFlag, 1)) { + displayMessage(dsAddr_fooledOnceMsg); // "I'd already fooled him once" + } else { + displayMessage(dsAddr_mikeScentTestMsg); // "Mike, let's get on with the scent test" - case 0x91cb: //use socks on robot - if (!processCallback(0x9166)) - return true; + waitLanAnimationFrame(1, 1); + playSound(5, 3); + playSound(5, 23); + playActorAnimation(729); - if (CHECK_FLAG(0xDBD3, 1)) { - displayMessage(0x50c3); - return true; + waitLanAnimationFrame(1, 1); + dialog->show(99, scene, 0, 727, textColorMark, textColorMike, 0, 1); + SET_FLAG(dsAddr_MansionRobotSafeScentTestPassedFlag, 1); + fnRobotSafeUnlockCheck(); + } } - displayMessage(0x5138); - - waitLanAnimationFrame(1, 1); - playSound(5, 3); - playSound(5, 23); - playActorAnimation(729); + break; - waitLanAnimationFrame(1, 1); - Dialog::show(scene, 0x3d70, 0, 727, 0xd1, 0xef, 0, 1); - SET_FLAG(0xDBD3, 1); - processCallback(0x9175); - return true; + case 0x9209: // photo on robot + if (fnRobotSafeAlreadyUnlockedCheck()) { + if (CHECK_FLAG(dsAddr_MansionRobotSafeViewTestPassedFlag, 1)) { + displayMessage(dsAddr_fooledOnceMsg); // "I'd already fooled him once" + } else { + displayMessage(dsAddr_mikeViewTestMsg); // "Mike, run the view test" + waitLanAnimationFrame(1, 1); - case 0x9209: //photo on robot - if (!processCallback(0x9166)) - return true; + playSound(5, 3); + playSound(5, 25); + playActorAnimation(730); - if (CHECK_FLAG(0xDBD4, 1)) { - displayMessage(0x50c3); - return true; + waitLanAnimationFrame(1, 1); + dialog->show(100, scene, 0, 727, textColorMark, textColorMike, 0, 1); + SET_FLAG(dsAddr_MansionRobotSafeViewTestPassedFlag, 1); + fnRobotSafeUnlockCheck(); + } } - displayMessage(0x5161); - waitLanAnimationFrame(1, 1); - - playSound(5, 3); - playSound(5, 25); - playActorAnimation(730); + break; - waitLanAnimationFrame(1, 1); - Dialog::show(scene, 0x3dd6, 0, 727, 0xd1, 0xef, 0, 1); - SET_FLAG(0xDBD4, 1); - processCallback(0x9175); - return true; + case 0x9247: + displayMessage(dsAddr_sameBottleMsg); // "The bottle's the same, but I doubt if it's enough to fool anyone" + break; case 0x924e: setOns(2, 64); @@ -3613,9 +4477,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(52, 10); playActorAnimation(711); moveRel(0, 0, 4); - Dialog::show(scene, 0x3b21, 0, 709, 0xd1, 0xef, 0, 1); + dialog->show(95, scene, 0, 709, textColorMark, textColorCook, 0, 1); moveTo(300, 190, 4); - inventory->remove(64); + inventory->remove(kInvItemFakeChilli); disableObject(8); playAnimation(712, 0); setOns(2, 0); @@ -3623,90 +4487,90 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(15, 28); playSound(16, 37); playAnimation(713, 0); - Dialog::show(scene, 0x3c0d, 0, 709, 0xd1, 0xef, 0, 1); + dialog->show(96, scene, 0, 709, textColorMark, textColorCook, 0, 1); playSound(85, 2); playAnimation(714, 0); setLan(1, 0); disableObject(1); { Object *obj = scene->getObject(2); - obj->actor_rect.left = obj->actor_rect.right = 81; - obj->actor_rect.top = obj->actor_rect.bottom = 160; - obj->actor_orientation = 4; + obj->actorRect.left = obj->actorRect.right = 81; + obj->actorRect.top = obj->actorRect.bottom = 160; + obj->actorOrientation = 4; obj->save(); } { Object *obj = scene->getObject(3); - obj->actor_rect.left = obj->actor_rect.right = 64; - obj->actor_rect.top = obj->actor_rect.bottom = 168; - obj->actor_orientation = 4; + obj->actorRect.left = obj->actorRect.right = 64; + obj->actorRect.top = obj->actorRect.bottom = 168; + obj->actorOrientation = 4; obj->save(); } { Object *obj = scene->getObject(10); - obj->actor_rect.left = obj->actor_rect.right = 105; - obj->actor_rect.top = obj->actor_rect.bottom = 160; - obj->actor_orientation = 1; + obj->actorRect.left = obj->actorRect.right = 105; + obj->actorRect.top = obj->actorRect.bottom = 160; + obj->actorOrientation = 1; obj->save(); } - SET_FLAG(0xDBCC, 1); - return true; + SET_FLAG(dsAddr_MansionCookGoneFlag, 1); + break; case 0x9472: playSound(5, 4); playSound(19, 14); playActorAnimation(793); - displayMessage(0x5218); - inventory->remove(60); - SET_FLAG(0xDBD6, 1); - return true; + displayMessage(dsAddr_fitsPerfectMsg); // "It fits perfectly!" + inventory->remove(kInvItemWrappedCork); + SET_FLAG(dsAddr_MansionSinkState, 1); + break; - case 0x9449: //meat + stew + case 0x9449: // meat + stew playSound(5, 4); playSound(63, 12); playActorAnimation(726); - displayMessage(0x508a); - inventory->remove(69); - inventory->add(70); - return true; + displayMessage(dsAddr_dislikeVealMsg); // "I never liked veal anyway" + inventory->remove(kInvItemMeat); + inventory->add(kInvItemPlasticBag); + break; case 0x949b: - if (CHECK_FLAG(0xDBD6, 2)) { + if (CHECK_FLAG(dsAddr_MansionSinkState, 2)) { playSound(5, 4); playSound(5, 25); playActorAnimation(802); - displayMessage(0x5272); - inventory->remove(62); - inventory->add(74); - inventory->add(65); + displayMessage(dsAddr_labelOffMsg); // "The label has come off!" + inventory->remove(kInvItemChilliWithLabel); + inventory->add(kInvItemChilliNoLabel); + inventory->add(kInvItemLabel); } else - displayMessage(0x524f); - return true; + displayMessage(dsAddr_noHotWaterMsg); // "There's no hot water in the sink" + break; case 0x94d4: - if (inventory->has(70)) { + if (inventory->has(kInvItemPlasticBag)) { setOns(0, 0); playSound(5, 3); playSound(5, 18); playSound(13, 12); playActorAnimation(803); disableObject(7); - inventory->remove(70); - inventory->add(71); + inventory->remove(kInvItemPlasticBag); + inventory->add(kInvItemSocks); } else - displayMessage(0x53ad); - return true; + displayMessage(dsAddr_noSockStoreMsg); // "I don't have anything to store these socks in" + break; case 0x951b: playSound(5, 4); playSound(5, 22); playActorAnimation(804); - displayMessage(0x528b); - return true; + displayMessage(dsAddr_corkTooSmallMsg); // "The cork is a bit too small" + break; case 0x73a3: - if (CHECK_FLAG(0xdbc5, 1)) { - SET_FLAG(0xdbc5, 0); + if (CHECK_FLAG(dsAddr_mansionTVOnFlag, 1)) { + SET_FLAG(dsAddr_mansionTVOnFlag, 0); //call 73e6 playSound(71, 3); @@ -3714,92 +4578,94 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(0, 0, true); reloadLan(); - if (CHECK_FLAG(0xDBC6, 1)) { - displayMessage(0x4da6); + if (CHECK_FLAG(dsAddr_mansionVCRPlayingTapeFlag, 1)) { + displayMessage(dsAddr_muchBetterMsg); // "That's much better" } } else { - SET_FLAG(0xdbc5, 1); + SET_FLAG(dsAddr_mansionTVOnFlag, 1); //call 73e6 playSound(71, 3); playActorAnimation(700); reloadLan(); } - return true; + break; - case 0x9537: //using remote on VCR + case 0x9537: // using remote on VCR playSound(5, 3); playSound(5, 16); playActorAnimation(703); - if (!CHECK_FLAG(0xDBC8, 1)) { - displayMessage(0x4D80); //nothing happened - return true; - } - - //0x955a - if (CHECK_FLAG(0xDBC6, 0)) { - if (CHECK_FLAG(0xDBC5, 1)) { //tv on - if (!CHECK_FLAG(0xDBC7, 1)) - displayMessage(0x4d93); //the tape started - - SET_FLAG(0xDBC6, 1); - reloadLan(); - if (!CHECK_FLAG(0xDBC7, 1)) { - Dialog::show(scene, 0x392c, 0, 702, 0xd1, 0xd0, 0, 1); - SET_FLAG(0xDBC7, 1); + if (!CHECK_FLAG(dsAddr_mansionVCRTapeLoadedFlag, 1)) + displayMessage(dsAddr_NotHappenMsg); // "Nothing happened" + else { + //0x955a + if (CHECK_FLAG(dsAddr_mansionVCRPlayingTapeFlag, 0)) { + if (CHECK_FLAG(dsAddr_mansionTVOnFlag, 1)) { + if (!CHECK_FLAG(dsAddr_mansionVCRPlayedTapeBeforeFlag, 1)) + displayMessage(dsAddr_tapeStartedMsg); // "The tape started!" + + SET_FLAG(dsAddr_mansionVCRPlayingTapeFlag, 1); + reloadLan(); + if (!CHECK_FLAG(dsAddr_mansionVCRPlayedTapeBeforeFlag, 1)) { + dialog->show(93, scene, 0, 702, textColorMark, textColorJohnNoty, 0, 1); + SET_FLAG(dsAddr_mansionVCRPlayedTapeBeforeFlag, 1); + } + } else + displayMessage(dsAddr_tvOffMsg); // "I just realised that the TV is off" + } else { + SET_FLAG(dsAddr_mansionVCRPlayingTapeFlag, 0); + if (CHECK_FLAG(dsAddr_mansionTVOnFlag, 1)) { + reloadLan(); + displayMessage(dsAddr_muchBetterMsg); // "That's much better" } - } else - displayMessage(0x4d5b); //i just realized that tv is off - } else { - SET_FLAG(0xDBC6, 0); - if (CHECK_FLAG(0xDBC5, 1)) { //tv on - reloadLan(); - displayMessage(0x4da6); //much better! } } - return true; + break; - case 0x95eb: //polaroid + tv - if (CHECK_FLAG(0xDBC6, 1)) { - if (CHECK_FLAG(0xDBCA, 1)) { - displayMessage(0x4de6); + case 0x95eb: // polaroid + tv + if (CHECK_FLAG(dsAddr_mansionVCRPlayingTapeFlag, 1)) { + if (CHECK_FLAG(dsAddr_usedPolaroidOnTVFlag, 1)) { + displayMessage(dsAddr_enoughPhotosMsg); // "I don't need any more photos" } else { playSound(5, 3); playSound(5, 24); playSound(90, 18); playActorAnimation(707); - inventory->add(61); - SET_FLAG(0xDBCA, 1); + inventory->add(kInvItemPhoto); + SET_FLAG(dsAddr_usedPolaroidOnTVFlag, 1); } } else - displayMessage(0x4ea5); - return true; + displayMessage(dsAddr_notRightMomentMsg); // "I don't think this is the right moment" + break; - case 0x962f: //polaroid + tv - if (CHECK_FLAG(0xDBC6, 1)) { - if (CHECK_FLAG(0xDBCB, 1)) { - displayMessage(0x4e32); + case 0x962f: // dictaphone + tv + if (CHECK_FLAG(dsAddr_mansionVCRPlayingTapeFlag, 1)) { + if (CHECK_FLAG(dsAddr_usedDictaphoneOnTVFlag, 1)) { + displayMessage(dsAddr_alreadyRecordedMsg); // "I already recorded what I wanted to" } else { - displayMessage(0x4e05); + displayMessage(dsAddr_recordScareMsg); // "Yeah, I can record this and scare the cats" playSound(5, 3); playSound(5, 27); playActorAnimation(708); - SET_FLAG(0xDBCB, 1); + SET_FLAG(dsAddr_usedDictaphoneOnTVFlag, 1); } } else - displayMessage(0x4ea5); - return true; - + displayMessage(dsAddr_notRightMomentMsg); // "I don't think this is the right moment" + break; case 0x95c8: playSound(5, 3); playSound(91, 12); playActorAnimation(706); - inventory->remove(54); - SET_FLAG(0xDBC8, 1); - return true; + inventory->remove(kInvItemVideoTape); + SET_FLAG(dsAddr_mansionVCRTapeLoadedFlag, 1); + break; - case 0x9673: //hit fatso - final scene + case 0x966c: + displayMessage(dsAddr_cantRecordNoBatteriesMsg); // "I can't record anything until I find some batteries" + break; + + case 0x9673: // hit fatso - final scene playSound(5, 3); playSound(24, 10); playActorAnimation(798); @@ -3811,12 +4677,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { wait(100); playActorAnimation(805); moveTo(50, 170, 3); - displayMessage(0x5349); + displayMessage(dsAddr_onlyChilliMsg); // "Good this red stuff is only a chilli" //moveTo(105, 157, 0, true); playMusic(3); loadScene(11, 105, 157, 4); - Dialog::show(scene, 0x8409, 0, 938, 0xd1, 0xec, 0, 1); + dialog->show(203, scene, 0, 938, textColorMark, textColorCaptain, 0, 1); playAnimation(939, 0, true, true); playActorAnimation(942, true); @@ -3837,9 +4703,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(945, true); waitAnimation(); - Dialog::show(scene, 0x844f, 0, 938, 0xd1, 0xec, 0, 1); + dialog->show(204, scene, 0, 938, textColorMark, textColorCaptain, 0, 1); playAnimation(946, 0); - Dialog::show(scene, 0x87c7, 0, 938, 0xd1, 0xec, 0, 1); + dialog->show(205, scene, 0, 938, textColorMark, textColorCaptain, 0, 1); playSound(24, 7); playAnimation(948, 0, true); @@ -3847,16 +4713,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); loadScene(40, 198, 186, 1); - Dialog::show(scene, 0x8890, 0, 920, 0xd1, 0xe7, 0, 1); - Dialog::show(scene, 0x8a2f, 0, 921, 0xd1, 0xe7, 0, 1); + dialog->show(206, scene, 0, 920, textColorMark, textColorRGBBoss, 0, 1); + dialog->show(207, scene, 0, 921, textColorMark, textColorRGBBoss, 0, 1); playAnimation(923, 0); - Dialog::show(scene, 0x8aa7, 0, 920, 0xd1, 0xe7, 0, 1); + dialog->show(208, scene, 0, 920, textColorMark, textColorRGBBoss, 0, 1); moveTo(237, 186, 0); moveTo(237, 177, 0); moveTo(192, 177, 4); playAnimation(949, 0); - Dialog::showMono(scene, 0x8af6, 950, 0xe7, 1); + dialog->showMono(209, scene, 950, textColorRGBBoss, 1); playSound(32, 5); playSound(40, 14); @@ -3869,98 +4735,89 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayCredits(); loadScene(39, 192, 177, 0); hideActor(); - Dialog::showMono(scene, 0x8b4d, 953, 0xe3, 1); //well... + dialog->showMono(210, scene, 953, textColorMarkEnd, 1); playSound(5, 15); playAnimation(954, 0); - Dialog::showMono(scene, 0x8b7a, 955, 0xe3, 1); //that's all folks + dialog->showMono(211, scene, 955, textColorMarkEnd, 1); playMusic(2); - displayCredits(0xe47c, 4500); //3 minutes (infinite until key pressed in original) + displayCredits(dsAddr_finalCredits6, 4500); // 3 minutes (infinite until key pressed in original) scene->push(SceneEvent(SceneEvent::kQuit)); + break; - return true; - - case 0x9921: { //using diving eq - int id = scene->getId(); - if (id != 15) { - displayMessage(id == 16 ? 0x38ce : 0x38a7); - } else { - playSound(5, 3); - playSound(38, 16); - playSound(38, 22); - playActorAnimation(614); - playSound(5, 3); - playSound(44, 10); - playSound(20, 26); - playActorAnimation(615); - loadScene(17, 156, 180, 3); - SET_FLAG(0, 4); - playSound(64, 7); - playSound(64, 21); - playSound(64, 42); - playSound(64, 63); - setTimerCallback(0x9a1d, 30); - playActorAnimation(617, false, true); + case csAddr_useDivingEquipment: // using diving eq + // FIXME - Some code is missing here as displayMessage(dsAddr_cantTalkUnderwaterMsg), + // displayMessage(dsAddr_notSwimmingThereMsg), displayMessage(dsAddr_tooLittleAirMsg) + // displayMessage(dsAddr_fishDontWorryMsg) are never called. + { + int id = scene->getId(); + if (id != 15) { + if (id == 16) + displayMessage(dsAddr_notHereMsg); // "Not here" + else + displayMessage(dsAddr_notBestPlaceMsg); // "It's not the best place for diving" + } else { + playSound(5, 3); + playSound(38, 16); + playSound(38, 22); + playActorAnimation(614); + playSound(5, 3); + playSound(44, 10); + playSound(20, 26); + playActorAnimation(615); + loadScene(17, 156, 180, 3); + SET_FLAG(dsAddr_timedCallbackState, 4); + playSound(64, 7); + playSound(64, 21); + playSound(64, 42); + playSound(64, 63); + setTimerCallback(csAddr_noAnchorTimeout, 30); + playActorAnimation(617, false, true); + } } - } - return true; + break; - case 0x9a1d: //no anchor, timeout - SET_FLAG(0, 0); - processCallback(0x9a7a); - INC_FLAG(0xDBA6); - switch (GET_FLAG(0xDBA6)) { + case csAddr_noAnchorTimeout: // no anchor, timeout + SET_FLAG(dsAddr_timedCallbackState, 0); + fnGetOutOfLake(); + INC_FLAG(dsAddr_lakeDivingExitMessage); + switch (GET_FLAG(dsAddr_lakeDivingExitMessage)) { case 1: - displayMessage(0x39ae); + displayMessage(dsAddr_seaweedMsg); // "This seaweed is just like the flowers I gave mum on her last birthday" break; case 2: - displayMessage(0x39f6); + displayMessage(dsAddr_fishBoatMsg); // "I wonder what fish do inside this boat at night" break; case 3: - displayMessage(0x3a28); + displayMessage(dsAddr_fishSomethingMsg); // "I think I have to fish out something down there" break; case 4: - displayMessage(0x3a85); + displayMessage(dsAddr_notRedHerringMsg); // "I hope all this fish stuff is not a red herring" break; case 5: - displayMessage(0x39ae); + displayMessage(dsAddr_seaweedMsg); // "This seaweed is just like the flowers I gave mum on her last birthday" break; default: - displayMessage(0x3ab7); + displayMessage(dsAddr_niceDownMsg); // "It's nice down there" + break; } - return true; + break; - case 0x99e0: //success getting an anchor - SET_FLAG(0, 0); - setTimerCallback(0, 0); - scene->getActorAnimation()->free(); - playSound(64, 7); - playActorAnimation(618); - disableObject(5); - setOns(0, 0); - playSound(31, 1); - playActorAnimation(619); - processCallback(0x9a7a); - inventory->add(42); - displayMessage(0x3989); - return true; + case csAddr_gotAnchor: + fnGotAnchor(); + break; - case 0x9a7a: - loadScene(15, 156, 180, 3); - playSound(5, 5); - playSound(38, 14); - playSound(38, 20); - playSound(5, 25); - playActorAnimation(616); - return true; + case csAddr_getOutOfLake: + fnGetOutOfLake(); + break; - case 0x9aca: + case csAddr_digMansionWall: if (scene->getId() == 13) { moveTo(172, 181, 1); playSound(26, 19); for (uint i = 0; i < 8; ++i) playSound(26, 30 + i * 11); playActorAnimation(661); - displayCutsceneMessage(0x3c80, 30484); + displayCutsceneMessage(dsAddr_cutsceneMsgA, 84, 95); // "Hundred moments later" playSound(56, 10); playSound(56, 21); @@ -3974,7 +4831,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); setOns(1, 49); - displayCutsceneMessage(0x3c9a, 30453); + displayCutsceneMessage(dsAddr_cutsceneMsgB, 53, 95); // "Another hundred moments later" moveTo(162, 184, 0, true); playSound(26, 6); playSound(26, 17); @@ -3986,27 +4843,32 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(664); playAnimation(665, 1); wait(100); - displayMessage(0x3cbc); + displayMessage(dsAddr_foundCrudeOilMsg); // "At least I found crude oil and I'll be rich" wait(100); - displayMessage(0x3cea); - inventory->remove(37); - processCallback(0x9d45); //another mansion try + displayMessage(dsAddr_myLifeMsg); // "That's my life" + inventory->remove(kInvItemShovelAct2); + fnMansionIntrusionAttempt(); } else - displayMessage(0x3c58); - return true; + displayMessage(dsAddr_notThinkRightPlaceMsg); // "I don't think this is the right place" + break; - case 0x9c6d: - displayMessage(0x49d1); - SET_FLAG(0xDBB5, 1); - return false; + case csAddr_tooDarkHere: + displayMessage(dsAddr_cantDoTooDarkMsg); // "I can't do anything here, it's too dark" + break; + + case csAddr_examineBanknote: + displayMessage(dsAddr_bankNoteMsg); // "It's a note from some bank..." + SET_FLAG(dsAddr_examinedBanknoteFlag, 1); + retVal = false; + break; - case 0x9c79: //use pills + case csAddr_useTimePills: // use pills if (scene->getId() != 36) { - displayMessage(0x52a9); - } else if (CHECK_FLAG(0xDBF1, 1)) { - displayMessage(0x52F6); + displayMessage(dsAddr_notTryNowMsg); // "There's no need to try them now" + } else if (CHECK_FLAG(dsAddr_mansionAlreadyUsedTimePillsFlag, 1)) { + displayMessage(dsAddr_nahMsg); // "Nah" } else { - SET_FLAG(0xDBF1, 1); + SET_FLAG(dsAddr_mansionAlreadyUsedTimePillsFlag, 1); moveTo(102, 195, 2); playSound(5, 3); playSound(75, 12); @@ -4020,131 +4882,59 @@ bool TeenAgentEngine::processCallback(uint16 addr) { { Walkbox *w = scene->getWalkbox(0); w->rect.left = 0; - w->rect.bottom = 199; + w->rect.bottom = kScreenHeight-1; w->save(); } setLan(1, 0xff); - Dialog::showMark(scene, 0x58a9); + dialog->showMark(130, scene); Object *obj = scene->getObject(1); - obj->actor_rect.left = obj->actor_rect.right = 270; - obj->actor_rect.top = obj->actor_rect.bottom = 193; - obj->actor_orientation = 2; + obj->actorRect.left = obj->actorRect.right = 270; + obj->actorRect.top = obj->actorRect.bottom = 193; + obj->actorOrientation = 2; obj->save(); obj = scene->getObject(3); - obj->actor_rect.left = obj->actor_rect.right = 254; - obj->actor_rect.top = obj->actor_rect.bottom = 193; - obj->actor_orientation = 1; + obj->actorRect.left = obj->actorRect.right = 254; + obj->actorRect.top = obj->actorRect.bottom = 193; + obj->actorOrientation = 1; obj->save(); - SET_FLAG(0xDBD7, 1); + SET_FLAG(dsAddr_MansionThruFanByTimePillFlag, 1); } - return true; + break; - case 0x9d45: { - wait(50); - byte attempts = ++ *(res->dseg.ptr(0xDBEA)); - debug(0, "mansion intrusion attempt #%u", attempts); - if (attempts >= 7) - return false; + case csAddr_mansionIntrusionAttempt: + retVal = fnMansionIntrusionAttempt(); + break; - uint16 ptr = res->dseg.get_word((attempts - 2) * 2 + 0x6035); - debug(0, "mansion callback = %04x", ptr); - byte id = scene->getId(); + case csAddr_secondMansionIntrusion: + fnSecondMansionIntrusion(); + break; - playMusic(11); - displayCutsceneMessage(0x580a, 30484); - processCallback(ptr); - playMusic(6); - if (getFlag(0xdbec) != 1 || ptr != 0x9f3e) //ptr check eq. scene_id == 11 - loadScene(id, scene->getPosition()); - return true; - } + case csAddr_thirdMansionIntrusion: + fnThirdMansionIntrusion(); + break; - case 0x9d90: - hideActor(); - loadScene(34, scene->getPosition()); - playAnimation(986, 0, true); - playAnimation(987, 1, true); - waitAnimation(); - Dialog::show(scene, 0x6f60, 988, 989, 0xd9, 0xd0, 1, 2); - playAnimation(990, 0, true); - playAnimation(991, 1, true); - waitAnimation(); - showActor(); - return true; - - case 0x9de5: - hideActor(); - loadScene(30, scene->getPosition()); - playAnimation(887, 1); - playAnimation(888, 2, true, true, true); - //waitAnimation(); - Dialog::showMono(scene, 0x6fb8, 889, 0xd9, 2); - playSound(26, 3); - playAnimation(891, 1, true, true, true); - playAnimation(892, 2); - waitAnimation(); - Dialog::show(scene, 0x6ff0, 890, 889, 0xd0, 0xd9, 3, 2); - showActor(); - return true; - - case 0x9e54: - hideActor(); - loadScene(32, scene->getPosition()); - playAnimation(894, 1, true, true, true); - playAnimation(893, 2, true); - waitAnimation(); - Dialog::showMono(scene, 0x706e, 895, 0xd9, 3); - playSound(75, 9); - playAnimation(898, 1, true); - playAnimation(897, 2, true); - Dialog::show(scene, 0x7096, 896, 895, 0xd0, 0xd9, 2, 3); - showActor(); - return true; + case csAddr_fourthMansionIntrusion: + fnFourthMansionIntrusion(); + break; - case 0x9ec3: - hideActor(); - loadScene(29, scene->getPosition()); - playActorAnimation(901, true); - playAnimation(900, 1, true); - waitAnimation(); - Dialog::show(scene, 0x7161, 903, 902, 0xd0, 0xd9, 2, 3); - for (byte i = 3; i <= 9; i += 2) - playSound(56, i); + case csAddr_fifthMansionIntrusion: + fnFifthMansionIntrusion(); + break; - playActorAnimation(905, true); - playAnimation(904, 1, true); - Dialog::show(scene, 0x71c6, 903, 902, 0xd0, 0xd9, 2, 3); - showActor(); - return true; + case csAddr_sixthMansionIntrusion: + fnSixthMansionIntrusion(); + break; - case 0x9f3e: - hideActor(); - loadScene(35, scene->getPosition()); - playAnimation(907, 2, true); - playAnimation(906, 3, true); - waitAnimation(); - Dialog::show(scene, 0x7243, 908, 909, 0xd9, 0xd0, 2, 3); - Dialog::show(scene, 0x7318, 910, 908, 0xd0, 0xd9, 3, 2); - loadScene(11, scene->getPosition()); - showActor(); - setOns(3, 51); - playAnimation(911, 1); - playAnimation(899, 1); - setFlag(0xDBEC, 1); - reloadLan(); - wait(200); - enableObject(8); - setLan(2, 8); - return true; + default: + error("unknown callback 0x%04x called", addr); + break; } - //error("invalid callback %04x called", addr); - warning("invalid callback %04x called", addr); - return true; + return retVal; } } // End of namespace TeenAgent |