diff options
-rwxr-xr-x | devtools/tasmrecover/tasm-recover | 1 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 41 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/object.cpp | 34 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
5 files changed, 30 insertions, 48 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 9a46fb6151..00053ffadb 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -908,6 +908,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'train', 'transferinv', 'transfertext', + 'transfertoex', 'trapdoor', 'triggermessage', 'trysoundalloc', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 66438cfd04..9582ebe5a5 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -241,47 +241,6 @@ void DreamGenContext::getSetAd() { es = data.word(kSetdat); } -void DreamGenContext::transferToEx() { - STACK_CHECK; - emergencyPurge(); - getExPos(); - al = data.byte(kExpos); - push(ax); - push(di); - al = data.byte(kItemframe); - ah = 0; - bx = 16; - _mul(bx); - ds = data.word(kFreedat); - si = ax; - cx = 8; - _movsw(cx, true); - di = pop(); - al = data.byte(kReallocation); - es.byte(di) = al; - es.byte(di+11) = al; - al = data.byte(kItemframe); - es.byte(di+1) = al; - es.byte(di+2) = 4; - es.byte(di+3) = 255; - al = data.byte(kLastinvpos); - es.byte(di+4) = al; - al = data.byte(kItemframe); - data.byte(kItemtotran) = al; - transferMap(); - transferInv(); - transferText(); - al = data.byte(kItemframe); - ah = 0; - bx = 16; - _mul(bx); - ds = data.word(kFreedat); - si = ax; - ds.byte(si+2) = 254; - pickupConts(); - ax = pop(); -} - void DreamGenContext::pickupConts() { STACK_CHECK; al = ds.byte(si+7); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index a292384826..0ecdf7210b 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -440,7 +440,6 @@ public: void read(); void searchForString(); void getExAd(); - void transferToEx(); void parser(); void transferConToEx(); }; diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 10138acb78..daa45e67eb 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -446,8 +446,7 @@ void DreamGenContext::setPickup() { if (data.byte(kObjecttype) != kExObjectType) { data.byte(kItemframe) = data.byte(kCommand); data.byte(kOpenedob) = 255; - transferToEx(); - data.byte(kItemframe) = al; + data.byte(kItemframe) = transferToEx(); data.byte(kObjecttype) = kExObjectType; DynObject *object = getExAd(data.byte(kItemframe)); object->mapad[0] = 20; @@ -964,8 +963,7 @@ void DreamGenContext::outOfOpen() { data.byte(kItemframe) = objectId & 0xFF; if (data.byte(kObjecttype) != 4) { - transferToEx(); - data.byte(kItemframe) = al; + data.byte(kItemframe) = transferToEx(); data.byte(kObjecttype) = 4; } @@ -1021,8 +1019,7 @@ void DreamGenContext::swapWithOpen() { data.byte(kItemframe) = objectId & 0xFF; if (data.byte(kObjecttype) != 4) { - transferToEx(); - data.byte(kItemframe) = al; + data.byte(kItemframe) = transferToEx(); data.byte(kObjecttype) = 4; } @@ -1059,4 +1056,29 @@ uint16 DreamBase::findOpenPos() { return pos * 2 + kOpeninvlist; // return the object position in the inventory data } +byte DreamGenContext::transferToEx() { + emergencyPurge(); + getExPos(); + byte pos = data.byte(kExpos); + DynObject *exObject = getExAd(pos); + DynObject *freeObject = getFreeAd(data.byte(kItemframe)); + memcpy(exObject, freeObject, sizeof(DynObject)); + exObject->currentLocation = data.byte(kReallocation); + exObject->initialLocation = data.byte(kReallocation); + exObject->index = data.byte(kItemframe); + exObject->mapad[0] = 4; + exObject->mapad[1] = 255; + exObject->mapad[2] = data.byte(kLastinvpos); + data.byte(kItemtotran) = data.byte(kItemframe); + transferMap(); + transferInv(); + transferText(); + freeObject = getFreeAd(data.byte(kItemframe)); + freeObject->mapad[0] = 254; + ds = data.word(kFreedat); + si = data.byte(kItemframe); + pickupConts(); + return pos; +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index a03dbc2fb6..9bbf3b3c40 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -139,5 +139,6 @@ void swapWithOpen(); void swapWithInv(); void searchForFiles(); + byte transferToEx(); #endif |