From 2fc467dc4f0aa563318458dceb8918d386128129 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Tue, 30 Aug 2011 03:11:32 +0200 Subject: DREAMWEB: 'checkifex' ported to C++ --- devtools/tasmrecover/tasm-recover | 1 + engines/dreamweb/dreamgen.cpp | 36 ------------------------------------ engines/dreamweb/dreamgen.h | 5 ++--- engines/dreamweb/stubs.cpp | 24 ++++++++++++++++++++++++ engines/dreamweb/stubs.h | 2 ++ 5 files changed, 29 insertions(+), 39 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 9ecd261a9e..97d33b6c6e 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -108,6 +108,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'doblocks', 'checkifperson', 'checkiffree', + 'checkifex', 'getreelstart', 'findobname', 'copyname', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index bcc1cbb1e2..697eb4ef3f 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -15032,41 +15032,6 @@ notasetid: goto identifyset; } -void DreamGenContext::checkifex() { - STACK_CHECK; - es = data.word(kBuffers); - bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5))+(99*5); - cx = 99; -identifyex: - _cmp(es.byte(bx+4), 255); - if (flags.z()) - goto notanexid; - _cmp(al, es.byte(bx)); - if (flags.c()) - goto notanexid; - _cmp(al, es.byte(bx+2)); - if (!flags.c()) - goto notanexid; - _cmp(ah, es.byte(bx+1)); - if (flags.c()) - goto notanexid; - _cmp(ah, es.byte(bx+3)); - if (!flags.c()) - goto notanexid; - al = es.byte(bx+4); - ah = 4; - obname(); - al = 1; - _cmp(al, 0); - return; -notanexid: - _sub(bx, 5); - _dec(cx); - _cmp(cx, -1); - if (!flags.z()) - goto identifyex; -} - void DreamGenContext::isitdescribed() { STACK_CHECK; push(ax); @@ -18251,7 +18216,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_madmanrun: madmanrun(); break; case addr_identifyob: identifyob(); break; case addr_checkifset: checkifset(); break; - case addr_checkifex: checkifex(); 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 d638722c6c..82d9cd137a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -118,7 +118,6 @@ public: static const uint16 addr_findfirstpath = 0xc9f0; static const uint16 addr_findpathofpoint = 0xc9ec; static const uint16 addr_isitdescribed = 0xc9e8; - static const uint16 addr_checkifex = 0xc9e0; static const uint16 addr_checkifset = 0xc9dc; static const uint16 addr_identifyob = 0xc9d4; static const uint16 addr_madmanrun = 0xc9cc; @@ -1609,7 +1608,7 @@ public: void errormessage3(); //void deletetaken(); void putundermenu(); - void checkifex(); + void intromonks2(); void intromagic2(); void intromagic3(); void edeninbath(); @@ -1925,6 +1924,7 @@ public: void delcurs(); void randomaccess(); void splitintolines(); + //void checkifex(); //void findobname(); void initialmoncols(); void checkforshake(); @@ -1955,7 +1955,6 @@ public: //void parseblaster(); //void readmouse1(); void makemainscreen(); - void intromonks2(); void usewinch(); void setbotright(); //void readmouse3(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 0f3e6420ef..37125d8870 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1033,6 +1033,30 @@ bool DreamGenContext::checkiffree(uint8 x, uint8 y) { return false; } +void DreamGenContext::checkifex() { + flags._z = not checkifex(al, ah); +} + +bool DreamGenContext::checkifex(uint8 x, uint8 y) { + const ObjPos *exList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos)); + for (size_t i = 0; i < 100; ++i) { + const ObjPos *objPos = exList + 99 - 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; + obname(objPos->index, 4); + 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 17b884cdc5..7c4f43acd3 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -126,6 +126,8 @@ bool checkifperson(uint8 x, uint8 y); void checkiffree(); bool checkiffree(uint8 x, uint8 y); + void checkifex(); + bool checkifex(uint8 x, uint8 y); const uint8 *findobname(uint8 type, uint8 index); void copyname(); void copyname(uint8 type, uint8 index, uint8 *dst); -- cgit v1.2.3