diff options
Diffstat (limited to 'engines/dreamweb/object.cpp')
-rw-r--r-- | engines/dreamweb/object.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 8399c6f26a..9eb31f438f 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -902,4 +902,47 @@ void DreamGenContext::useOpened() { delPointer(); } +void DreamGenContext::swapWithInv() { + uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); + if (subject == data.word(kOldsubject)) { + if (data.byte(kCommandtype) != 243) { + data.byte(kCommandtype) = 243; + data.word(kOldsubject) = subject; + commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); + } + } else { + data.word(kOldsubject) = subject; + commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); + } + + if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) + return; + + byte prevType = data.byte(kObjecttype); + byte prevFrame = data.byte(kItemframe); + uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); + data.byte(kItemframe) = objectId & 0x00FF; + data.byte(kObjecttype) = objectId >> 8; + DynObject *object = getEitherAdCPP(); + object->mapad[0] = 20; + object->mapad[1] = 255; + byte prevType2 = data.byte(kObjecttype); + byte prevFrame2 = data.byte(kItemframe); + data.byte(kObjecttype) = prevType; + data.byte(kItemframe) = prevFrame; + //findInvPosCPP(); // found in the original source, but it seems to be useless + delPointer(); + object = getEitherAdCPP(); + object->mapad[0] = 4; + object->mapad[1] = 255; + object->mapad[2] = data.byte(kLastinvpos); + data.byte(kObjecttype) = prevType2; + data.byte(kItemframe) = prevFrame2; + fillRyan(); + readMouse(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + } // End of namespace DreamGen |