From e10d2bffa07221601fd8414a1e7e12904cea19ad Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 27 Dec 2011 01:37:16 +0100 Subject: DREAMWEB: Move operand1, currentfile out of data --- devtools/tasmrecover/tasm-recover | 4 +++- engines/dreamweb/dreambase.h | 2 ++ engines/dreamweb/dreamgen.cpp | 20 ++++++++------------ engines/dreamweb/dreamgen.h | 9 +++------ engines/dreamweb/monitor.cpp | 30 +++++++++++++++--------------- 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index ac818c46e9..2ab3dd62a6 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -63,6 +63,8 @@ p = parser(skip_binary_data = [ 'comlist', 'keys', 'rootdir', + 'operand1', + 'currentfile', # newplace.asm 'destlist', # object.asm @@ -406,6 +408,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'diarykeyp', 'diarykeyn', 'dircom', + 'dirfile', 'disablepath', 'disablesoundint', 'discops', @@ -1028,7 +1031,6 @@ generator = cpp(context, "DreamGen", blacklist = [ 'zoomonoff', ], skip_output = [ # These functions are processed but not output - 'dirfile', 'dreamweb', ], skip_dispatch_call = True, skip_addr_constants = True, header_omit_blacklisted = True, diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 340ecbb390..e22a2777d9 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -66,6 +66,8 @@ protected: // from monitor.cpp char _inputLine[64]; + char _operand1[14]; + char _currentFile[14]; // from newplace.cpp uint8 _roomsCanGo[16]; diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 1f8d25fef6..28d196bdbb 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -77,19 +77,15 @@ void DreamGenContext::__start() { //0x0160: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, //0x0170: .... .... ...D REAM - 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0180: WEB. V99. - 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0190: ." - 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, - //0x01a0: . .... $... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - //0x01b0: .... .... .... .... - 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x01c0: .D:. .... .... .... + 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, + //0x0180: WEB. V99. .... $... + 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, + //0x0190: .... .... .... .... + 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x01a0: .... .D:. .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x01d0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, }; + //0x01b0: .... .... .... .... + 0x00, 0x00, 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 a5d504bdc5..629dde26a2 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,7 +32,6 @@ namespace DreamGen { -static const uint16 offset_operand1 = 0x0188; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -309,10 +308,9 @@ static const uint16 kCh1blockstocopy = 375; static const uint16 kCurrentsample = 377; static const uint16 kRoomssample = 378; static const uint16 kBasicsample = 379; -static const uint16 kCurrentfile = 406; -static const uint16 kQuitrequested = 481; -static const uint16 kSubtitles = 482; -static const uint16 kForeignrelease = 483; +static const uint16 kQuitrequested = 453; +static const uint16 kSubtitles = 454; +static const uint16 kForeignrelease = 455; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -414,7 +412,6 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() - void dirFile(); void dreamweb(); }; diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 3d66a49420..eb6d876ca4 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -40,8 +40,9 @@ static MonitorKeyEntry monitorKeyEntries[4] = { void DreamBase::useMon() { data.byte(kLasttrigger) = 0; - memset(data.ptr(kCurrentfile+1, 0), ' ', 12); - memset(data.ptr(offset_operand1+1, 0), ' ', 12); + _currentFile[0] = 34; + memset(_currentFile+1, ' ', 12); + _currentFile[13] = 0; monitorKeyEntries[0].keyAssigned = 1; monitorKeyEntries[1].keyAssigned = 0; @@ -290,7 +291,7 @@ void DreamBase::scrollMonitor() { void DreamBase::showCurrentFile() { uint16 x = 178; // TODO: Looks like this hardcoded constant in the asm doesn't match the frame - const char *currentFile = (const char *)data.ptr(kCurrentfile+1, 0); + const char *currentFile = _currentFile + 1; while (*currentFile) { char c = *currentFile++; c = engine->modifyChar(c); @@ -474,7 +475,7 @@ void DreamBase::dirCom() { } data.byte(kLogonum) = 0; - memcpy(data.ptr(kCurrentfile+1, 0), "ROOT ", 12); + memcpy(_currentFile+1, "ROOT ", 12); monitorLogo(); scrollMonitor(); monMessage(9); @@ -485,9 +486,9 @@ void DreamBase::dirCom() { } void DreamBase::dirFile(const char *dirName) { - char topic[13]; + char topic[14]; - memcpy(topic, dirName, 13); + memcpy(topic, dirName, 14); topic[0] = 34; const char *text = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0); @@ -511,7 +512,7 @@ void DreamBase::dirFile(const char *dirName) { } // "keyok2" - memcpy(data.ptr(kCurrentfile+1, 0), dirName+1, 12); + memcpy(_currentFile+1, dirName+1, 12); monitorLogo(); scrollMonitor(); monMessage(10); @@ -537,7 +538,7 @@ void DreamBase::read() { return; } - const char *topic = (const char*)data.ptr(kCurrentfile, 0); + const char *topic = _currentFile; const char *text = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0); const char *found = searchForString(topic, text); @@ -658,12 +659,11 @@ void DreamBase::searchForFiles(uint16 segment) { } const char *DreamBase::parser() { - char *output = (char *)data.ptr(offset_operand1, 13); + char *output = _operand1; - memset(output, 0, 13); + memset(output, 0, 14); - char *p = output; - *p++ = '='; + *output++ = '='; const char *in = _inputLine; @@ -686,14 +686,14 @@ const char *DreamBase::parser() { // copy first operand do { - *p++ = c; + *output++ = c; c = *in++; in++; if (!c) - return output; + return _operand1; } while (c != 32); - return output; + return _operand1; } } // End of namespace DreamGen -- cgit v1.2.3