aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdevtools/tasmrecover/tasm-recover1
-rw-r--r--engines/dreamweb/dreamgen.cpp36
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/stubs.cpp26
-rw-r--r--engines/dreamweb/stubs.h2
5 files changed, 30 insertions, 38 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index c380bfae4d..9cbd4c8816 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -106,6 +106,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'deltextline',
'doblocks',
'checkifperson',
+ 'checkiffree',
'getreelstart',
'findobname',
'copyname',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index ceec7d9049..de15b77520 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -15461,41 +15461,6 @@ notanexid:
goto identifyex;
}
-void DreamGenContext::checkiffree() {
- STACK_CHECK;
- es = data.word(kBuffers);
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5))+(79*5);
- cx = 79;
-identifyfree:
- _cmp(es.byte(bx+4), 255);
- if (flags.z())
- goto notafreeid;
- _cmp(al, es.byte(bx));
- if (flags.c())
- goto notafreeid;
- _cmp(al, es.byte(bx+2));
- if (!flags.c())
- goto notafreeid;
- _cmp(ah, es.byte(bx+1));
- if (flags.c())
- goto notafreeid;
- _cmp(ah, es.byte(bx+3));
- if (!flags.c())
- goto notafreeid;
- al = es.byte(bx+4);
- ah = 2;
- obname();
- al = 0;
- _cmp(al, 1);
- return;
-notafreeid:
- _sub(bx, 5);
- _dec(cx);
- _cmp(cx, -1);
- if (!flags.z())
- goto identifyfree;
-}
-
void DreamGenContext::isitdescribed() {
STACK_CHECK;
push(ax);
@@ -18659,7 +18624,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_identifyob: identifyob(); break;
case addr_checkifset: checkifset(); break;
case addr_checkifex: checkifex(); break;
- case addr_checkiffree: checkiffree(); break;
case addr_isitdescribed: isitdescribed(); break;
case addr_findpathofpoint: findpathofpoint(); break;
case addr_findfirstpath: findfirstpath(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 62aaf70661..df6c4cf736 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -133,7 +133,6 @@ public:
static const uint16 addr_findfirstpath = 0xc9f0;
static const uint16 addr_findpathofpoint = 0xc9ec;
static const uint16 addr_isitdescribed = 0xc9e8;
- static const uint16 addr_checkiffree = 0xc9e4;
static const uint16 addr_checkifex = 0xc9e0;
static const uint16 addr_checkifset = 0xc9dc;
static const uint16 addr_identifyob = 0xc9d4;
@@ -2055,7 +2054,7 @@ public:
void useobject();
void mainman();
void volumeadjust();
- void checkiffree();
+ //void checkiffree();
};
}
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 1439a24de0..e77b18832b 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -955,6 +955,32 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
return false;
}
+void DreamGenContext::checkiffree() {
+ flags._z = not checkiffree(al, ah);
+}
+
+bool DreamGenContext::checkiffree(uint8 x, uint8 y) {
+ const ObjPos *freeList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
+ for (size_t i = 0; i < 80; ++i) {
+ const ObjPos *objPos = freeList + 79 - i;
+ if (objPos->index == 0xff)
+ continue;
+ if (x < objPos->xMin)
+ continue;
+ if (x >= objPos->xMax)
+ continue;
+ if (y < objPos->yMin)
+ continue;
+ if (y >= objPos->yMax)
+ continue;
+ al = objPos->index;
+ ah = 2;
+ obname();
+ return true;
+ }
+ return false;
+}
+
const uint8 *DreamGenContext::findobname(uint8 type, uint8 index) {
if (type == 5) {
uint16 i = 64 * 2 * (index & 127);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 37b7befe6e..6b0ed594be 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -123,6 +123,8 @@
void doblocks();
void checkifperson();
bool checkifperson(uint8 x, uint8 y);
+ void checkiffree();
+ bool checkiffree(uint8 x, uint8 y);
const uint8 *findobname(uint8 type, uint8 index);
void copyname();
void copyname(uint8 type, uint8 index, uint8 *dst);