[Scummvm-cvs-logs] scummvm master -> b08804f360d7561ca1014445aa7eeb257297f8ed

wjp wjp at usecode.org
Mon Dec 26 20:47:18 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b08804f360 DREAMWEB: Convert 'parser'


Commit: b08804f360d7561ca1014445aa7eeb257297f8ed
    https://github.com/scummvm/scummvm/commit/b08804f360d7561ca1014445aa7eeb257297f8ed
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-26T11:46:37-08:00

Commit Message:
DREAMWEB: Convert 'parser'

Changed paths:
    devtools/tasmrecover/tasm-recover
    engines/dreamweb/dreambase.h
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/dreamgen.h
    engines/dreamweb/monitor.cpp
    engines/dreamweb/stubs.cpp
    engines/dreamweb/stubs.h



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 0126425..e7b3128 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -718,6 +718,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'panelicons1',
 	'paneltomap',
 	'parseblaster',
+	'parser',
 	'personnametext',
 	'pickupconts',
 	'pickupob',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 3fe00ad..0ee14bb 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -177,6 +177,7 @@ public:
 	void loadNews();
 	void loadCart();
 	void showKeys();
+	const char *parser();
 
 	// from newplace.cpp
 	void getUnderCentre();
@@ -590,6 +591,7 @@ public:
 	void errorMessage1();
 	void errorMessage2();
 	void errorMessage3();
+	void decide();
 
 	// from talk.cpp
 	void talk();
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index b44efe9..13067db 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -148,45 +148,6 @@ notfound:
 	al = 1;
 }
 
-void DreamGenContext::parser() {
-	STACK_CHECK;
-	es = cs;
-	di = offset_operand1;
-	cx = 13;
-	al = 0;
-	_stosb(cx, true);
-	di = offset_operand1;
-	al = '=';
-	_stosb();
-	ds = cs;
-	si = 483;
-notspace1:
-	_lodsw();
-	_cmp(al, 32);
-	if (flags.z())
-		goto stillspace1;
-	_cmp(al, 0);
-	if (!flags.z())
-		goto notspace1;
-	goto finishpars;
-stillspace1:
-	_lodsw();
-	_cmp(al, 32);
-	if (flags.z())
-		goto stillspace1;
-copyin1:
-	_stosb();
-	_lodsw();
-	_cmp(al, 0);
-	if (flags.z())
-		goto finishpars;
-	_cmp(al, 32);
-	if (!flags.z())
-		goto copyin1;
-finishpars:
-	di = offset_operand1;
-}
-
 void DreamGenContext::__start() { 
 	static const uint8 src[] = {
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 6ec1946..6d2e2eb 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -419,7 +419,6 @@ public:
 	void dirFile();
 	void dreamweb();
 	void searchForString();
-	void parser();
 };
 
 } // End of namespace DreamGen
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 953d1cb..3b9b96e 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -458,8 +458,11 @@ void DreamGenContext::getKeyAndLogo() {
 
 void DreamGenContext::dirCom() {
 	randomAccess(30);
-	parser();
-	if (es.byte(di + 1)) {
+
+	const char *dirname = parser();
+	if (dirname[1]) {
+		es = cs;
+		di = offset_operand1; // cs:operand1 == dirname
 		dirFile();
 		return;
 	}
@@ -479,8 +482,8 @@ void DreamGenContext::read() {
 	bool foundFile = false;
 
 	randomAccess(40);
-	parser();
-	if (es.byte(di+1) == 0) {
+	const char *name = parser();
+	if (name[1] == 0) {
 		netError();
 		return;
 	}
@@ -552,10 +555,10 @@ void DreamGenContext::read() {
 }
 
 void DreamGenContext::signOn() {
-	parser();
+	const char *name = parser();
 
 	int8 foundIndex = -1;
-	Common::String inputLine = (const char *)data.ptr(offset_operand1 + 1, 0);
+	Common::String inputLine = name + 1;
 	inputLine.trim();
 
 	for (byte i = 0; i < 4; i++) {
@@ -623,4 +626,44 @@ void DreamGenContext::searchForFiles(uint16 segment) {
 	}
 }
 
+const char *DreamBase::parser() {
+	char *output = (char *)data.ptr(offset_operand1, 13);
+
+	memset(output, 0, 13);
+
+	char *p = output;
+	*p++ = '=';
+
+	const char *in = (const char *)data.ptr(kInputline, 0);
+
+	uint8 c;
+
+	// skip command
+	do {
+		c = *in++;
+		in++;
+
+		if (!c)
+			return output;
+	} while (c != 32);
+
+	// skip spaces between command and operand
+	do {
+		c = *in++;
+		in++;
+	} while (c == 32);
+
+	// copy first operand
+	do {
+		*p++ = c;
+		c = *in++;
+		in++;
+		if (!c)
+			return output;
+	} while (c != 32);
+
+	return output;
+}
+
+
 } // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 55e6110..ca98337 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -3101,7 +3101,7 @@ void DreamGenContext::madmanRun() {
 }
 
 
-void DreamGenContext::decide() {
+void DreamBase::decide() {
 	setMode();
 	loadPalFromIFF();
 	clearPalette();
@@ -3118,10 +3118,10 @@ void DreamGenContext::decide() {
 	fadeScreenUp();
 	data.byte(kGetback) = 0;
 
-	RectWithCallback<DreamGenContext> decideList[] = {
+	RectWithCallback<DreamBase> decideList[] = {
 		{ kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamBase::newGame },
 		{ kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn },
-		{ kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadOld },
+		{ kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamBase::loadOld },
 		{ 0,320,0,200,&DreamBase::blank },
 		{ 0xFFFF,0,0,0,0 }
 	};
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index bda2be6..7fa403b 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -107,7 +107,6 @@
 	void allPointer();
 	void afterNewRoom();
 	void madmanRun();
-	void decide();
 	void showGun();
 	void triggerMessage(uint16 index);
 	void processTrigger();






More information about the Scummvm-git-logs mailing list