diff options
-rwxr-xr-x | devtools/tasmrecover/tasm-recover | 1 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 101 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/object.cpp | 52 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
5 files changed, 54 insertions, 102 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index e519aebb9b..04e204720e 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -385,6 +385,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'drawitall', 'drinker', 'droperror', + 'dropobject', 'drunk', 'dumpblink', 'dumpcurrent', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index bcb45f529f..d1abe79a48 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -580,107 +580,6 @@ findopenp1: _add(bx, (0+(228*13))); } -void DreamGenContext::dropObject() { - STACK_CHECK; - _cmp(data.byte(kCommandtype), 223); - if (flags.z()) - goto alreadydrop; - data.byte(kCommandtype) = 223; - _cmp(data.byte(kPickup), 0); - if (flags.z()) - { blank(); return; }; - bl = data.byte(kItemframe); - bh = data.byte(kObjecttype); - al = 37; - commandWithOb(); -alreadydrop: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (nodrop) */; - _and(ax, 1); - if (!flags.z()) - goto dodrop; - return; -dodrop: - getEitherAd(); - isItWorn(); - if (!flags.z()) - goto nowornerror; - wornError(); - return; -nowornerror: - _cmp(data.byte(kReallocation), 47); - if (flags.z()) - goto nodrop2; - cl = data.byte(kRyanx); - _add(cl, 12); - ch = data.byte(kRyany); - _add(ch, 12); - checkOne(); - _cmp(cl, 2); - if (flags.c()) - goto nodroperror; -nodrop2: - dropError(); - return; -nodroperror: - _cmp(data.byte(kMapxsize), 64); - if (!flags.z()) - goto notinlift; - _cmp(data.byte(kMapysize), 64); - if (!flags.z()) - goto notinlift; - dropError(); - return; -notinlift: - al = data.byte(kItemframe); - ah = 4; - cl = 'G'; - ch = 'U'; - dl = 'N'; - dh = 'A'; - compare(); - if (flags.z()) - { cantDrop(); return; }; - al = data.byte(kItemframe); - ah = 4; - cl = 'S'; - ch = 'H'; - dl = 'L'; - dh = 'D'; - compare(); - if (flags.z()) - { cantDrop(); return; }; - data.byte(kObjecttype) = 4; - al = data.byte(kItemframe); - getExAd(); - es.byte(bx+2) = 0; - al = data.byte(kRyanx); - _add(al, 4); - cl = 4; - _shr(al, cl); - _add(al, data.byte(kMapx)); - ah = data.byte(kRyany); - _add(ah, 8); - cl = 4; - _shr(ah, cl); - _add(ah, data.byte(kMapy)); - es.byte(bx+3) = al; - es.byte(bx+5) = ah; - al = data.byte(kRyanx); - _add(al, 4); - _and(al, 15); - ah = data.byte(kRyany); - _add(ah, 8); - _and(ah, 15); - es.byte(bx+4) = al; - es.byte(bx+6) = ah; - data.byte(kPickup) = 0; - al = data.byte(kReallocation); - es.byte(bx) = al; -} - void DreamGenContext::selectOpenOb() { STACK_CHECK; al = data.byte(kCommand); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 2df23e4e08..2041ab186b 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -475,7 +475,6 @@ public: void findAllOpen(); void fillOpen(); void getEitherAd(); - void dropObject(); void useOpened(); void locationPic(); void swapWithOpen(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8e7ade4ffd..04081e2f0e 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -704,5 +704,57 @@ const uint8 *DreamBase::getObTextStart() { } } +void DreamGenContext::dropObject() { + if (data.byte(kCommandtype) != 223) { + data.byte(kCommandtype) = 223; + if (!data.byte(kPickup)) { + blank(); + return; + } + commandWithOb(37, data.byte(kObjecttype), data.byte(kItemframe)); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + if (isItWorn(getEitherAdCPP())) { + wornError(); + return; + } + + if (data.byte(kReallocation) != 47) { + byte flag, flagEx, type, flagX, flagY; + checkOne(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY); + + if (flag >= 2) { + dropError(); + return; + } + } else { + dropError(); + return; + } + + if (data.byte(kMapxsize) == 64 && data.byte(kMapysize) == 64) { + // Inside lift + dropError(); + return; + } + + if (compare(data.byte(kItemframe), 4, "GUNA") || compare(data.byte(kItemframe), 4, "SHLD")) { + cantDrop(); + return; + } + + data.byte(kObjecttype) = 4; + DynObject *object = getExAd(data.byte(kItemframe)); + object->mapad[0] = 0; + object->mapad[1] = ((data.byte(kRyanx) + 4) >> 4) + data.byte(kMapx); + object->mapad[2] = (data.byte(kRyanx) + 4) & 0xF; + object->mapad[3] = ((data.byte(kRyany) + 8) >> 4) + data.byte(kMapy); + object->mapad[4] = (data.byte(kRyany) + 8) & 0xF; + data.byte(kPickup) = 0; + object->currentLocation = data.byte(kReallocation); +} } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 83b4ebfcae..5f4ad566c1 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -339,5 +339,6 @@ void outOfInv(); void edensFlatReminders(); void incRyanPage(); + void dropObject(); #endif |