aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-12-26 15:23:15 +0100
committerFilippos Karapetis2011-12-26 16:54:00 +0200
commit1fef9d1f75948b3d6f10c221ce8289b44b288a7d (patch)
treed1b734f6de6e9a16d556ed370c242cfc1edcaae8
parent4a30fa8845c10524b456b5ebc72070f54841ca4a (diff)
downloadscummvm-rg350-1fef9d1f75948b3d6f10c221ce8289b44b288a7d.tar.gz
scummvm-rg350-1fef9d1f75948b3d6f10c221ce8289b44b288a7d.tar.bz2
scummvm-rg350-1fef9d1f75948b3d6f10c221ce8289b44b288a7d.zip
DREAMWEB: Convert findAllOpen, fillOpen
-rwxr-xr-xdevtools/tasmrecover/tasm-recover2
-rw-r--r--engines/dreamweb/dreambase.h5
-rw-r--r--engines/dreamweb/dreamgen.cpp117
-rw-r--r--engines/dreamweb/dreamgen.h2
-rw-r--r--engines/dreamweb/object.cpp59
-rw-r--r--engines/dreamweb/stubs.h3
6 files changed, 61 insertions, 127 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 00053ffadb..9fd0a2c10f 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -468,9 +468,11 @@ generator = cpp(context, "DreamGen", blacklist = [
'fadeupmonfirst',
'fadeupyellows',
'femalefan',
+ 'fillopen',
'fillryan',
'fillspace',
'finalframe',
+ 'findallopen',
'findallryan',
'findexobject',
'findfirstpath',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index ab0843663a..3f667e8757 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -212,6 +212,11 @@ public:
void makeWorn(DynObject *object);
void dropObject();
uint16 findOpenPos();
+ byte getOpenedSlotSize();
+ byte getOpenedSlotCount();
+ void openOb();
+ void findAllOpen();
+ void fillOpen();
// from pathfind.cpp
void turnPathOn(uint8 param);
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 9582ebe5a5..282fab2db2 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -73,123 +73,6 @@ void DreamGenContext::transferMap() {
_add(data.word(kExframepos), cx);
}
-void DreamGenContext::fillOpen() {
- STACK_CHECK;
- delTextLine();
- getOpenedSize();
- _cmp(ah, 4);
- if (flags.c())
- goto lessthanapage;
- ah = 4;
-lessthanapage:
- al = 1;
- push(ax);
- es = data.word(kBuffers);
- di = (0+(228*13));
- findAllOpen();
- si = (0+(228*13));
- di = (80);
- bx = (58)+96;
- cx = pop();
-openloop1:
- push(cx);
- push(di);
- push(bx);
- ax = es.word(si);
- _add(si, 2);
- push(si);
- push(es);
- _cmp(ch, cl);
- if (flags.c())
- goto nextopenslot;
- obToInv();
-nextopenslot:
- es = pop();
- si = pop();
- bx = pop();
- di = pop();
- cx = pop();
- _add(di, (44));
- _inc(cl);
- _cmp(cl, 5);
- if (!flags.z())
- goto openloop1;
- underTextLine();
-}
-
-void DreamGenContext::findAllOpen() {
- STACK_CHECK;
- push(di);
- cx = 16;
- ax = 0x0ffff;
- _stosw(cx, true);
- di = pop();
- cl = data.byte(kOpenedob);
- dl = data.byte(kOpenedtype);
- ds = data.word(kExtras);
- bx = (0+2080+30000);
- ch = 0;
-findopen1:
- _cmp(ds.byte(bx+3), cl);
- if (!flags.z())
- goto findopen2;
- _cmp(ds.byte(bx+2), dl);
- if (!flags.z())
- goto findopen2;
- _cmp(data.byte(kOpenedtype), 4);
- if (flags.z())
- goto noloccheck;
- al = ds.byte(bx+5);
- _cmp(al, data.byte(kReallocation));
- if (!flags.z())
- goto findopen2;
-noloccheck:
- al = ds.byte(bx+4);
- ah = 0;
- push(di);
- _add(di, ax);
- _add(di, ax);
- al = ch;
- ah = 4;
- _stosw();
- di = pop();
-findopen2:
- _add(bx, 16);
- _inc(ch);
- _cmp(ch, (114));
- if (!flags.z())
- goto findopen1;
- cl = data.byte(kOpenedob);
- dl = data.byte(kOpenedtype);
- push(dx);
- ds = data.word(kFreedat);
- dx = pop();
- bx = 0;
- ch = 0;
-findopen1a:
- _cmp(ds.byte(bx+3), cl);
- if (!flags.z())
- goto findopen2a;
- _cmp(ds.byte(bx+2), dl);
- if (!flags.z())
- goto findopen2a;
- al = ds.byte(bx+4);
- ah = 0;
- push(di);
- _add(di, ax);
- _add(di, ax);
- al = ch;
- ah = 2;
- _stosw();
- di = pop();
-findopen2a:
- _add(bx, 16);
- _inc(ch);
- _cmp(ch, 80);
- if (!flags.z())
- goto findopen1a;
-}
-
void DreamGenContext::getFreeAd() {
STACK_CHECK;
ah = 0;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 0ecdf7210b..d377489da4 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -434,8 +434,6 @@ public:
void pickupConts();
void transferMap();
void getSetAd();
- void findAllOpen();
- void fillOpen();
void dreamweb();
void read();
void searchForString();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index daa45e67eb..c8127c345e 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -277,7 +277,8 @@ void DreamBase::getBackFromOb() {
}
void DreamGenContext::getOpenedSize() {
- //ax = getOpenedSlotCount();
+ //ah = getOpenedSlotSize();
+ //ah = getOpenedSlotCount();
// We need to call the ASM-style versions of get*Ad, as these also set
// bx and es
@@ -300,7 +301,7 @@ void DreamGenContext::getOpenedSize() {
}
}
-byte DreamGenContext::getOpenedSlotCount() {
+byte DreamBase::getOpenedSlotCount() {
byte obj = data.byte(kOpenedob);
switch (data.byte(kOpenedtype)) {
case 4:
@@ -312,7 +313,7 @@ byte DreamGenContext::getOpenedSlotCount() {
}
}
-byte DreamGenContext::getOpenedSlotSize() {
+byte DreamBase::getOpenedSlotSize() {
byte obj = data.byte(kOpenedob);
switch (data.byte(kOpenedtype)) {
case 4:
@@ -324,14 +325,14 @@ byte DreamGenContext::getOpenedSlotSize() {
}
}
-void DreamGenContext::openOb() {
+void DreamBase::openOb() {
uint8 commandLine[64] = "OBJECT NAME ONE ";
copyName(data.byte(kOpenedtype), data.byte(kOpenedob), commandLine);
printMessage(kInventx, kInventy+86, 62, 240, false);
- al = printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false);
+ printDirect(commandLine, data.word(kLastxpos) + 5, kInventy+86, 220, false);
fillOpen();
_openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx;
@@ -1081,4 +1082,52 @@ byte DreamGenContext::transferToEx() {
return pos;
}
+void DreamBase::fillOpen() {
+ delTextLine();
+ uint8 size = getOpenedSlotCount();
+ if (size > 4)
+ size = 4;
+ findAllOpen();
+ uint8 *openInvList = getSegment(data.word(kBuffers)).ptr(kOpeninvlist, 32);
+ for (uint8 i = 0; i < size; ++i) {
+ uint8 index = openInvList[2*i];
+ uint8 type = openInvList[2*i + 1];
+ obToInv(index, type, kInventx + (i-1)*kItempicsize, kInventy + 96);
+ }
+ underTextLine();
+}
+
+void DreamBase::findAllOpen() {
+ uint8 *openInvList = getSegment(data.word(kBuffers)).ptr(kOpeninvlist, 32);
+
+ memset(openInvList, 0xFF, 32);
+
+ const DynObject *obj;
+
+ obj = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0);
+ for (uint8 i = 0; i < kNumexobjects; ++i, ++obj) {
+ if (obj->mapad[1] != data.byte(kOpenedob))
+ continue;
+ if (obj->mapad[0] != data.byte(kOpenedtype))
+ continue;
+ if (data.byte(kOpenedtype) != kExObjectType && obj->mapad[3] != data.byte(kReallocation))
+ continue;
+ uint8 slot = obj->mapad[2];
+ assert(slot < 16);
+ openInvList[2*slot] = i;
+ openInvList[2*slot + 1] = kExObjectType;
+ }
+
+ obj = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0);
+ for (uint8 i = 0; i < 80; ++i, ++obj) {
+ if (obj->mapad[1] != data.byte(kOpenedob))
+ continue;
+ if (obj->mapad[0] != data.byte(kOpenedtype))
+ continue;
+ uint8 index = obj->mapad[2];
+ openInvList[2*index] = i;
+ openInvList[2*index + 1] = kFreeObjectType;
+ }
+}
+
} // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 9bbf3b3c40..bd5cd9d1e5 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -119,10 +119,7 @@
void processTrigger();
bool execCommand();
void getOpenedSize();
- byte getOpenedSlotSize();
- byte getOpenedSlotCount();
bool checkObjectSizeCPP();
- void openOb();
void identifyOb();
void selectOb();
void findInvPos();