aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-03 14:16:09 +0200
committerBertrand Augereau2011-08-03 15:20:59 +0200
commitf7752243196e83b9191735634a764c26f24d7427 (patch)
treed04544802e01da73a95cd978740b8aa8fb218bd9 /engines/dreamweb
parentc6049ac0c49c83d6367c77c23aafec0369d0e335 (diff)
downloadscummvm-rg350-f7752243196e83b9191735634a764c26f24d7427.tar.gz
scummvm-rg350-f7752243196e83b9191735634a764c26f24d7427.tar.bz2
scummvm-rg350-f7752243196e83b9191735634a764c26f24d7427.zip
DREAMWEB: Ported 'showrain' to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp88
-rw-r--r--engines/dreamweb/dreamgen.h3
-rw-r--r--engines/dreamweb/sprite.cpp44
-rw-r--r--engines/dreamweb/structs.h11
-rw-r--r--engines/dreamweb/stubs.h1
5 files changed, 57 insertions, 90 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index e619dcae13..f25bff3995 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2596,93 +2596,6 @@ failrain:
al = 0;
}
-void DreamGenContext::showrain() {
- STACK_CHECK;
- ds = data.word(kMainsprites);
- si = 6*58;
- ax = ds.word(si+2);
- si = ax;
- _add(si, 2080);
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30));
- es = data.word(kBuffers);
- _cmp(es.byte(bx), 255);
- if (flags.z())
- return /* (nothunder) */;
-morerain:
- es = data.word(kBuffers);
- _cmp(es.byte(bx), 255);
- if (flags.z())
- goto finishrain;
- al = es.byte(bx+1);
- ah = 0;
- _add(ax, data.word(kMapady));
- _add(ax, data.word(kMapystart));
- cx = 320;
- _mul(cx);
- cl = es.byte(bx);
- ch = 0;
- _add(ax, cx);
- _add(ax, data.word(kMapadx));
- _add(ax, data.word(kMapxstart));
- di = ax;
- cl = es.byte(bx+2);
- ch = 0;
- ax = es.word(bx+3);
- dl = es.byte(bx+5);
- dh = 0;
- _sub(ax, dx);
- _and(ax, 511);
- es.word(bx+3) = ax;
- _add(bx, 6);
- push(si);
- _add(si, ax);
- es = data.word(kWorkspace);
- ah = 0;
- dx = 320-2;
-rainloop:
- _lodsb();
- _cmp(al, ah);
- if (flags.z())
- goto noplot;
- _stosb();
- _add(di, dx);
- if (--cx)
- goto rainloop;
- si = pop();
- goto morerain;
-noplot:
- _add(di, 320-1);
- if (--cx)
- goto rainloop;
- si = pop();
- goto morerain;
-finishrain:
- _cmp(data.word(kCh1blockstocopy), 0);
- if (!flags.z())
- return /* (nothunder) */;
- _cmp(data.byte(kReallocation), 2);
- if (!flags.z())
- goto notlouisthund;
- _cmp(data.byte(kBeenmugged), 1);
- if (!flags.z())
- return /* (nothunder) */;
-notlouisthund:
- _cmp(data.byte(kReallocation), 55);
- if (flags.z())
- return /* (nothunder) */;
- randomnum1();
- _cmp(al, 1);
- if (!flags.c())
- return /* (nothunder) */;
- al = 7;
- _cmp(data.byte(kCh0playing), 6);
- if (flags.z())
- goto isthunder1;
- al = 4;
-isthunder1:
- playchannel1();
-}
-
void DreamGenContext::liftnoise() {
STACK_CHECK;
_cmp(data.byte(kReallocation), 5);
@@ -20123,7 +20036,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_initrain: initrain(); break;
case addr_splitintolines: splitintolines(); break;
case addr_getblockofpixel: getblockofpixel(); break;
- case addr_showrain: showrain(); break;
case addr_backobject: backobject(); break;
case addr_liftnoise: liftnoise(); break;
case addr_random: random(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 3642627763..1995858a03 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -651,7 +651,6 @@ public:
static const uint16 addr_random = 0xc17c;
static const uint16 addr_liftnoise = 0xc178;
static const uint16 addr_backobject = 0xc170;
- static const uint16 addr_showrain = 0xc16c;
static const uint16 addr_getblockofpixel = 0xc168;
static const uint16 addr_splitintolines = 0xc164;
static const uint16 addr_initrain = 0xc160;
@@ -1493,7 +1492,7 @@ public:
void disablesoundint();
void checkifset();
void showallex();
- void showrain();
+ //void showrain();
void openpoolboss();
void buttontwo();
//void usetimedtext();
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 3e9914a71f..42c1b70d3a 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -567,5 +567,49 @@ void DreamGenContext::showreelframe(Reel *reel) {
showframe(ds.ptr(0, 0), x, y, frame, 8, &width, &height);
}
+void DreamGenContext::showrain() {
+ ds = data.word(kMainsprites);
+ si = 6*58;
+ ax = ds.word(si+2);
+ si = ax + 2080;
+ es = data.word(kBuffers);
+ Rain *rain = (Rain *)es.ptr(kRainlist, 0);
+ if (rain->x == 255)
+ return;
+ while (true) {
+ if (rain->x == 255) {
+ if (data.word(kCh1blockstocopy) != 0)
+ return;
+ if ((data.byte(kReallocation) == 2) && (data.byte(kBeenmugged) != 1))
+ return;
+ if (data.byte(kReallocation) == 55)
+ return;
+ randomnum1();
+ if (al >= 1)
+ return;
+ if (data.byte(kCh0playing) != 6)
+ al = 4;
+ else
+ al = 7;
+ playchannel1();
+ return;
+ }
+ uint16 y = rain->y + data.word(kMapady) + data.word(kMapystart);
+ uint16 x = rain->x + data.word(kMapadx) + data.word(kMapxstart);
+ uint16 size = rain->size;
+ ax = ((uint16)(rain->w3() - rain->b5)) & 511;
+ rain->setW3(ax);
+ ++rain;
+ const uint8 *src = ds.ptr(si, 0) + ax;
+ uint8 *dst = workspace() + y * 320 + x;
+ for(uint16 i = 0; i < size; ++i) {
+ uint8 v = src[i];
+ if (v != 0)
+ *dst = v;
+ dst += 320-1;
+ }
+ }
+}
+
} /*namespace dreamgen */
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index a54c42d79d..a567384c00 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -121,3 +121,14 @@ struct Room {
uint8 b31;
};
+struct Rain {
+ uint8 x;
+ uint8 y;
+ uint8 size;
+ uint8 w3_lo;
+ uint8 w3_hi;
+ uint16 w3() const { return READ_LE_UINT16(&w3_lo); }
+ void setW3(uint16 v) { WRITE_LE_UINT16(&w3_lo, v); }
+ uint8 b5;
+};
+
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 466a486e7b..635d6c733a 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -111,5 +111,6 @@
void dealwithspecial();
void zoom();
void crosshair();
+ void showrain();