aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/use.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/dreamweb/use.cpp')
-rw-r--r--engines/dreamweb/use.cpp270
1 files changed, 270 insertions, 0 deletions
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 76ecdc732d..c591eca826 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -1110,6 +1110,33 @@ void DreamGenContext::useLighter() {
}
}
+void DreamGenContext::useWire() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
+ removeSetObject(51);
+ placeSetObject(52);
+ showPuzText(11, 300);
+ data.byte(kProgresspoints)++;
+ data.byte(kGetback) = 1;
+ return;
+ }
+
+ char axe[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), axe)) {
+ showPuzText(16, 300);
+ putBackObStuff();
+ return;
+ }
+
+ showPuzText(14, 300);
+ putBackObStuff();
+}
+
void DreamGenContext::openTomb() {
data.byte(kProgresspoints)++;
showFirstUse();
@@ -1197,4 +1224,247 @@ void DreamGenContext::useDiary() {
workToScreenM();
}
+void DreamGenContext::useControl() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char key[4] = { 'K', 'E', 'Y', 'A' }; // TODO: convert to string with trailing zero
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), key)) { // 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) {
+ char knife[4] = { 'K', 'N', 'F', 'E' }; // TODO: convert to string with trailing zero
+ char axe[4] = { 'A', 'X', 'E', 'D' }; // TODO: convert to string with trailing zero
+
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
+ // 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), axe)) {
+ // 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;
+ }
+
+ char id[4] = { 'J', 'E', 'W', 'L' }; // TODO: convert to string with trailing zero
+ if (!compare(data.byte(kWithobject), data.byte(kWithtype), id)) {
+ 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;
+ }
+
+ char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero
+ char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero
+
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) {
+ // 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), cupFull)) {
+ // Already full
+ showPuzText(35, 300);
+ putBackObStuff();
+ } else {
+ showPuzText(14, 300);
+ showPuzText();
+ putBackObStuff();
+ }
+}
+
+void DreamGenContext::useOpenBox() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero
+ char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero
+
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), cupFull)) {
+ // 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), cupEmpty)) {
+ // Open box wrong
+ showPuzText(38, 300);
+ putBackObStuff();
+ return;
+ }
+
+ showFirstUse();
+}
+
+void DreamGenContext::runTap() {
+ if (data.byte(kWithobject) == 255) {
+ withWhat();
+ return;
+ }
+
+ char cupEmpty[4] = { 'C', 'U', 'P', 'E' }; // TODO: convert to string with trailing zero
+ char cupFull[4] = { 'C', 'U', 'P', 'F' }; // TODO: convert to string with trailing zero
+
+ if (compare(data.byte(kWithobject), data.byte(kWithtype), cupEmpty)) {
+ // 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), cupFull)) {
+ // 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;
+ }
+}
+
} // End of namespace DreamGen