aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb
diff options
context:
space:
mode:
authorFilippos Karapetis2011-12-26 17:49:42 +0200
committerFilippos Karapetis2011-12-26 17:50:48 +0200
commit4106ae7d2dcb38895385f5125bd8ff152023565e (patch)
tree31ae4bb2f0c855b097569493080f9ff16aac3951 /engines/dreamweb
parent2e517cc9ec65a535d580fee607b9b920e41a3019 (diff)
downloadscummvm-rg350-4106ae7d2dcb38895385f5125bd8ff152023565e.tar.gz
scummvm-rg350-4106ae7d2dcb38895385f5125bd8ff152023565e.tar.bz2
scummvm-rg350-4106ae7d2dcb38895385f5125bd8ff152023565e.zip
DREAMWEB: Port 'dircom' to C++, move rootdir out of the data blob and fix a regression in searchForFiles()
Diffstat (limited to 'engines/dreamweb')
-rw-r--r--engines/dreamweb/dreamgen.cpp63
-rw-r--r--engines/dreamweb/dreamgen.h12
-rw-r--r--engines/dreamweb/monitor.cpp31
-rw-r--r--engines/dreamweb/stubs.h3
4 files changed, 48 insertions, 61 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 77af051122..0004c4fa3b 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -142,39 +142,6 @@ void DreamGenContext::transferConToEx() {
ds.byte(si+2) = 255;
}
-void DreamGenContext::dirCom() {
- STACK_CHECK;
- cx = 30;
- randomAccess();
- parser();
- _cmp(es.byte(di+1), 0);
- if (flags.z())
- goto dirroot;
- dirFile();
- return;
-dirroot:
- data.byte(kLogonum) = 0;
- ds = cs;
- si = offset_rootdir;
- _inc(si);
- es = cs;
- di = 436;
- _inc(di);
- cx = 12;
- _movsb(cx, true);
- monitorLogo();
- scrollMonitor();
- al = 9;
- monMessage();
- es = data.word(kTextfile1);
- searchForFiles();
- es = data.word(kTextfile2);
- searchForFiles();
- es = data.word(kTextfile3);
- searchForFiles();
- scrollMonitor();
-}
-
void DreamGenContext::read() {
STACK_CHECK;
cx = 40;
@@ -187,7 +154,7 @@ void DreamGenContext::read() {
return;
okcom:
es = cs;
- di = 436;
+ di = 422;
ax = data.word(kTextfile1);
data.word(kMonsource) = ax;
ds = ax;
@@ -317,7 +284,7 @@ keyok2:
ds = cs;
si = offset_operand1+1;
es = cs;
- di = 436+1;
+ di = 422+1;
cx = 12;
_movsb(cx, true);
monitorLogo();
@@ -399,7 +366,7 @@ void DreamGenContext::parser() {
al = '=';
_stosb();
ds = cs;
- si = 511;
+ si = 497;
notspace1:
_lodsw();
_cmp(al, 32);
@@ -481,16 +448,16 @@ void DreamGenContext::__start() {
//0x0180: .... .... ...D REAM
0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0190: WEB. V99.
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x01a0: ."R OOT
- 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- //0x01b0: . "
- 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01,
- //0x01c0: ... ..$. .... ....
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44,
- //0x01d0: .... .... .... ...D
- 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x01e0: :... .... .... ....
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ //0x01a0: ."
+ 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10,
+ //0x01b0: . .... $... ....
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ //0x01c0: .... .... .... ....
+ 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ //0x01d0: .D:. .... .... ....
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ //0x01e0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x01f0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -507,9 +474,7 @@ void DreamGenContext::__start() {
//0x0250: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0260: .... .... .... ....
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- //0x0270: .... .... .... ....
- 0x00, 0x00, };
+ 0x00, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src));
dreamweb();
}
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index d3bb80da1a..82550fe4ce 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -32,7 +32,6 @@
namespace DreamGen {
-static const uint16 offset_rootdir = 0x01a6;
static const uint16 offset_operand1 = 0x0198;
static const uint16 kStartvars = 0;
static const uint16 kProgresspoints = 1;
@@ -321,11 +320,11 @@ static const uint16 kSoundbufferwrite = 391;
static const uint16 kCurrentsample = 393;
static const uint16 kRoomssample = 394;
static const uint16 kBasicsample = 395;
-static const uint16 kCurrentfile = 436;
-static const uint16 kInputline = 511;
-static const uint16 kQuitrequested = 639;
-static const uint16 kSubtitles = 640;
-static const uint16 kForeignrelease = 641;
+static const uint16 kCurrentfile = 422;
+static const uint16 kInputline = 497;
+static const uint16 kQuitrequested = 625;
+static const uint16 kSubtitles = 626;
+static const uint16 kForeignrelease = 627;
static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0);
@@ -427,7 +426,6 @@ public:
void __start();
#include "stubs.h" // Allow hand-reversed functions to have a signature different than void f()
- void dirCom();
void dirFile();
void pickupConts();
void transferMap();
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 81c0f7e168..e586999129 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -456,6 +456,25 @@ void DreamGenContext::getKeyAndLogo() {
}
}
+void DreamGenContext::dirCom() {
+ randomAccess(30);
+ parser();
+ if (es.byte(di + 1)) {
+ dirFile();
+ return;
+ }
+
+ data.byte(kLogonum) = 0;
+ memcpy(data.ptr(kCurrentfile+1, 0), "ROOT ", 12);
+ monitorLogo();
+ scrollMonitor();
+ monMessage(9);
+ searchForFiles(data.word(kTextfile1));
+ searchForFiles(data.word(kTextfile2));
+ searchForFiles(data.word(kTextfile3));
+ scrollMonitor();
+}
+
void DreamGenContext::signOn() {
parser();
@@ -514,17 +533,21 @@ void DreamGenContext::signOn() {
}
}
-void DreamGenContext::searchForFiles() {
+void DreamGenContext::searchForFiles(uint16 segment) {
uint16 offset = kTextstart;
byte curChar;
while (true) {
- curChar = es.byte(offset);
+ curChar = getSegment(segment).byte(offset);
offset++;
if (curChar == '*')
return; // "endofdir"
- if (curChar == 34)
- monPrint();
+ if (curChar == 34) {
+ uint16 originalOffset = offset;
+ const char *string = (const char *)getSegment(segment).ptr(offset, 0);
+ const char *nextString = monPrint(string);
+ offset = originalOffset + (nextString - string);
+ }
}
}
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 9ab025fb3e..14b8accea0 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -134,7 +134,8 @@
void outOfOpen();
void swapWithOpen();
void swapWithInv();
- void searchForFiles();
+ void searchForFiles(uint16 segment);
byte transferToEx();
+ void dirCom();
#endif