diff options
author | Bertrand Augereau | 2011-09-01 00:06:30 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-09-01 00:39:43 +0200 |
commit | 6ab4a0ceee71293c100a810c591dde823c2b76ba (patch) | |
tree | f1f4e9306df405c70d15bda6242af8c8489485c6 /engines/dreamweb | |
parent | 0534b70b6d73b6d5afbf107021d52f46a13fcbe9 (diff) | |
download | scummvm-rg350-6ab4a0ceee71293c100a810c591dde823c2b76ba.tar.gz scummvm-rg350-6ab4a0ceee71293c100a810c591dde823c2b76ba.tar.bz2 scummvm-rg350-6ab4a0ceee71293c100a810c591dde823c2b76ba.zip |
DREAMWEB: 'compare' ported to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 18 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 5 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 15 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 2 |
4 files changed, 19 insertions, 21 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 58c461963f..a426cedb73 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -10535,23 +10535,6 @@ doselob: useroutine(); } -void DreamGenContext::compare() { - STACK_CHECK; - _sub(dl, 'A'); - _sub(dh, 'A'); - _sub(cl, 'A'); - _sub(ch, 'A'); - push(cx); - push(dx); - getanyaddir(); - dx = pop(); - cx = pop(); - _cmp(es.word(bx+12), cx); - if (!flags.z()) - return /* (comparefin) */; - _cmp(es.word(bx+14), dx); -} - void DreamGenContext::findsetobject() { STACK_CHECK; _sub(al, 'A'); @@ -17893,7 +17876,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_useelvdoor: useelvdoor(); break; case addr_withwhat: withwhat(); break; case addr_selectob: selectob(); break; - case addr_compare: compare(); break; case addr_findsetobject: findsetobject(); break; case addr_findexobject: findexobject(); break; case addr_isryanholding: isryanholding(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 04bef1670d..3b680025cd 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -297,7 +297,6 @@ public: static const uint16 addr_isryanholding = 0xc6cc; static const uint16 addr_findexobject = 0xc6c8; static const uint16 addr_findsetobject = 0xc6c4; - static const uint16 addr_compare = 0xc6c0; static const uint16 addr_selectob = 0xc6bc; static const uint16 addr_withwhat = 0xc6b8; static const uint16 addr_useelvdoor = 0xc6b4; @@ -1359,7 +1358,7 @@ public: void showdiscops(); void advisor(); void additionaltext(); - //void kernchars(); + //void compare(); void othersmoker(); void dofade(); //void setuptimedtemp(); @@ -1406,7 +1405,7 @@ public: //void addtopeoplelist(); void hangoncurs(); void sparkydrip(); - void compare(); + //void kernchars(); void printcurs(); //void convertkey(); void outofopen(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 923c63602a..3a01872542 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1717,6 +1717,21 @@ void DreamGenContext::obicons() { } } +void DreamGenContext::compare() { + char id[4] = { cl, ch, dl, dh }; + flags._z = compare(al, ah, id); +} + +bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) { + void *ptr = getanyaddir(index, flag); + const char *objId = (const char *)(((const uint8 *)ptr) + 12); // whether it is a DynObject or a SetObject + for (size_t i = 0; i < 4; ++i) { + if(id[i] != objId[i] + 'A') + return false; + } + return true; +} + bool DreamGenContext::isCD() { // The original sources has two codepaths depending if the game is 'if cd' or not // This is a hack to guess which version to use with the assumption that if we have a cd version diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 6d431a856f..f99f0d6fbb 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -208,4 +208,6 @@ void obpicture(); void transferinv(); void obicons(); + void compare(); + bool compare(uint8 index, uint8 flag, const char id[4]); |