diff options
Diffstat (limited to 'engines/dreamweb/use.cpp')
-rw-r--r-- | engines/dreamweb/use.cpp | 729 |
1 files changed, 638 insertions, 91 deletions
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 044a4fba40..5cb1f6b92c 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -139,7 +139,7 @@ void DreamGenContext::useRoutine() { } delPointer(); - uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStartCPP(); if (findNextColon(&obText) != 0) { if (findNextColon(&obText) != 0) { if (*obText != 0) { @@ -163,10 +163,6 @@ void DreamGenContext::useRoutine() { data.byte(kCommandtype) = 255; } -void DreamGenContext::useText() { - useText(es.ptr(si, 0)); -} - void DreamGenContext::useText(const uint8 *string) { createPanel(); showPanel(); @@ -178,7 +174,7 @@ void DreamGenContext::useText(const uint8 *string) { } void DreamGenContext::showFirstUse() { - uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStartCPP(); findNextColon(&obText); findNextColon(&obText); useText(obText); @@ -186,7 +182,7 @@ void DreamGenContext::showFirstUse() { } void DreamGenContext::showSecondUse() { - uint8 *obText = getObTextStartCPP(); + const uint8 *obText = getObTextStartCPP(); findNextColon(&obText); findNextColon(&obText); findNextColon(&obText); @@ -625,17 +621,9 @@ void DreamGenContext::sLabDoorB() { data.byte(kWatchspeed) = 1; data.byte(kSpeedcount) = 1; } else { - al = 'S'; - ah = 'H'; - cl = 'L'; - ch = 'D'; - isRyanHolding(); - - if (flags.z()) { + if (!isRyanHolding("SHLD")) { // No crystal - al = 44; - cx = 200; - showPuzText(); + showPuzText(44, 200); putBackObStuff(); } else { // Got crystal @@ -740,9 +728,7 @@ bool DreamGenContext::defaultUseHandler(const char *id) { if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) { // Wrong item - cx = 300; - al = 14; - showPuzText(); + showPuzText(14, 300); putBackObStuff(); return true; // event handled } @@ -751,8 +737,7 @@ bool DreamGenContext::defaultUseHandler(const char *id) { } void DreamGenContext::useChurchGate() { - char id[4] = { 'C', 'U', 'T', 'T' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CUTT")) return; // Cut gate @@ -769,6 +754,118 @@ void DreamGenContext::useChurchGate() { turnPathOn(2); // Open church } +void DreamGenContext::useGun() { + + if (data.byte(kObjecttype) != kExObjectType) { + // gun is not taken + showSecondUse(); + putBackObStuff(); + + } else if (data.byte(kReallocation) == 22) { + // in pool room + showPuzText(34, 300); + data.byte(kLastweapon) = 1; + data.byte(kCombatcount) = 39; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 25) { + // helicopter + showPuzText(34, 300); + data.byte(kLastweapon) = 1; + data.byte(kCombatcount) = 19; + data.byte(kGetback) = 1; + data.byte(kDreamnumber) = 2; + data.byte(kRoomafterdream) = 38; + data.byte(kSartaindead) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 27) { + // in rock room + showPuzText(46, 300); + data.byte(kPointermode) = 2; + data.byte(kRockstardead) = 1; + data.byte(kLastweapon) = 1; + data.byte(kNewsitem) = 1; + data.byte(kGetback) = 1; + data.byte(kRoomafterdream) = 32; + data.byte(kDreamnumber) = 0; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 8 && data.byte(kMapx) == 22 && data.byte(kMapy) == 40 + && !isSetObOnMap(92) && data.byte(kManspath) != 9) { + // by studio + data.byte(kDestination) = 9; + data.byte(kFinaldest) = 9; + autoSetWalk(); + data.byte(kLastweapon) = 1; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 6 && data.byte(kMapx) == 11 && data.byte(kMapy) == 20 + && isSetObOnMap(5)) { + // sarters + data.byte(kDestination) = 1; + data.byte(kFinaldest) = 1; + autoSetWalk(); + removeSetObject(5); + placeSetObject(6); + turnAnyPathOn(1, data.byte(kRoomnum) - 1); + data.byte(kLiftflag) = 1; + data.word(kWatchingtime) = 40*2; + data.word(kReeltowatch) = 4; + data.word(kEndwatchreel) = 43; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kGetback) = 1; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 29) { + // aide + data.byte(kGetback) = 1; + al = 13; + resetLocation(); + setLocation(12); + data.byte(kDestpos) = 12; + data.byte(kDestination) = 2; + data.byte(kFinaldest) = 2; + autoSetWalk(); + data.word(kWatchingtime) = 164*2; + data.word(kReeltowatch) = 3; + data.word(kEndwatchreel) = 164; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kAidedead) = 1; + data.byte(kDreamnumber) = 3; + data.byte(kRoomafterdream) = 33; + data.byte(kProgresspoints)++; + + } else if (data.byte(kReallocation) == 23 && data.byte(kMapx) == 0 && data.byte(kMapy) == 50) { + // with boss + if (data.byte(kManspath) != 5) { + data.byte(kDestination) = 5; + data.byte(kFinaldest) = 5; + autoSetWalk(); + } + data.byte(kLastweapon) = 1; + data.byte(kGetback) = 1; + + } else if (data.byte(kReallocation) == 8 && data.byte(kMapx) == 11 && data.byte(kMapy) == 10) { + // tv soldier + if (data.byte(kManspath) != 2) { + data.byte(kDestination) = 2; + data.byte(kFinaldest) = 2; + autoSetWalk(); + } + data.byte(kLastweapon) = 1; + data.byte(kGetback) = 1; + + } else { + showFirstUse(); + putBackObStuff(); + } +} + void DreamGenContext::useFullCart() { data.byte(kProgresspoints)++; turnAnyPathOn(2, data.byte(kRoomnum) + 6); @@ -788,8 +885,7 @@ void DreamGenContext::useFullCart() { } void DreamGenContext::useClearBox() { - char id[4] = { 'R', 'A', 'I', 'L' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("RAIL")) return; // Open box @@ -804,8 +900,7 @@ void DreamGenContext::useClearBox() { } void DreamGenContext::openTVDoor() { - char id[4] = { 'U', 'L', 'O', 'K' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("ULOK")) return; // Key on TV @@ -820,30 +915,23 @@ void DreamGenContext::usePlate() { return; } - char screw[4] = { 'S', 'C', 'R', 'W' }; // TODO: convert to string with trailing zero - char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero - if (compare(data.byte(kWithobject), data.byte(kWithtype), screw)) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "SCRW")) { // Unscrew plate playChannel1(20); showFirstUse(); placeSetObject(28); placeSetObject(24); removeSetObject(25); - al = 0; - placeFreeObject(); + placeFreeObject(0); data.byte(kProgresspoints)++; data.byte(kGetback) = 1; - } else if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) { + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), "KNFE")) { // Tried knife - cx = 300; - al = 54; - showPuzText(); + showPuzText(54, 300); putBackObStuff(); } else { // Wrong item - cx = 300; - al = 14; - showPuzText(); + showPuzText(14, 300); putBackObStuff(); } } @@ -854,8 +942,7 @@ void DreamGenContext::usePlinth() { return; } - char id[4] = { 'D', 'K', 'E', 'Y' }; // TODO: convert to string with trailing zero - if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) { + if (!compare(data.byte(kWithobject), data.byte(kWithtype), "DKEY")) { // Wrong key showFirstUse(); putBackObStuff(); @@ -873,15 +960,12 @@ void DreamGenContext::usePlinth() { } void DreamGenContext::useElvDoor() { - char id[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("AXED")) return; // Axe on door - al = 15; - cx = 300; - showPuzText(); - _inc(data.byte(kProgresspoints)); + showPuzText(15, 300); + data.byte(kProgresspoints)++; data.word(kWatchingtime) = 46 * 2; data.word(kReeltowatch) = 31; data.word(kEndwatchreel) = 77; @@ -906,12 +990,8 @@ void DreamGenContext::useObject() { } void DreamGenContext::useWinch() { - al = 40; - ah = 1; - checkInside(); - - char id[4] = { 'F', 'U', 'S', 'E' }; // TODO: convert to string with trailing zero - if (cl == kNumexobjects || !compare(cl, 4, id)) { + uint16 contentIndex = checkInside(40, 1); + if (contentIndex == kNumexobjects || !compare(contentIndex, kExObjectType, "FUSE")) { // No winch showFirstUse(); putBackObStuff(); @@ -934,8 +1014,7 @@ void DreamGenContext::useWinch() { } void DreamGenContext::useCart() { - char id[4] = { 'R', 'O', 'C', 'K' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("ROCK")) return; DynObject *exObject = getExAd(data.byte(kWithobject)); @@ -970,8 +1049,7 @@ void DreamGenContext::chewy() { } void DreamGenContext::useHole() { - char id[4] = { 'H', 'N', 'D', 'A' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("HNDA")) return; showFirstUse(); @@ -983,8 +1061,7 @@ void DreamGenContext::useHole() { } void DreamGenContext::openHotelDoor() { - char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("KEYA")) return; playChannel1(16); @@ -994,8 +1071,7 @@ void DreamGenContext::openHotelDoor() { } void DreamGenContext::openHotelDoor2() { - char id[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("KEYA")) return; playChannel1(16); @@ -1004,8 +1080,7 @@ void DreamGenContext::openHotelDoor2() { } void DreamGenContext::grafittiDoor() { - char id[4] = { 'A', 'P', 'E', 'N' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("APEN")) return; showFirstUse(); @@ -1013,8 +1088,7 @@ void DreamGenContext::grafittiDoor() { } void DreamGenContext::usePoolReader() { - char id[4] = { 'M', 'E', 'M', 'B' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("MEMB")) return; if (data.byte(kTalkedtoattendant) != 1) { @@ -1030,8 +1104,7 @@ void DreamGenContext::usePoolReader() { } void DreamGenContext::useCardReader1() { - char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CSHR")) return; if (data.byte(kTalkedtosparky) == 0) { @@ -1040,16 +1113,12 @@ void DreamGenContext::useCardReader1() { putBackObStuff(); } else if (data.word(kCard1money) != 0) { // No cash - cx = 300; - al = 17; - showPuzText(); + showPuzText(17, 300); putBackObStuff(); } else { // Get cash playChannel1(16); - cx = 300; - al = 18; - showPuzText(); + showPuzText(18, 300); data.byte(kProgresspoints)++; data.word(kCard1money) = 12432; data.byte(kGetback) = 1; @@ -1057,8 +1126,7 @@ void DreamGenContext::useCardReader1() { } void DreamGenContext::useCardReader2() { - char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CSHR")) return; if (data.byte(kTalkedtoboss) == 0) { @@ -1067,21 +1135,15 @@ void DreamGenContext::useCardReader2() { putBackObStuff(); } else if (data.byte(kCard1money) == 0) { // No cash - cx = 300; - al = 20; - showPuzText(); + showPuzText(20, 300); putBackObStuff(); } else if (data.byte(kGunpassflag) == 2) { // Already got new - cx = 300; - al = 22; - showPuzText(); + showPuzText(22, 300); putBackObStuff(); } else { playChannel1(18); - cx = 300; - al = 19; - showPuzText(); + showPuzText(19, 300); placeSetObject(94); data.byte(kGunpassflag) = 1; data.word(kCard1money) -= 2000; @@ -1091,8 +1153,7 @@ void DreamGenContext::useCardReader2() { } void DreamGenContext::useCardReader3() { - char id[4] = { 'C', 'S', 'H', 'R' }; // TODO: convert to string with trailing zero - if (defaultUseHandler(id)) + if (defaultUseHandler("CSHR")) return; if (data.byte(kTalkedtorecep) == 0) { @@ -1101,15 +1162,11 @@ void DreamGenContext::useCardReader3() { putBackObStuff(); } else if (data.byte(kCardpassflag) != 0) { // Already used it - cx = 300; - al = 26; - showPuzText(); + showPuzText(26, 300); putBackObStuff(); } else { playChannel1(16); - cx = 300; - al = 25; - showPuzText(); + showPuzText(25, 300); data.byte(kProgresspoints)++; data.word(kCard1money) -= 8300; data.byte(kCardpassflag) = 1; @@ -1117,6 +1174,48 @@ void DreamGenContext::useCardReader3() { } } +void DreamGenContext::useLighter() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + if (!compare(data.byte(kWithobject), data.byte(kWithtype), "SMKE")) { + showFirstUse(); + putBackObStuff(); + } else { + showPuzText(9, 300); + DynObject *withObj = getExAd(data.byte(kWithobject)); + withObj->mapad[0] = 255; + data.byte(kGetback) = 1; + } +} + +void DreamGenContext::useWire() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "KNFE")) { + removeSetObject(51); + placeSetObject(52); + showPuzText(11, 300); + data.byte(kProgresspoints)++; + data.byte(kGetback) = 1; + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "AXED")) { + showPuzText(16, 300); + putBackObStuff(); + return; + } + + showPuzText(14, 300); + putBackObStuff(); +} + void DreamGenContext::openTomb() { data.byte(kProgresspoints)++; showFirstUse(); @@ -1137,4 +1236,452 @@ void DreamGenContext::hotelControl() { putBackObStuff(); } +void DreamGenContext::useCooker() { + if (checkInside(data.byte(kCommand), data.byte(kObjecttype)) == kNumexobjects) + showFirstUse(); + else + showSecondUse(); // Food inside + + putBackObStuff(); +} + +void DreamBase::placeFreeObject(uint8 index) { + findOrMake(index, 0, 1); + getFreeAd(index)->mapad[0] = 0; +} + +void DreamBase::removeFreeObject(uint8 index) { + getFreeAd(index)->mapad[0] = 0xFF; +} + +void DreamGenContext::useDiary() { + getRidOfReels(); + loadIntoTemp("DREAMWEB.G14"); + loadTempText("DREAMWEB.T51"); + loadTempCharset("DREAMWEB.C02"); + createPanel(); + showIcon(); + showDiary(); + underTextLine(); + showDiaryPage(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); + data.byte(kGetback) = 0; + + RectWithCallback diaryList[] = { + { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamBase::diaryKeyN }, + { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamBase::diaryKeyP }, + { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamBase::quitKey }, + { 0,320,0,200,&DreamBase::blank }, + { 0xFFFF,0,0,0,0 } + }; + + do { + delPointer(); + readMouse(); + showDiaryKeys(); + showPointer(); + vSync(); + dumpPointer(); + dumpDiaryKeys(); + dumpTextLine(); + checkCoords(diaryList); + } while (!data.byte(kGetback) && !quitRequested()); + + + getRidOfTemp(); + getRidOfTempText(); + getRidOfTempCharset(); + restoreReels(); + data.byte(kManisoffscreen) = 0; + redrawMainScrn(); + workToScreenM(); +} + +void DreamGenContext::useControl() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "KEYA")) { // Right key + playChannel1(16); + if (data.byte(kLocation) == 21) { // Going down + showPuzText(3, 300); + data.byte(kNewlocation) = 30; + } else { + showPuzText(0, 300); + data.byte(kNewlocation) = 21; + } + + data.byte(kCounttoclose) = 8; + data.byte(kCounttoopen) = 0; + data.word(kWatchingtime) = 80; + data.byte(kGetback) = 1; + return; + } + + if (data.byte(kReallocation) == 21) { + if (compare(data.byte(kWithobject), data.byte(kWithtype), "KNFE")) { + // Jimmy controls + placeSetObject(50); + placeSetObject(51); + placeSetObject(26); + placeSetObject(30); + removeSetObject(16); + removeSetObject(17); + playChannel1(14); + showPuzText(10, 300); + data.byte(kProgresspoints)++; + data.byte(kGetback) = 1; + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), "AXED")) { + // Axe on controls + showPuzText(16, 300); + data.byte(kProgresspoints)++; + putBackObStuff(); + } else { + // Balls + showFirstUse(); + putBackObStuff(); + } + } else { + // Balls + showFirstUse(); + putBackObStuff(); + } +} + +void DreamGenContext::useSLab() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + if (!compare(data.byte(kWithobject), data.byte(kWithtype), "JEWL")) { + showPuzText(14, 300); + putBackObStuff(); + return; + } + + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->mapad[0] = 0; + + removeSetObject(data.byte(kCommand)); + placeSetObject(data.byte(kCommand) + 1); + if (data.byte(kCommand) + 1 == 54) { + // Last slab + turnPathOn(0); + data.word(kWatchingtime) = 22; + data.word(kReeltowatch) = 35; + data.word(kEndwatchreel) = 48; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + } + + data.byte(kProgresspoints)++; + showFirstUse(); + data.byte(kGetback) = 1; +} + +void DreamGenContext::usePipe() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPE")) { + // Fill cup + showPuzText(36, 300); + putBackObStuff(); + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->id[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup) + return; + } else if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPF")) { + // Already full + showPuzText(35, 300); + putBackObStuff(); + } else { + showPuzText(14, 300); + putBackObStuff(); + } +} + +void DreamGenContext::useOpenBox() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPF")) { + // Destroy open box + data.byte(kProgresspoints)++; + showPuzText(37, 300); + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->id[3] = 'E'-'A'; // CUPF (full cup) -> CUPE (empty cup) + data.word(kWatchingtime) = 140; + data.word(kReeltowatch) = 105; + data.word(kEndwatchreel) = 181; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + turnPathOn(4); + data.byte(kGetback) = 1; + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPE")) { + // Open box wrong + showPuzText(38, 300); + putBackObStuff(); + return; + } + + showFirstUse(); +} + +void DreamGenContext::runTap() { + if (data.byte(kWithobject) == 255) { + withWhat(); + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPE")) { + // Fill cup from tap + DynObject *exObject = getExAd(data.byte(kWithobject)); + exObject->id[3] = 'F'-'A'; // CUPE (empty cup) -> CUPF (full cup) + playChannel1(8); + showPuzText(57, 300); + putBackObStuff(); + return; + } + + if (compare(data.byte(kWithobject), data.byte(kWithtype), "CUPF")) { + // Cup from tap full + showPuzText(58, 300); + putBackObStuff(); + return; + } + + showPuzText(56, 300); + putBackObStuff(); +} + +void DreamGenContext::useAxe() { + if (data.byte(kReallocation) != 22) { + // Not in pool + showFirstUse(); + return; + } + + if (data.byte(kMapy) == 10) { + // Axe on door + showPuzText(15, 300); + data.byte(kProgresspoints)++; + data.word(kWatchingtime) = 46*2; + data.word(kReeltowatch) = 31; + data.word(kEndwatchreel) = 77; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + data.byte(kGetback) = 1; + return; + } + + showSecondUse(); + data.byte(kProgresspoints)++; + data.byte(kLastweapon) = 2; + data.byte(kGetback) = 1; + removeObFromInv(); +} + +void DreamGenContext::useKey() { + switch(data.byte(kLocation)) { + case 5: + case 30: + if (data.byte(kMapx) == 22 && data.byte(kMapy) == 10) { + showPuzText(0, 300); + data.byte(kCounttoclose) = 100; + data.byte(kGetback) = 1; + } else { + // Wrong room + showPuzText(2, 200); + putBackObStuff(); + } + break; + case 21: + if (data.byte(kMapx) == 11 && data.byte(kMapy) == 10) { + showPuzText(3, 300); + data.byte(kNewlocation) = 30; + al = 2; + fadeScreenDown(); + showFirstUse(); + putBackObStuff(); + } else { + // Wrong room + showPuzText(2, 200); + putBackObStuff(); + } + default: + showPuzText(1, 200); + putBackObStuff(); + break; + } +} + +void DreamGenContext::useHandle() { + SetObject *object = getSetAd(findSetObject("CUTW")); + if (object->mapad[0] == 255) { + // Wire not cut + showPuzText(12, 300); + } else { + // Wire has been cut + showPuzText(13, 300); + data.byte(kNewlocation) = 22; + } + + data.byte(kGetback) = 1; +} + +void DreamGenContext::useAltar() { + if (findExObject("CNDA") == 114 || findExObject("CNDB") == 114) { + // Things on altar + showFirstUse(); + data.byte(kGetback) = 1; + return; + } + + if (data.byte(kCanmovealtar) == 1) { + // Move altar + data.byte(kProgresspoints)++; + showSecondUse(); + data.word(kWatchingtime) = 160; + data.word(kReeltowatch) = 81; + data.word(kEndwatchreel) = 174; + data.byte(kWatchspeed) = 1; + data.byte(kSpeedcount) = 1; + DreamBase::setupTimedUse(47, 32, 98, 52, 76); + data.byte(kGetback) = 1; + } else { + showPuzText(23, 300); + data.byte(kGetback) = 1; + } +} + +void DreamBase::withWhat() { + uint8 commandLine[64] = "OBJECT NAME ONE "; + + createPanel(); + showPanel(); + showMan(); + showExit(); + + copyName(data.byte(kObjecttype), data.byte(kCommand), commandLine); + printMessage2(100, 21, 63, 200, false, 2); + uint16 x = data.word(kLastxpos) + 5; + printDirect(commandLine, x, 21, 220, false); + printMessage2(data.word(kLastxpos) + 5, 21, 63, 200, false, 3); + + fillRyan(); + data.byte(kCommandtype) = 255; + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); + data.byte(kInvopen) = 2; +} + +void DreamGenContext::notHeldError() { + createPanel(); + showPanel(); + showMan(); + showExit(); + obIcons(); + printMessage2(64, 100, 63, 200 + 1, true, 1); + workToScreenM(); + hangOnP(50); + putBackObStuff(); +} + +void DreamGenContext::useCashCard() { + getRidOfReels(); + loadKeypad(); + createPanel(); + showPanel(); + showExit(); + showMan(); + uint16 y = (!data.byte(kForeignrelease)) ? 120 : 120 - 3; + showFrame(tempGraphics(), 114, y, 39, 0); + const uint8 *obText = getObTextStartCPP(); + findNextColon(&obText); + findNextColon(&obText); + y = 98; + printDirect(&obText, 36, &y, 36, 36 & 1); + char amountStr[10]; + sprintf(amountStr, "%04d", data.word(kCard1money) / 10); + data.word(kCharshift) = 91 * 2 + 75; + printDirect((const uint8 *)amountStr, 160, 155, 240, 240 & 1); + sprintf(amountStr, "%02d", (data.word(kCard1money) % 10) * 10); + data.word(kCharshift) = 91 * 2 + 85; + printDirect((const uint8 *)amountStr, 187, 155, 240, 240 & 1); + data.word(kCharshift) = 0; + workToScreenM(); + hangOnP(400); + getRidOfTemp(); + restoreReels(); + putBackObStuff(); +} + +void DreamGenContext::useStereo() { + if (data.byte(kLocation) != 0) { + showPuzText(4, 400); + putBackObStuff(); + } else if (data.byte(kMapx) != 11) { + showPuzText(5, 400); + putBackObStuff(); + } else if (checkInside(findSetObject("CDPL"), 1) == kNumexobjects) { + // No CD inside + showPuzText(6, 400); + putBackObStuff(); + // TODO: Use the C++ version of getAnyAd() + getAnyAd(); + es.byte(bx + 10) = 255; + } else { + // CD inside + getAnyAd(); + es.byte(bx + 10) ^= 1; + if (es.byte(bx + 10) != 255) { + // Stereo off + showPuzText(7, 400); + } else { + // Stereo on + showPuzText(8, 400); + } + + putBackObStuff(); + } +} + +uint16 DreamBase::checkInside(uint16 command, uint16 type) { + for (uint16 index = 0; index < kNumexobjects; index++) { + DynObject *object = getExAd(index); + if (object->mapad[1] == command && object->mapad[0] == type) + return index; + } + + return kNumexobjects; +} + +void DreamBase::showPuzText(uint16 command, uint16 count) { + createPanel(); + showPanel(); + showMan(); + showExit(); + obIcons(); + uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(command * 2); + const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0); + printDirect(string, 36, 104, 241, 241 & 1); + workToScreenM(); + hangOnP(count); +} + } // End of namespace DreamGen |