diff options
author | Filippos Karapetis | 2011-12-25 19:25:00 +0200 |
---|---|---|
committer | Filippos Karapetis | 2011-12-25 19:25:00 +0200 |
commit | 95ffd7f4ce2e0274b8adf87f03bc705b1d3a1ebd (patch) | |
tree | c956aea2eb477ff25d662d2559030c7060915c59 /engines | |
parent | eaf87bdfa7ac279f736c03b25af94ac1df3b31ce (diff) | |
download | scummvm-rg350-95ffd7f4ce2e0274b8adf87f03bc705b1d3a1ebd.tar.gz scummvm-rg350-95ffd7f4ce2e0274b8adf87f03bc705b1d3a1ebd.tar.bz2 scummvm-rg350-95ffd7f4ce2e0274b8adf87f03bc705b1d3a1ebd.zip |
DREAMWEB: Port 'purgeanitem' to C++, some cleanup
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/dreambase.h | 2 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 50 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/object.cpp | 5 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 21 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 5 |
6 files changed, 22 insertions, 62 deletions
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 9e45e046f4..c14bfda7a1 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -541,6 +541,8 @@ public: void cantDrop(); void entryAnims(); bool finishedWalking(); + void emergencyPurge(); + void purgeAnItem(); // from talk.cpp void talk(); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 42c0f71d2e..3ab3a66f55 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -475,56 +475,6 @@ void DreamGenContext::transferConToEx() { ds.byte(si+2) = 255; } -void DreamGenContext::purgeAnItem() { - STACK_CHECK; - es = data.word(kExtras); - di = (0+2080+30000); - bl = data.byte(kReallocation); - cx = 0; -lookforpurge: - al = es.byte(di+2); - _cmp(al, 0); - if (!flags.z()) - goto cantpurge; - _cmp(es.byte(di+12), 2); - if (flags.z()) - goto iscup; - _cmp(es.byte(di+12), 255); - if (!flags.z()) - goto cantpurge; -iscup: - _cmp(es.byte(di+11), bl); - if (flags.z()) - goto cantpurge; - deleteExObject(); - return; -cantpurge: - _add(di, 16); - _inc(cx); - _cmp(cx, (114)); - if (!flags.z()) - goto lookforpurge; - di = (0+2080+30000); - bl = data.byte(kReallocation); - cx = 0; -lookforpurge2: - al = es.byte(di+2); - _cmp(al, 0); - if (!flags.z()) - goto cantpurge2; - _cmp(es.byte(di+12), 255); - if (!flags.z()) - goto cantpurge2; - deleteExObject(); - return; -cantpurge2: - _add(di, 16); - _inc(cx); - _cmp(cx, (114)); - if (!flags.z()) - goto lookforpurge2; -} - void DreamGenContext::getDestInfo() { STACK_CHECK; al = data.byte(kDestpos); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index d86e0072ef..cd65c723a7 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -461,7 +461,6 @@ public: void dirFile(); void pickupConts(); void transferMap(); - void purgeAnItem(); void getSetAd(); void findOpenPos(); void rollEm(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 64b3d276bb..f3e27d9a5b 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -517,11 +517,6 @@ void DreamBase::deleteExText(uint8 textNum) { } } -// This takes es:di and cl as input, but es:di always points to getExAd(cl) -void DreamGenContext::deleteExObject() { - deleteExObject(cl); -} - void DreamBase::deleteExObject(uint8 index) { DynObject *obj = getExAd(index); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4eea0b72b9..3425ad400f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -3701,7 +3701,7 @@ void DreamBase::incRyanPage() { } -void DreamGenContext::emergencyPurge() { +void DreamBase::emergencyPurge() { while (true) { if (data.word(kExframepos) + 4000 < kExframeslen) { // Not near frame end @@ -3713,4 +3713,23 @@ void DreamGenContext::emergencyPurge() { } } +void DreamBase::purgeAnItem() { + const DynObject *extraObjects = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0); + + for (size_t i = 0; i < kNumexobjects; ++i) { + if (extraObjects[i].mapad[0] && extraObjects[i].id[0] == 255 && + extraObjects[i].initialLocation != data.byte(kReallocation)) { + deleteExObject(i); + return; + } + } + + for (size_t i = 0; i < kNumexobjects; ++i) { + if (extraObjects[i].mapad[0] && extraObjects[i].id[0] == 255) { + deleteExObject(i); + return; + } + } +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 5bb07adbfa..98149f2b70 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -183,10 +183,6 @@ uint16 findInvPosCPP(); void setPickup(); void getKeyAndLogo(); - void deleteExObject(); - void deleteExObject(uint8 index) { - DreamBase::deleteExObject(index); - } void signOn(); void lookAtPlace(); void inToInv(); @@ -199,6 +195,5 @@ void outOfOpen(); void swapWithOpen(); void swapWithInv(); - void emergencyPurge(); #endif |