aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorBertrand Augereau2011-06-26 17:03:17 +0200
committerBertrand Augereau2011-07-18 22:59:14 +0200
commit880bcc69ef24fa6fa333a38d14d47d45c123aeb5 (patch)
tree98241dafd37450537924a6664540355898660182 /engines/dreamweb
parent7af3cd565c2c62d4733b2272a841e0ead49988cd (diff)
downloadscummvm-rg350-880bcc69ef24fa6fa333a38d14d47d45c123aeb5.tar.gz
scummvm-rg350-880bcc69ef24fa6fa333a38d14d47d45c123aeb5.tar.bz2
scummvm-rg350-880bcc69ef24fa6fa333a38d14d47d45c123aeb5.zip
DREAMWEB: showframe blacklisted
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp109
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/stubs.cpp109
-rw-r--r--engines/dreamweb/stubs.h7
4 files changed, 93 insertions, 135 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 90cffed8f4..c96ce3f4f2 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -4090,114 +4090,6 @@ zeroblock:
goto loop120;
}
-void DreamGenContext::showframe() {
- STACK_CHECK;
- push(dx);
- push(ax);
- cx = ax;
- _and(cx, 511);
- _add(cx, cx);
- si = cx;
- _add(cx, cx);
- _add(si, cx);
- _cmp(ds.word(si), 0);
- if (!flags.z())
- goto notblankshow;
- ax = pop();
- dx = pop();
- cx = 0;
- return;
-notblankshow:
- _test(ah, 128);
- if (!flags.z())
- goto skipoffsets;
- al = ds.byte(si+4);
- ah = 0;
- _add(di, ax);
- al = ds.byte(si+5);
- ah = 0;
- _add(bx, ax);
-skipoffsets:
- cx = ds.word(si+0);
- ax = ds.word(si+2);
- _add(ax, 2080);
- si = ax;
- ax = pop();
- dx = pop();
- _cmp(ah, 0);
- if (flags.z())
- goto noeffects;
- _test(ah, 128);
- if (flags.z())
- goto notcentred;
- push(ax);
- al = cl;
- ah = 0;
- _shr(ax, 1);
- _sub(di, ax);
- al = ch;
- ah = 0;
- _shr(ax, 1);
- _sub(bx, ax);
- ax = pop();
-notcentred:
- _test(ah, 64);
- if (flags.z())
- goto notdiffdest;
- push(cx);
- frameoutfx();
- cx = pop();
- return;
-notdiffdest:
- _test(ah, 8);
- if (flags.z())
- goto notprintlist;
- push(ax);
- ax = di;
- _sub(ax, data.word(kMapadx));
- push(bx);
- _sub(bx, data.word(kMapady));
- ah = bl;
- bx = pop();
- ax = pop();
-notprintlist:
- _test(ah, 4);
- if (flags.z())
- goto notflippedx;
- dx = (320);
- es = data.word(kWorkspace);
- push(cx);
- frameoutfx();
- cx = pop();
- return;
-notflippedx:
- _test(ah, 2);
- if (flags.z())
- goto notnomask;
- dx = (320);
- es = data.word(kWorkspace);
- push(cx);
- frameoutnm();
- cx = pop();
- return;
-notnomask:
- _test(ah, 32);
- if (flags.z())
- goto noeffects;
- dx = (320);
- es = data.word(kWorkspace);
- push(cx);
- frameoutbh();
- cx = pop();
- return;
-noeffects:
- dx = (320);
- es = data.word(kWorkspace);
- push(cx);
- frameoutv();
- cx = pop();
-}
-
void DreamGenContext::frameoutbh() {
STACK_CHECK;
push(dx);
@@ -22020,7 +21912,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_zoom: zoom(); break;
case addr_delthisone: delthisone(); break;
case addr_doblocks: doblocks(); break;
- case addr_showframe: showframe(); break;
case addr_frameoutbh: frameoutbh(); break;
case addr_frameoutfx: frameoutfx(); break;
case addr_transferinv: transferinv(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index dc9aebe4c0..a52e142973 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -620,7 +620,6 @@ public:
static const uint16 addr_transferinv = 0xc240;
static const uint16 addr_frameoutfx = 0xc23c;
static const uint16 addr_frameoutbh = 0xc238;
- static const uint16 addr_showframe = 0xc22c;
static const uint16 addr_doblocks = 0xc228;
static const uint16 addr_delthisone = 0xc214;
static const uint16 addr_zoom = 0xc210;
@@ -1679,7 +1678,7 @@ public:
void walking();
void diarykeyp();
//void readabyte();
- void showframe();
+ //void showframe();
void random();
void obicons();
void frameoutbh();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 5123655795..512732a87a 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -83,21 +83,14 @@ void DreamGenContext::cls() {
engine->cls();
}
-void DreamGenContext::frameoutnm() {
- unsigned w = (uint8)cl, h = (uint8)ch;
- unsigned pitch = (uint16)dx;
- unsigned src = (uint16)si;
- int x = (uint16)di, y = (uint16)bx;
- unsigned dst = x + y * pitch;
- //debug(1, "framenm %ux%u[pitch: %u]-> %d,%d, segment: %04x->%04x", w, h, pitch, x, y, (uint16)ds, (uint16)es);
- for(unsigned l = 0; l < h; ++l) {
- uint8 *src_p = ds.ptr(src + w * l, w);
- uint8 *dst_p = es.ptr(dst + pitch * l, w);
- memcpy(dst_p, src_p, w);
+void DreamGenContext::frameoutnm(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
+ dst += pitch * y + x;
+
+ for (uint16 j = 0; j < height; ++j) {
+ memcpy(dst, src, width);
+ dst += pitch;
+ src += width;
}
- di += dst + pitch * h;
- si += w * h;
- cx = 0;
}
void DreamGenContext::seecommandtail() {
@@ -528,24 +521,26 @@ void DreamGenContext::showpcx() {
pcxFile.close();
}
+/*
void DreamGenContext::frameoutv() {
uint16 pitch = dx;
uint16 width = cx & 0xff;
uint16 height = cx >> 8;
const uint8* src = ds.ptr(si, width * height);
- uint8* dst = es.ptr(di, pitch * height);
+ uint8* dst = es.ptr(0, pitch * height);
- frameoutv(dst, src, pitch, width, height);
+ frameoutv(dst, src, pitch, width, height, di, bx);
}
+*/
-void DreamGenContext::frameoutv(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height) {
+void DreamGenContext::frameoutv(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
uint16 stride = pitch - width;
- dst += pitch * bx;
+ dst += pitch * y + x;
// NB: Original code assumes non-zero width and height, "for" are unneeded, do-while would suffice but would be less readable
- for (uint16 y = 0; y < height; ++y) {
- for (uint16 x = 0; x < width; ++x) {
+ for (uint16 j = 0; j < height; ++j) {
+ for (uint16 i = 0; i < width; ++i) {
uint8 pixel = *src++;
if (pixel)
*dst = pixel;
@@ -569,6 +564,78 @@ Sprite* DreamGenContext::spritetable() {
return sprite;
}
+uint16 DreamGenContext::showframeCPP(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 frameNumber, uint8 effectsFlag) {
+ es = dst;
+ ds = src;
+ di = x;
+ bx = y;
+ al = frameNumber;
+ ah = effectsFlag;
+
+ si = (ax & 0x1ff) * 6;
+ if (ds.word(si) == 0) {
+ return 0;
+ }
+
+//notblankshow:
+ if ((effectsFlag & 128) == 0) {
+ di += ds.byte(si+4);
+ bx += ds.byte(si+5);
+ }
+//skipoffsets:
+ cx = ds.word(si+0);
+ uint8 width = cl;
+ uint8 height = ch;
+ uint16 written = cx;
+ si = ds.word(si+2) + 2080;
+
+ if (effectsFlag) {
+ if (effectsFlag & 128) { //centred
+ di -= width / 2;
+ bx -= height / 2;
+ }
+ if (effectsFlag & 64) { //diffdest
+ frameoutfx();
+ return written;
+ }
+ if (effectsFlag & 8) { //printlist
+ push(ax);
+ ax = di - data.word(kMapadx);
+ push(bx);
+ bx -= data.word(kMapady);
+ ah = bl;
+ bx = pop();
+ //addtoprintlist(); // NB: Commented in the original asm
+ ax = pop();
+ }
+ if (effectsFlag & 4) { //flippedx
+ dx = (320);
+ es = data.word(kWorkspace);
+ frameoutfx();
+ return written;
+ }
+ if (effectsFlag & 2) { //nomask
+ es = data.word(kWorkspace);
+ frameoutnm(es.ptr(0, 320 * height), ds.ptr(si, width * height), 320, width, height, di, bx);
+ return written;
+ }
+ if (effectsFlag & 32) {
+ dx = (320);
+ es = data.word(kWorkspace);
+ frameoutbh();
+ return written;
+ }
+ }
+//noeffects:
+ es = data.word(kWorkspace);
+ frameoutv(es.ptr(0, 320 * height), ds.ptr(si, width * height), 320, width, height, di, bx);
+ return written;
+}
+
+void DreamGenContext::showframe() {
+ cx = showframeCPP(es, ds, di, bx, al, ah);
+}
+
void DreamGenContext::printsprites() {
for (size_t priority = 0; priority < 7; ++priority) {
Sprite *sprites = spritetable();
@@ -606,7 +673,7 @@ void DreamGenContext::printasprite(const Sprite* sprite) {
ax = sprite->b15;
if (sprite->type != 0)
ah = 8;
- showframe(); // NB: Params in ax, bx, di, ds:dx
+ showframe();
bx = pop();
es = pop();
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 7f1e3b9f0c..0b48c2d363 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -1,6 +1,6 @@
void multidump();
- void frameoutv();
- void frameoutv(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height);
+ void frameoutv(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
+ void frameoutnm(uint8* dst, const uint8* src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void worktoscreen();
void multiget();
void convertkey();
@@ -10,10 +10,11 @@
void readoneblock();
void printundermon();
void seecommandtail();
- void frameoutnm();
void randomnumber();
void quickquit2();
Sprite* spritetable();
+ void showframe();
+ uint16 showframeCPP(uint16 dst, uint16 src, uint16 x, uint16 y, uint8 frameNumber, uint8 effectsFlag);
void printasprite(const Sprite* sprite);
void width160();
void multiput();