aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-13 01:02:41 +0200
committerFilippos Karapetis2011-12-13 01:02:41 +0200
commitb27a6e72ad63441c561866682bdebb0059db56a3 (patch)
tree400b47ea9f775bdb7c5fb47e9be7dd33f82e9efa /engines
parentc452bf9c1268155bd896b2f42c003c8eda110e84 (diff)
downloadscummvm-rg350-b27a6e72ad63441c561866682bdebb0059db56a3.tar.gz
scummvm-rg350-b27a6e72ad63441c561866682bdebb0059db56a3.tar.bz2
scummvm-rg350-b27a6e72ad63441c561866682bdebb0059db56a3.zip
DREAMWEB: Port 'runtap' to C++
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/dreamgen.cpp49
-rw-r--r--engines/dreamweb/dreamgen.h1
-rw-r--r--engines/dreamweb/stubs.h1
-rw-r--r--engines/dreamweb/use.cpp30
4 files changed, 31 insertions, 50 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 7ab361b264..09ea14583d 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -3522,55 +3522,6 @@ finishpars:
di = offset_operand1;
}
-void DreamGenContext::runTap() {
- STACK_CHECK;
- _cmp(data.byte(kWithobject), 255);
- if (!flags.z())
- goto tapwith;
- withWhat();
- return;
-tapwith:
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'C';
- ch = 'U';
- dl = 'P';
- dh = 'E';
- compare();
- if (flags.z())
- goto fillcupfromtap;
- al = data.byte(kWithobject);
- ah = data.byte(kWithtype);
- cl = 'C';
- ch = 'U';
- dl = 'P';
- dh = 'F';
- compare();
- if (flags.z())
- goto cupfromtapfull;
- cx = 300;
- al = 56;
- showPuzText();
- putBackObStuff();
- return;
-fillcupfromtap:
- al = data.byte(kWithobject);
- getExAd();
- es.byte(bx+15) = 'F'-'A';
- al = 8;
- playChannel1();
- cx = 300;
- al = 57;
- showPuzText();
- putBackObStuff();
- return;
-cupfromtapfull:
- cx = 300;
- al = 58;
- showPuzText();
- putBackObStuff();
-}
-
void DreamGenContext::notHeldError() {
STACK_CHECK;
createPanel();
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 3bb554e8f7..92c6f82e12 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -511,7 +511,6 @@ public:
void startTalk();
void getAnyAd();
void reminders();
- void runTap();
void dumpDiaryKeys();
void checkForExit();
void lookInInterface();
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index b32f5460ec..ed45e40b8d 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -492,6 +492,7 @@
void useCart();
void useTrainer();
void useHole();
+ void runTap();
void chewy();
void sLabDoorA();
void sLabDoorB();
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index f62daf9c9a..c591eca826 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -1376,6 +1376,36 @@ void DreamGenContext::useOpenBox() {
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