aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBertrand Augereau2011-08-21 15:24:05 +0200
committerBertrand Augereau2011-08-21 16:29:48 +0200
commit7393cce711c24b1911c2ed4f9a7fcd87367b058e (patch)
tree4f0972d35bee88bb1c646531538cdd35762f4a7e /engines
parentcfef8111da7f70bf676874dde8f529f673cbbc54 (diff)
downloadscummvm-rg350-7393cce711c24b1911c2ed4f9a7fcd87367b058e.tar.gz
scummvm-rg350-7393cce711c24b1911c2ed4f9a7fcd87367b058e.tar.bz2
scummvm-rg350-7393cce711c24b1911c2ed4f9a7fcd87367b058e.zip
DREAMWEB: 'showallfree' ported to C++
Diffstat (limited to 'engines')
-rw-r--r--engines/dreamweb/backdrop.cpp37
-rw-r--r--engines/dreamweb/dreamgen.cpp82
-rw-r--r--engines/dreamweb/dreamgen.h7
-rw-r--r--engines/dreamweb/stubs.h1
4 files changed, 41 insertions, 86 deletions
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp
index 83e1b13d03..94963f40ef 100644
--- a/engines/dreamweb/backdrop.cpp
+++ b/engines/dreamweb/backdrop.cpp
@@ -245,5 +245,42 @@ void DreamGenContext::calcmapad() {
data.word(kMapady) = data.word(kMapoffsety) - 8 * (mapYsize + 2 * mapYstart - 10);
}
+void DreamGenContext::showallfree() {
+ data.word(kListpos) = kFreelist;
+ ObjPos *listPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(kFreelist, 80 * sizeof(ObjPos));
+ memset(listPos, 0xff, 80 * sizeof(ObjPos));
+
+ data.word(kFrsegment) = data.word(kFreeframes);
+ data.word(kDataad) = kFrframedata;
+ data.word(kFramesad) = kFrframes;
+ data.byte(kCurrentfree) = 0;
+ const uint8 *mapData = segRef(data.word(kFreedat)).ptr(2, 0);
+ for(size_t i = 0; i < 80; ++i) {
+ uint8 mapad = getmapad(mapData);
+ if (mapad != 0) {
+ data.word(kCurrentframe) = 3 * data.byte(kCurrentfree);
+ uint8 width, height;
+ calcfrframe(&width, &height);
+ uint16 x, y;
+ finalframe(&x, &y);
+ if ((width != 0) || (height != 0)) {
+ x += data.word(kMapadx);
+ y += data.word(kMapady);
+ showframe((Frame *)segRef(data.word(kFrsegment)).ptr(0, 0), x, y, data.word(kCurrentframe) & 0xff, 0, &width, &height);
+ ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
+ objPos->xMin = data.byte(kSavex);
+ objPos->yMin = data.byte(kSavey);
+ objPos->xMax = data.byte(kSavex) + data.byte(kSavesize+0);
+ objPos->yMax = data.byte(kSavey) + data.byte(kSavesize+1);
+ objPos->index = i;
+ data.word(kListpos) += sizeof(ObjPos);
+ }
+ }
+
+ ++data.byte(kCurrentfree);
+ mapData += 16;
+ }
+}
+
} /*namespace dreamgen */
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 7a48d7313d..ceec7d9049 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -6415,87 +6415,6 @@ _tmp28a:
goto _tmp28;
}
-void DreamGenContext::showallfree() {
- STACK_CHECK;
- es = data.word(kBuffers);
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5));
- data.word(kListpos) = bx;
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5));
- cx = 80*5;
- al = 255;
- _stosb(cx, true);
- es = data.word(kFreeframes);
- data.word(kFrsegment) = es;
- ax = (0);
- data.word(kDataad) = ax;
- ax = (0+2080);
- data.word(kFramesad) = ax;
- al = 0;
- data.byte(kCurrentfree) = al;
- ds = data.word(kFreedat);
- si = 2;
- cx = 0;
-loop127:
- push(cx);
- push(si);
- push(si);
- es = data.word(kFreedat);
- getmapad();
- si = pop();
- _cmp(ch, 0);
- if (flags.z())
- goto over138;
- al = data.byte(kCurrentfree);
- ah = 0;
- dx = ax;
- _add(ax, ax);
- _add(ax, dx);
- data.word(kCurrentframe) = ax;
- push(es);
- push(si);
- calcfrframe();
- es = data.word(kMapstore);
- ds = data.word(kFrsegment);
- finalframe();
- si = pop();
- es = pop();
- _cmp(cx, 0);
- if (flags.z())
- goto over138;
- ax = data.word(kCurrentframe);
- ah = 0;
- _add(di, data.word(kMapadx));
- _add(bx, data.word(kMapady));
- showframe();
- si = data.word(kListpos);
- es = data.word(kBuffers);
- al = data.byte(kSavex);
- ah = data.byte(kSavey);
- es.word(si) = ax;
- cx = ax;
- ax = data.word(kSavesize);
- _add(al, cl);
- _add(ah, ch);
- es.word(si+2) = ax;
- ax = pop();
- cx = pop();
- push(cx);
- push(ax);
- es.byte(si+4) = cl;
- _add(si, 5);
- data.word(kListpos) = si;
-over138:
- _inc(data.byte(kCurrentfree));
- si = pop();
- cx = pop();
- _add(si, 16);
- _inc(cx);
- _cmp(cx, 80);
- if (flags.z())
- return /* (finfree) */;
- goto loop127;
-}
-
void DreamGenContext::showallex() {
STACK_CHECK;
es = data.word(kBuffers);
@@ -18409,7 +18328,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_blockget: blockget(); break;
case addr_drawfloor: drawfloor(); break;
case addr_drawflags: drawflags(); break;
- case addr_showallfree: showallfree(); break;
case addr_showallex: showallex(); break;
case addr_adjustlen: adjustlen(); break;
case addr_autolook: autolook(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index bca9cc634a..62aaf70661 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -467,7 +467,6 @@ public:
static const uint16 addr_autolook = 0xc46c;
static const uint16 addr_adjustlen = 0xc45c;
static const uint16 addr_showallex = 0xc450;
- static const uint16 addr_showallfree = 0xc44c;
static const uint16 addr_drawflags = 0xc43c;
static const uint16 addr_drawfloor = 0xc428;
static const uint16 addr_blockget = 0xc424;
@@ -1455,7 +1454,7 @@ public:
//void cancelch0();
void setbotleft();
void findfirstpath();
- void fadescreenup();
+ //void cancelch1();
void loadold();
void loadtempcharset();
void showbyte();
@@ -1709,6 +1708,7 @@ public:
void powerlighton();
void savefilewrite();
void printmessage2();
+ //void showallfree();
void loadnews();
void rollem();
void makeworn();
@@ -1808,7 +1808,6 @@ public:
void pickupob();
void error();
void showopbox();
- //void cancelch1();
void clearbeforeload();
void biblequote();
void doload();
@@ -1958,7 +1957,7 @@ public:
void initialmoncols();
void checkforshake();
void usebuttona();
- void showallfree();
+ void fadescreenup();
//void getnextword();
void generalerror();
void actualload();
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index fd2a83ef75..d2d3e4a80a 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -163,4 +163,5 @@
void placesetobject(uint8 index);
void removesetobject();
void removesetobject(uint8 index);
+ void showallfree();