aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-03 18:48:43 +0200
committerBertrand Augereau2011-08-04 10:45:43 +0200
commit3427d07de07032b203f7aa02486b8073a65bca26 (patch)
treed494943d30fbe958220cc89653105080c42a089f
parent8ee7ed10664c9c4c6ed944acf489e973be37b327 (diff)
downloadscummvm-rg350-3427d07de07032b203f7aa02486b8073a65bca26.tar.gz
scummvm-rg350-3427d07de07032b203f7aa02486b8073a65bca26.tar.bz2
scummvm-rg350-3427d07de07032b203f7aa02486b8073a65bca26.zip
DREAMWEB: 'doblocks' ported to C++
-rwxr-xr-xdevtools/tasmrecover/tasm-recover1
-rw-r--r--engines/dreamweb/dreamgen.cpp78
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/stubs.h1
-rw-r--r--engines/dreamweb/vgagrafx.cpp42
5 files changed, 45 insertions, 80 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 1c02417cfd..f665b7403b 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -98,6 +98,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'loopchannel0',
'parseblaster',
'deltextline',
+ 'doblocks',
], skip_output = [
# These functions are processed but not output
'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 410abff178..83951bd19c 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -3117,83 +3117,6 @@ deloneloop:
goto deloneloop;
}
-void DreamGenContext::doblocks() {
- STACK_CHECK;
- es = data.word(kWorkspace);
- ax = data.word(kMapady);
- cx = (320);
- _mul(cx);
- di = data.word(kMapadx);
- _add(di, ax);
- al = data.byte(kMapy);
- ah = 0;
- bx = (66);
- _mul(bx);
- bl = data.byte(kMapx);
- bh = 0;
- _add(ax, bx);
- si = (0);
- _add(si, ax);
- cx = 10;
-loop120:
- push(di);
- push(cx);
- cx = 11;
-loop124:
- push(cx);
- push(di);
- ds = data.word(kMapdata);
- _lodsb();
- ds = data.word(kBackdrop);
- push(si);
- _cmp(al, 0);
- if (flags.z())
- goto zeroblock;
- ah = al;
- al = 0;
- si = (0+192);
- _add(si, ax);
- bh = 14;
- bh = 4;
-firstbitofblock:
- _movsw(8);
- _add(di, (320)-16);
- _dec(bh);
- if (!flags.z())
- goto firstbitofblock;
- bh = 12;
-loop125:
- _movsw(8);
- ax = 0x0dfdf;
- _stosw(2);
- _add(di, (320)-20);
- _dec(bh);
- if (!flags.z())
- goto loop125;
- _add(di, 4);
- ax = 0x0dfdf;
- _stosw(8);
- _add(di, (320)-16);
- _stosw(8);
- _add(di, (320)-16);
- _stosw(8);
- _add(di, (320)-16);
- _stosw(8);
-zeroblock:
- si = pop();
- di = pop();
- cx = pop();
- _add(di, 16);
- if (--cx)
- goto loop124;
- _add(si, (66)-11);
- cx = pop();
- di = pop();
- _add(di, (320)*16);
- if (--cx)
- goto loop120;
-}
-
void DreamGenContext::transferinv() {
STACK_CHECK;
di = data.word(kExframepos);
@@ -19774,7 +19697,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_vsync: vsync(); break;
case addr_doshake: doshake(); break;
case addr_delthisone: delthisone(); break;
- case addr_doblocks: doblocks(); break;
case addr_transferinv: transferinv(); break;
case addr_transfermap: transfermap(); break;
case addr_fadedos: fadedos(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 4abcd87719..9c89fead42 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -616,7 +616,6 @@ public:
static const uint16 addr_fadedos = 0xc248;
static const uint16 addr_transfermap = 0xc244;
static const uint16 addr_transferinv = 0xc240;
- static const uint16 addr_doblocks = 0xc228;
static const uint16 addr_delthisone = 0xc214;
static const uint16 addr_doshake = 0xc20c;
static const uint16 addr_vsync = 0xc208;
@@ -1555,7 +1554,7 @@ public:
void locklightoff();
void wearwatch();
void runintroseq();
- void doblocks();
+ //void doblocks();
void opensarters();
void allpalette();
void findormake();
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index d7f71aed5f..5ba83c3014 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -114,4 +114,5 @@
void crosshair();
void showrain();
void deltextline();
+ void doblocks();
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index a4f8d83117..ca86fc44b0 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -384,6 +384,48 @@ void DreamGenContext::clearwork() {
memset(workspace(), 0, 320*200);
}
+void DreamGenContext::doblocks() {
+ uint16 dstOffset = data.word(kMapady) * 320 + data.word(kMapadx);
+ uint16 mapOffset = kMap + data.byte(kMapy) * kMapwidth + data.byte(kMapx);
+ ds = data.word(kMapdata);
+ const uint8 *mapData = ds.ptr(mapOffset, 0);
+ ds = data.word(kBackdrop);
+ const uint8 *blocks = ds.ptr(kBlocks, 0);
+ es = data.word(kWorkspace);
+ uint8 *dstBuffer = es.ptr(dstOffset, 0);
+
+ for (size_t i = 0; i < 10; ++i) {
+ for (size_t j = 0; j < 11; ++j) {
+ uint16 blockType = mapData[j];
+ if (blockType != 0) {
+ uint8 *dst = dstBuffer + i * 320 * 16 + j * 16;
+ const uint8 *block = blocks + blockType * 256;
+ for (size_t k = 0; k < 4; ++k) {
+ memcpy(dst, block, 16);
+ block += 16;
+ dst += 320;
+ }
+ for (size_t k = 0; k < 12; ++k) {
+ memcpy(dst, block, 16);
+ memset(dst + 16, 0xdf, 4);
+ block += 16;
+ dst += 320;
+ }
+ dst += 4;
+ ax = 0x0dfdf;
+ memset(dst, 0xdf, 16);
+ dst += 320;
+ memset(dst, 0xdf, 16);
+ dst += 320;
+ memset(dst, 0xdf, 16);
+ dst += 320;
+ memset(dst, 0xdf, 16);
+ }
+ }
+ mapData += kMapwidth;
+ }
+}
+
void DreamGenContext::zoom() {
if (data.word(kWatchingtime) != 0)
return;