aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-12 02:46:15 +0200
committerFilippos Karapetis2011-12-12 02:50:58 +0200
commit9e1481fc07454aa10e4a32db9fe5a56bf32b834c (patch)
treecfd8e2cdb9631d5dd6872d9d2dd87b8f98a1aa64
parentd416ea6abdad5ef487ed3b5624474e1212496233 (diff)
downloadscummvm-rg350-9e1481fc07454aa10e4a32db9fe5a56bf32b834c.tar.gz
scummvm-rg350-9e1481fc07454aa10e4a32db9fe5a56bf32b834c.tar.bz2
scummvm-rg350-9e1481fc07454aa10e4a32db9fe5a56bf32b834c.zip
DREAMWEB: Port 'showpuztext' to C++
-rwxr-xr-xdevtools/tasmrecover/tasm-recover1
-rw-r--r--engines/dreamweb/dreamgen.cpp23
-rw-r--r--engines/dreamweb/dreamgen.h1
-rw-r--r--engines/dreamweb/stubs.cpp20
-rw-r--r--engines/dreamweb/stubs.h2
-rw-r--r--engines/dreamweb/use.cpp52
6 files changed, 36 insertions, 63 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index e34b00cb1b..f721f87731 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -657,6 +657,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'showpanel',
'showpcx',
'showpointer',
+ 'showpuztext',
'showrain',
'showreelframe',
'showrightpage',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index c8d31f7f2e..6137c32247 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -4796,29 +4796,6 @@ notfoundinside:
goto insideloop;
}
-void DreamGenContext::showPuzText() {
- STACK_CHECK;
- push(cx);
- findPuzText();
- push(es);
- push(si);
- createPanel();
- showPanel();
- showMan();
- showExit();
- obIcons();
- si = pop();
- es = pop();
- di = 36;
- bx = 104;
- dl = 241;
- ah = 0;
- printDirect();
- workToScreenM();
- cx = pop();
- hangOnP();
-}
-
void DreamGenContext::findPuzText() {
STACK_CHECK;
ah = 0;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index b61a9809f8..ba03891395 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -636,7 +636,6 @@ public:
void useGun();
void autoAppear();
void useHandle();
- void showPuzText();
void incRyanPage();
void findExObject();
void clearChanges();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 73f65bb145..e9cba0d6f2 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -4237,4 +4237,24 @@ void DreamGenContext::newPlace() {
}
}
+void DreamGenContext::showPuzText() {
+ showPuzText(al, cx);
+}
+
+void DreamGenContext::showPuzText(uint16 command, uint16 count) {
+ // The original called findPuzText here and saved es:si. We call it below.
+ createPanel();
+ showPanel();
+ showMan();
+ showExit();
+ obIcons();
+ findPuzText(); // we call it here to set es:si correctly
+ uint16 offset = kTextstart + getSegment(data.word(kPuzzletext)).word(command * 2);
+ const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
+ uint16 y = 104;
+ DreamBase::printDirect(&string, 36, &y, 241, 241 & 1);
+ workToScreenM();
+ hangOnP(count);
+}
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index e0b9b3ec95..ad60a1af1c 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -565,5 +565,7 @@
void cantDrop();
void getBack1();
void newPlace();
+ void showPuzText(uint16 command, uint16 count);
+ void showPuzText();
#endif
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index d328e1d662..76ecdc732d 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -633,9 +633,7 @@ void DreamGenContext::sLabDoorB() {
if (flags.z()) {
// No crystal
- al = 44;
- cx = 200;
- showPuzText();
+ showPuzText(44, 200);
putBackObStuff();
} else {
// Got crystal
@@ -740,9 +738,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
}
@@ -834,15 +830,11 @@ void DreamGenContext::usePlate() {
data.byte(kGetback) = 1;
} else if (compare(data.byte(kWithobject), data.byte(kWithtype), knife)) {
// Tried knife
- cx = 300;
- al = 54;
- showPuzText();
+ showPuzText(54, 300);
putBackObStuff();
} else {
// Wrong item
- cx = 300;
- al = 14;
- showPuzText();
+ showPuzText(14, 300);
putBackObStuff();
}
}
@@ -877,9 +869,7 @@ void DreamGenContext::useElvDoor() {
return;
// Axe on door
- al = 15;
- cx = 300;
- showPuzText();
+ showPuzText(15, 300);
_inc(data.byte(kProgresspoints));
data.word(kWatchingtime) = 46 * 2;
data.word(kReeltowatch) = 31;
@@ -1039,16 +1029,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;
@@ -1066,21 +1052,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;
@@ -1100,15 +1080,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;
@@ -1127,9 +1103,7 @@ void DreamGenContext::useLighter() {
showFirstUse();
putBackObStuff();
} else {
- cx = 300;
- al = 9;
- showPuzText();
+ showPuzText(9, 300);
DynObject *withObj = getExAd(data.byte(kWithobject));
withObj->mapad[0] = 255;
data.byte(kGetback) = 1;