aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-17 00:41:30 +0200
committerFilippos Karapetis2011-12-17 00:43:09 +0200
commitb371c46af9d5dd7e1282a9e227a853e0d2054fb2 (patch)
tree6fd04a5321fcf0bae27d2aa429406734b4706591 /engines/dreamweb
parent29a20ed7dddb178eecfbcc4b7db11364c2c30606 (diff)
downloadscummvm-rg350-b371c46af9d5dd7e1282a9e227a853e0d2054fb2.tar.gz
scummvm-rg350-b371c46af9d5dd7e1282a9e227a853e0d2054fb2.tar.bz2
scummvm-rg350-b371c46af9d5dd7e1282a9e227a853e0d2054fb2.zip
DREAMWEB: Port 'checkinside' to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp21
-rw-r--r--engines/dreamweb/dreamgen.h1
-rw-r--r--engines/dreamweb/stubs.cpp14
-rw-r--r--engines/dreamweb/stubs.h2
-rw-r--r--engines/dreamweb/use.cpp12
5 files changed, 18 insertions, 32 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 47b01d3785..0a891cb1cf 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2837,27 +2837,6 @@ doselob:
useRoutine();
}
-void DreamGenContext::checkInside() {
- STACK_CHECK;
- es = data.word(kExtras);
- bx = (0+2080+30000);
- cl = 0;
-insideloop:
- _cmp(al, es.byte(bx+3));
- if (!flags.z())
- goto notfoundinside;
- _cmp(ah, es.byte(bx+2));
- if (!flags.z())
- goto notfoundinside;
- return;
-notfoundinside:
- _add(bx, 16);
- _inc(cl);
- _cmp(cl, (114));
- if (!flags.z())
- goto insideloop;
-}
-
void DreamGenContext::showDiaryKeys() {
STACK_CHECK;
_cmp(data.byte(kPresscount), 0);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 94826e8433..86768e6cca 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -525,7 +525,6 @@ public:
void locationPic();
void swapWithOpen();
void dreamweb();
- void checkInside();
void findPathOfPoint();
void getDestInfo();
void read();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index fb5fba8d9c..376a681604 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1794,6 +1794,20 @@ bool DreamGenContext::isRyanHolding(const char *id) {
return false;
}
+void DreamGenContext::checkInside() {
+ cl = checkInside(al, ah);
+}
+
+uint16 DreamGenContext::checkInside(uint16 command, uint16 type) {
+ for (uint16 index = 0; index < kNumexobjects; index++) {
+ DynObject *object = getExAd(index);
+ if (object->mapad[1] == command && object->mapad[0] == type)
+ return index;
+ }
+
+ return kNumexobjects;
+}
+
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 ab09fd3ace..27a5cee9c5 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -395,5 +395,7 @@
void identifyOb();
void showSlots();
void useCashCard();
+ void checkInside();
+ uint16 checkInside(uint16 command, uint16 type);
#endif
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 6b59faf401..b4e7efdb4f 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -994,11 +994,7 @@ void DreamGenContext::useObject() {
}
void DreamGenContext::useWinch() {
- al = 40;
- ah = 1;
- checkInside();
-
- if (cl == kNumexobjects || !compare(cl, 4, "FUSE")) {
+ if (checkInside(40, 1) == kNumexobjects || !compare(cl, 4, "FUSE")) {
// No winch
showFirstUse();
putBackObStuff();
@@ -1244,11 +1240,7 @@ void DreamGenContext::hotelControl() {
}
void DreamGenContext::useCooker() {
- al = data.byte(kCommand);
- ah = data.byte(kObjecttype);
- checkInside();
-
- if (cl == 114)
+ if (checkInside(data.byte(kCommand), data.byte(kObjecttype)) == kNumexobjects)
showFirstUse();
else
showSecondUse(); // Food inside