[Scummvm-cvs-logs] scummvm master -> e10d2bffa07221601fd8414a1e7e12904cea19ad
wjp
wjp at usecode.org
Tue Dec 27 01:37:55 CET 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2bbc1cbd6a DREAMWEB: Clean up monitor functions
e10d2bffa0 DREAMWEB: Move operand1, currentfile out of data
Commit: 2bbc1cbd6ae367eb2e36813fd8617b2c1751585c
https://github.com/scummvm/scummvm/commit/2bbc1cbd6ae367eb2e36813fd8617b2c1751585c
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-26T16:37:35-08:00
Commit Message:
DREAMWEB: Clean up monitor functions
Changed paths:
engines/dreamweb/dreambase.h
engines/dreamweb/monitor.cpp
engines/dreamweb/print.cpp
engines/dreamweb/stubs.h
engines/dreamweb/use.cpp
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index d9b77c1..340ecbb 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -182,6 +182,12 @@ public:
void showKeys();
const char *parser();
const char *searchForString(const char *topic, const char *text);
+ const char *getKeyAndLogo(const char *foundString);
+ void read();
+ void dirFile(const char *dirName);
+ void dirCom();
+ void useMon();
+ bool execCommand();
// from newplace.cpp
void getUnderCentre();
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index eca0ff5..3d66a49 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -38,7 +38,7 @@ static MonitorKeyEntry monitorKeyEntries[4] = {
{ 0, "BECKETT", "SEPTIMUS" }
};
-void DreamGenContext::useMon() {
+void DreamBase::useMon() {
data.byte(kLasttrigger) = 0;
memset(data.ptr(kCurrentfile+1, 0), ' ', 12);
memset(data.ptr(offset_operand1+1, 0), ' ', 12);
@@ -101,7 +101,7 @@ void DreamGenContext::useMon() {
workToScreenM();
}
-bool DreamGenContext::execCommand() {
+bool DreamBase::execCommand() {
static const char *comlist[] = {
"EXIT",
"HELP",
@@ -232,10 +232,6 @@ void DreamBase::input() {
}
}
-void DreamGenContext::makeCaps() {
- al = makeCaps(al);
-}
-
byte DreamBase::makeCaps(byte c) {
// TODO: Replace calls to this by toupper() ?
if (c >= 'a')
@@ -312,10 +308,6 @@ void DreamBase::accessLightOff() {
multiDump(74, 182, 12, 8);
}
-void DreamGenContext::randomAccess() {
- randomAccess(cx);
-}
-
void DreamBase::randomAccess(uint16 count) {
for (uint16 i = 0; i < count; ++i) {
vSync();
@@ -329,10 +321,6 @@ void DreamBase::randomAccess(uint16 count) {
accessLightOff();
}
-void DreamGenContext::monMessage() {
- monMessage(al);
-}
-
void DreamBase::monMessage(uint8 index) {
assert(index > 0);
const char *string = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0);
@@ -436,19 +424,19 @@ void DreamBase::showKeys() {
scrollMonitor();
}
-bool DreamGenContext::getKeyAndLogo(const char *foundString) {
+const char *DreamBase::getKeyAndLogo(const char *foundString) {
byte newLogo = foundString[1] - 48;
byte keyNum = foundString[3] - 48;
if (monitorKeyEntries[keyNum].keyAssigned == 1) {
// Key OK
data.byte(kLogonum) = newLogo;
- return true;
+ return foundString + 4;
} else {
monMessage(12); // "Access denied, key required -"
monPrint(monitorKeyEntries[keyNum].username);
scrollMonitor();
- return false;
+ return 0;
}
}
@@ -476,14 +464,12 @@ const char *DreamBase::searchForString(const char *topic, const char *text) {
}
}
-void DreamGenContext::dirCom() {
+void DreamBase::dirCom() {
randomAccess(30);
const char *dirname = parser();
if (dirname[1]) {
- es = cs;
- di = offset_operand1; // cs:operand1 == dirname
- dirFile();
+ dirFile(dirname);
return;
}
@@ -498,10 +484,11 @@ void DreamGenContext::dirCom() {
scrollMonitor();
}
-void DreamGenContext::dirFile() {
- es.byte(di) = 34;
+void DreamBase::dirFile(const char *dirName) {
+ char topic[13];
- const char *topic = (const char*)es.ptr(di, 0);
+ memcpy(topic, dirName, 13);
+ topic[0] = 34;
const char *text = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0);
const char *found = searchForString(topic, text);
@@ -515,25 +502,22 @@ void DreamGenContext::dirFile() {
}
if (found) {
- if (!getKeyAndLogo(found))
- return;
+ found = getKeyAndLogo(found);
+ if (!found)
+ return; // not logged in
} else {
monMessage(7);
return;
}
// "keyok2"
- memcpy(data.ptr(kCurrentfile+1, 0), data.ptr(offset_operand1+1, 0), 12);
+ memcpy(data.ptr(kCurrentfile+1, 0), dirName+1, 12);
monitorLogo();
scrollMonitor();
monMessage(10);
- byte curChar;
- found += 4; // originally adjusted in getKeyAndLogo()
-
while (true) {
- curChar = found[0];
- found++;
+ byte curChar = *found++;
if (curChar == 34 || curChar == '*') {
// "endofdir2"
scrollMonitor();
@@ -545,7 +529,7 @@ void DreamGenContext::dirFile() {
}
}
-void DreamGenContext::read() {
+void DreamBase::read() {
randomAccess(40);
const char *name = parser();
if (name[1] == 0) {
@@ -553,7 +537,7 @@ void DreamGenContext::read() {
return;
}
- const char *topic = (const char*)cs.ptr(kCurrentfile, 0);
+ const char *topic = (const char*)data.ptr(kCurrentfile, 0);
const char *text = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0);
const char *found = searchForString(topic, text);
@@ -575,8 +559,7 @@ void DreamGenContext::read() {
}
// "keyok1"
- topic = (const char*)cs.ptr(offset_operand1, 0);
- found = searchForString(topic, found);
+ found = searchForString(name, found);
if (!found) {
data.byte(kLogonum) = data.byte(kOldlogonum);
monMessage(11);
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index 6cb2541..7edf444 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -204,13 +204,6 @@ uint16 DreamBase::waitFrames() {
return data.word(kMousebutton);
}
-void DreamGenContext::monPrint() {
- uint16 originalBx = bx;
- const char *string = (const char *)es.ptr(bx, 0);
- const char *nextString = monPrint(string);
- bx = originalBx + (nextString - string);
-}
-
const char *DreamBase::monPrint(const char *string) {
data.byte(kKerning) = 1;
uint16 x = data.word(kMonadx);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 79b708d..ea3c171 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -57,23 +57,6 @@
void useRoutine();
void examineOb(bool examineAgain = true);
void readSetData();
- void useMon();
- void makeCaps();
- byte makeCaps(byte c) {
- return DreamBase::makeCaps(c);
- }
- void monPrint();
- const char *monPrint(const char *string) {
- return DreamBase::monPrint(string);
- }
- void randomAccess();
- void randomAccess(uint16 count) {
- DreamBase::randomAccess(count);
- }
- void monMessage();
- void monMessage(uint8 index) {
- DreamBase::monMessage(index);
- }
void look();
void autoLook();
void doLook();
@@ -87,14 +70,7 @@
void afterNewRoom();
void madmanRun();
void showGun();
- bool execCommand();
void identifyOb();
void selectOb();
- bool getKeyAndLogo(const char *foundString);
- void read();
- void dirCom();
- const char *searchForString(const char *topic, const char *text) {
- return DreamBase::searchForString(topic, text);
- }
#endif
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 25ed8d5..3e38215 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -25,7 +25,7 @@
namespace DreamGen {
-typedef void (DreamGenContext::*UseCallback)(void);
+typedef void (DreamBase::*UseCallback)(void);
// Note: The callback pointer has been placed before the
// ID to keep MSVC happy (otherwise, it throws warnings
@@ -38,7 +38,7 @@ struct UseListEntry {
void DreamGenContext::useRoutine() {
static const UseListEntry kUseList[] = {
- { &DreamGenContext::useMon, "NETW" },
+ { &DreamBase::useMon, "NETW" },
{ &DreamBase::useElevator1, "ELVA" },
{ &DreamBase::useElevator2, "ELVB" },
{ &DreamBase::useElevator3, "ELVC" },
Commit: e10d2bffa07221601fd8414a1e7e12904cea19ad
https://github.com/scummvm/scummvm/commit/e10d2bffa07221601fd8414a1e7e12904cea19ad
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-26T16:37:35-08:00
Commit Message:
DREAMWEB: Move operand1, currentfile out of data
Changed paths:
devtools/tasmrecover/tasm-recover
engines/dreamweb/dreambase.h
engines/dreamweb/dreamgen.cpp
engines/dreamweb/dreamgen.h
engines/dreamweb/monitor.cpp
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index ac818c4..2ab3dd6 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 340ecbb..e22a277 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 1f8d25f..28d196b 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 a5d504b..629dde2 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 3d66a49..eb6d876 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
More information about the Scummvm-git-logs
mailing list