aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/use.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-12 23:58:20 +0200
committerFilippos Karapetis2011-12-12 23:58:20 +0200
commit9480b21840cd0e5e0d40ab8a88e0f7b5dac9be03 (patch)
tree0857b80ea8d543bca5e4a058f31054cd21d94935 /engines/dreamweb/use.cpp
parentef94b2d15a543493a7d11ed208c74c5c2c37214c (diff)
downloadscummvm-rg350-9480b21840cd0e5e0d40ab8a88e0f7b5dac9be03.tar.gz
scummvm-rg350-9480b21840cd0e5e0d40ab8a88e0f7b5dac9be03.tar.bz2
scummvm-rg350-9480b21840cd0e5e0d40ab8a88e0f7b5dac9be03.zip
DREAMWEB: Port 'useopenbox' to C++
Diffstat (limited to 'engines/dreamweb/use.cpp')
-rw-r--r--engines/dreamweb/use.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index b8d7b7ca75..0ede2f485a 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -1341,4 +1341,39 @@ void DreamGenContext::usePipe() {
}
}
+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();
+}
+
} // End of namespace DreamGen