aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-16 22:04:47 +0200
committerFilippos Karapetis2011-12-16 22:04:47 +0200
commit12cac260c9acb16180ab4414fecd5748d77886f3 (patch)
treebcd7ecc9e8e8f1a59d182847bdc014f095931ee9
parent70fd1b604342863778e2cac3e667f4ee2de42b82 (diff)
downloadscummvm-rg350-12cac260c9acb16180ab4414fecd5748d77886f3.tar.gz
scummvm-rg350-12cac260c9acb16180ab4414fecd5748d77886f3.tar.bz2
scummvm-rg350-12cac260c9acb16180ab4414fecd5748d77886f3.zip
DREAMWEB: Port 'isryanholding' to C++
-rwxr-xr-xdevtools/tasmrecover/tasm-recover1
-rw-r--r--engines/dreamweb/dreamgen.cpp38
-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.cpp8
6 files changed, 24 insertions, 46 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 254e45c35e..61293409d6 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -500,6 +500,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'isitdescribed',
'isitright',
'isitworn',
+ 'isryanholding',
'issetobonmap',
'keeper',
'kernchars',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index ea731fcb21..0938efca37 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2937,44 +2937,6 @@ doselob:
useRoutine();
}
-void DreamGenContext::isRyanHolding() {
- STACK_CHECK;
- _sub(al, 'A');
- _sub(ah, 'A');
- _sub(cl, 'A');
- _sub(ch, 'A');
- es = data.word(kExtras);
- bx = (0+2080+30000);
- dl = 0;
-searchinv:
- _cmp(es.byte(bx+2), 4);
- if (!flags.z())
- goto nofindininv;
- _cmp(al, es.byte(bx+12));
- if (!flags.z())
- goto nofindininv;
- _cmp(ah, es.byte(bx+13));
- if (!flags.z())
- goto nofindininv;
- _cmp(cl, es.byte(bx+14));
- if (!flags.z())
- goto nofindininv;
- _cmp(ch, es.byte(bx+15));
- if (!flags.z())
- goto nofindininv;
- al = dl;
- _cmp(al, (114));
- return;
-nofindininv:
- _add(bx, 16);
- _inc(dl);
- _cmp(dl, (114));
- if (!flags.z())
- goto searchinv;
- al = dl;
- _cmp(al, (114));
-}
-
void DreamGenContext::checkInside() {
STACK_CHECK;
es = data.word(kExtras);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index f22461ef0f..f3cedd890d 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -480,7 +480,6 @@ public:
void clearBuffers();
void getObTextStart();
void checkObjectSize();
- void isRyanHolding();
void fillOpen();
void useCashCard();
void moneyPoke();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 3a9785e586..2279d9ffbe 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1774,6 +1774,26 @@ uint16 DreamGenContext::findExObject(const char *id) {
return kNumexobjects;
}
+void DreamGenContext::isRyanHolding() {
+ char id[5];
+ id[0] = al;
+ id[1] = ah;
+ id[2] = cl;
+ id[3] = ch;
+ id[4] = '\0';
+ flags._z = isRyanHolding(id);
+}
+
+bool DreamGenContext::isRyanHolding(const char *id) {
+ for (uint16 index = 0; index < kNumexobjects; index++) {
+ DynObject *object = getExAd(index);
+ if (object->mapad[0] == 4 && objectMatches(object, id))
+ return (index == kNumexobjects);
+ }
+
+ return false;
+}
+
bool DreamBase::isItDescribed(const ObjPos *pos) {
uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2);
uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index ddaa66fa47..d3f656db45 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -383,6 +383,8 @@
uint16 findSetObject(const char *id);
void findExObject();
uint16 findExObject(const char *id);
+ void isRyanHolding();
+ bool isRyanHolding(const char *id);
void describeOb();
void getOpenedSize();
byte getOpenedSizeCPP();
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 4e956cd016..385bfbb101 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -625,13 +625,7 @@ 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
showPuzText(44, 200);
putBackObStuff();