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

wjp wjp at usecode.org
Wed Dec 14 12:48:18 CET 2011


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

Summary:
a87a63c1bd DREAMWEB: Convert execCommand to C++, remove comlist from data blob
e44a79fdd4 DREAMWEB: Convert makeCaps to C++, fix bug in delChar
b466575d9e DREAMWEB: Move more stuff to DreamBase


Commit: a87a63c1bd45c925cc4d85458ccd78c82557cd18
    https://github.com/scummvm/scummvm/commit/a87a63c1bd45c925cc4d85458ccd78c82557cd18
Author: Max Horn (max at quendi.de)
Date: 2011-12-14T03:45:52-08:00

Commit Message:
DREAMWEB: Convert execCommand to C++, remove comlist from data blob

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 03e831f..1ddb900 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -52,6 +52,8 @@ p = parser(skip_binary_data = [
 	'keypadlist',
 	'symbollist',
 	'diarylist',
+	# monitor.asm
+	'comlist',
 	# newplace.asm
 	'destlist',
 	# object.asm
@@ -374,6 +376,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'examinventory',
 	'examineob',
 	'examineobtext',
+	'execcommand',
 	'facerightway',
 	'fadecalculation',
 	'fadedos',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index e8e577e..ef96461 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2731,14 +2731,14 @@ void DreamGenContext::getDestInfo() {
 	push(ax);
 	dx = data;
 	es = dx;
-	si = 1244;
+	si = 1184;
 	_add(si, ax);
 	cl = es.byte(si);
 	ax = pop();
 	push(cx);
 	dx = data;
 	es = dx;
-	si = 1260;
+	si = 1200;
 	_add(si, ax);
 	ax = pop();
 }
@@ -2790,7 +2790,7 @@ clearedlocations:
 	bx = ax;
 	dx = data;
 	es = dx;
-	_add(bx, 1244);
+	_add(bx, 1184);
 	es.byte(bx) = 0;
 }
 
@@ -2821,88 +2821,6 @@ void DreamGenContext::makeCaps() {
 	_sub(al, 32);
 }
 
-void DreamGenContext::execCommand() {
-	STACK_CHECK;
-	es = cs;
-	bx = offset_comlist;
-	ds = cs;
-	si = 1278;
-	al = ds.byte(si);
-	_cmp(al, 0);
-	if (!flags.z())
-		goto notblankinp;
-	scrollMonitor();
-	return;
-notblankinp:
-	cl = 0;
-comloop:
-	push(bx);
-	push(si);
-comloop2:
-	al = ds.byte(si);
-	_add(si, 2);
-	ah = es.byte(bx);
-	_inc(bx);
-	_cmp(ah, 32);
-	if (flags.z())
-		goto foundcom;
-	_cmp(al, ah);
-	if (flags.z())
-		goto comloop2;
-	si = pop();
-	bx = pop();
-	_add(bx, 10);
-	_inc(cl);
-	_cmp(cl, 6);
-	if (!flags.z())
-		goto comloop;
-	netError();
-	al = 0;
-	return;
-foundcom:
-	si = pop();
-	bx = pop();
-	_cmp(cl, 1);
-	if (flags.z())
-		goto testcom;
-	_cmp(cl, 2);
-	if (flags.z())
-		goto directory;
-	_cmp(cl, 3);
-	if (flags.z())
-		goto accesscom;
-	_cmp(cl, 4);
-	if (flags.z())
-		goto signoncom;
-	_cmp(cl, 5);
-	if (flags.z())
-		goto keyscom;
-	goto quitcom;
-directory:
-	dirCom();
-	al = 0;
-	return;
-signoncom:
-	signOn();
-	al = 0;
-	return;
-accesscom:
-	read();
-	al = 0;
-	return;
-keyscom:
-	showKeys();
-	al = 0;
-	return;
-testcom:
-	al = 6;
-	monMessage();
-	al = 0;
-	return;
-quitcom:
-	al = 1;
-}
-
 void DreamGenContext::dirCom() {
 	STACK_CHECK;
 	cx = 30;
@@ -2919,7 +2837,7 @@ dirroot:
 	si = offset_rootdir;
 	_inc(si);
 	es = cs;
-	di = 1120;
+	di = 1060;
 	_inc(di);
 	cx = 12;
 	_movsb(cx, true);
@@ -3021,7 +2939,7 @@ notyetassigned:
 	push(bx);
 	_add(bx, 2);
 	ds = cs;
-	si = 1278;
+	si = 1218;
 checkpass:
 	_lodsw();
 	ah = es.byte(bx);
@@ -3092,7 +3010,7 @@ void DreamGenContext::read() {
 	return;
 okcom:
 	es = cs;
-	di = 1120;
+	di = 1060;
 	ax = data.word(kTextfile1);
 	data.word(kMonsource) = ax;
 	ds = ax;
@@ -3222,7 +3140,7 @@ keyok2:
 	ds = cs;
 	si = offset_operand1+1;
 	es = cs;
-	di = 1120+1;
+	di = 1060+1;
 	cx = 12;
 	_movsb(cx, true);
 	monitorLogo();
@@ -3349,7 +3267,7 @@ void DreamGenContext::parser() {
 	al = '=';
 	_stosb();
 	ds = cs;
-	si = 1278;
+	si = 1218;
 notspace1:
 	_lodsw();
 	_cmp(al, 32);
@@ -4167,7 +4085,7 @@ void DreamGenContext::clearChanges() {
 	di = 0;
 	_stosw(cx, true);
 	es = cs;
-	di = 1244;
+	di = 1184;
 	al = 1;
 	_stosb(2);
 	al = 0;
@@ -4474,51 +4392,51 @@ void DreamGenContext::__start() {
 		//0x0370: ...2 .... ...2 ....
 		0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, 0x00, 0xff, 0x44, 
 		//0x0380: ...2 ...! (..2 ...D
-		0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x45, 0x58, 
-		//0x0390: REAM WEB. V99. ..EX
-		0x49, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x48, 0x45, 0x4c, 0x50, 0x20, 0x20, 0x20, 0x20, 
-		//0x03a0: IT        HELP     
-		0x20, 0x20, 0x4c, 0x49, 0x53, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x52, 0x45, 0x41, 0x44, 
-		//0x03b0:   LI ST        READ
-		0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x47, 0x4f, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 
-		//0x03c0:        LO GON      
-		0x4b, 0x45, 0x59, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 
-		//0x03d0: KEYS        .. PUBL
-		0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 
-		//0x03e0: IC        PUBL IC  
-		0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 
-		//0x03f0:    . ..BL ACKD RAGO
-		0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 
-		//0x0400: N RY AN         ...
-		0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 
-		//0x0410: HEND RIX       LOUI
-		0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 
-		//0x0420: S       . ..SE PTIM
-		0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 
-		//0x0430: US     BE CKET T   
-		0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
-		//0x0440:  ...               
-		0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 
-		//0x0450:  ."R OOT          .
-		0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 
-		//0x0460: "               .00
-		0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 0x42, 0x4a, 0x45, 0x43, 
-		//0x0470: 00.0 0... ..$O BJEC
-		0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
-		//0x0480: T NA ME O NE       
+		0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, 
+		//0x0390: REAM WEB. V99. ....
+		0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 
+		//0x03a0: PUBL IC        PUBL
+		0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 
+		//0x03b0: IC      . ..BL ACKD
+		0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
+		//0x03c0: RAGO N RY AN       
+		0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 
+		//0x03d0:  ... HEND RIX      
+		0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 
+		//0x03e0: LOUI S       . ..SE
+		0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 
+		//0x03f0: PTIM US     BE CKET
+		0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
+		//0x0400: T     ...          
+		0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 
+		//0x0410:       ."R OOT      
+		0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
+		//0x0420:    . "             
+		0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x4f, 
+		//0x0430:  .00 00.0 0... ..$O
+		0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 
+		//0x0440: BJEC T NA ME O NE  
 		0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 
-		//0x0490:                    
-		0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 
-		//0x04a0:    . .... .... ....
-		0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 
-		//0x04b0: .... .... .... D:..
+		//0x0450:                    
+		0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 
+		//0x0460:         . .... ....
+		0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 
+		//0x0470: .... .... .... ....
+		0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+		//0x0480: D:.. .... .... ....
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+		//0x0490: .... .... .... ....
+		0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+		//0x04a0: .... .... .... ....
+		0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 
+		//0x04b0: .... .... .... ....
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		//0x04c0: .... .... .... ....
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		//0x04d0: .... .... .... ....
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		//0x04e0: .... .... .... ....
-		0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		//0x04f0: .... .... .... ....
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		//0x0500: .... .... .... ....
@@ -4528,15 +4446,7 @@ void DreamGenContext::__start() {
 		//0x0520: .... .... .... ....
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 		//0x0530: .... .... .... ....
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-		//0x0540: .... .... .... ....
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-		//0x0550: .... .... .... ....
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-		//0x0560: .... .... .... ....
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 
-		//0x0570: .... .... .... ....
-		0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
+		0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
 	ds.assign(src, src + sizeof(src));
 	dreamweb(); 
 }
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 43f93ee..dc06f1f 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -32,14 +32,13 @@
 
 namespace DreamGen {
 
-static const uint16 offset_money1poke = 0x046e;
-static const uint16 offset_operand1 = 0x0444;
-static const uint16 offset_comlist = 0x039e;
-static const uint16 offset_commandline = 0x047b;
-static const uint16 offset_rootdir = 0x0452;
-static const uint16 offset_money2poke = 0x0473;
+static const uint16 offset_commandline = 0x043f;
+static const uint16 offset_rootdir = 0x0416;
+static const uint16 offset_money2poke = 0x0437;
+static const uint16 offset_operand1 = 0x0408;
+static const uint16 offset_keys = 0x039e;
+static const uint16 offset_money1poke = 0x0432;
 static const uint16 offset_openchangesize = 0x039c;
-static const uint16 offset_keys = 0x03da;
 static const uint16 kStartvars = 0;
 static const uint16 kProgresspoints = 1;
 static const uint16 kWatchon = 2;
@@ -373,15 +372,15 @@ static const uint16 kCurrentsample = 452;
 static const uint16 kRoomssample = 453;
 static const uint16 kReelroutines = 454;
 static const uint16 kBasicsample = 911;
-static const uint16 kCurrentfile = 1120;
-static const uint16 kRoomscango = 1244;
-static const uint16 kRoompics = 1260;
-static const uint16 kOplist = 1275;
-static const uint16 kInputline = 1278;
-static const uint16 kPresslist = 1406;
-static const uint16 kQuitrequested = 1412;
-static const uint16 kSubtitles = 1413;
-static const uint16 kForeignrelease = 1414;
+static const uint16 kCurrentfile = 1060;
+static const uint16 kRoomscango = 1184;
+static const uint16 kRoompics = 1200;
+static const uint16 kOplist = 1215;
+static const uint16 kInputline = 1218;
+static const uint16 kPresslist = 1346;
+static const uint16 kQuitrequested = 1352;
+static const uint16 kSubtitles = 1353;
+static const uint16 kForeignrelease = 1354;
 static const uint16 kBlocktextdat = (0);
 static const uint16 kPersonframes = (0);
 static const uint16 kDebuglevel1 = (0);
@@ -569,7 +568,6 @@ public:
 	void searchForFiles();
 	void getExAd();
 	void initialMonCols();
-	void execCommand();
 	void findPuzText();
 	void swapWithInv();
 	void adjustRight();
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index f016646..dba0d56 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -70,6 +70,7 @@ void DreamGenContext::useMon() {
 	scrollMonitor();
 	data.word(kBufferin) = 0;
 	data.word(kBufferout) = 0;
+	bool stop = false;
 	do {
 		di = data.word(kMonadx);
 		bx = data.word(kMonady);
@@ -80,10 +81,10 @@ void DreamGenContext::useMon() {
 		di = pop();
 		data.word(kMonadx) = di;
 		data.word(kMonady) = bx;
-		execCommand();
+		stop = execCommand();
 		if (quitRequested()) //TODO : Check why it crashes when put before the execcommand
 			break;
-	} while (al == 0);
+	} while (!stop);
 	getRidOfTemp();
 	getRidOfTempCharset();
 	deallocateMem(data.word(kTextfile1));
@@ -97,6 +98,73 @@ void DreamGenContext::useMon() {
 	workToScreenM();
 }
 
+bool DreamGenContext::execCommand() {
+	static const char *comlist[] = {
+		"EXIT",
+		"HELP",
+		"LIST",
+		"READ",
+		"LOGON",
+		"KEYS"
+	};
+
+	const char *inputLine = (const char *)data.ptr(kInputline, 64);
+	if (*inputLine == 0) {
+		// No input
+		scrollMonitor();
+		return false;
+	}
+
+	int cmd;
+	bool done = false;
+	// Loop over all commands in the list and see if we get a match
+	for (cmd = 0; cmd < ARRAYSIZE(comlist); ++cmd) {
+		const char *cmdStr = comlist[cmd];
+		const char *inputStr = inputLine;
+		// Compare the command, char by char, to see if we get a match.
+		// We only care about the prefix matching, though.
+		char inputChar, cmdChar;
+		do {
+			inputChar = *inputStr; inputStr += 2;
+			cmdChar = *cmdStr++;
+			if (cmdChar == 0) {
+				done = true;
+				break;
+			}
+		} while (inputChar == cmdChar);
+
+		if (done)
+			break;
+	}
+
+	// Execute the selected command
+	switch (cmd) {
+	case 0:
+		return true;
+	case 1:
+		monMessage(6);
+		break;
+	case 2:
+		dirCom();
+		break;
+	case 3:
+		read();
+		break;
+	case 4:
+		signOn();
+		break;
+	case 5:
+		showKeys();
+		break;
+	default:
+		netError();
+		break;
+	}
+	return false;
+}
+
+
+
 void DreamGenContext::monitorLogo() {
 	if (data.byte(kLogonum) != data.byte(kOldlogonum)) {
 		data.byte(kOldlogonum) = data.byte(kLogonum);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index a287d57..b3b974a 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -594,5 +594,6 @@
 	void dumpDiaryKeys();
 	void runEndSeq();
 	void lookAtCard();
+	bool execCommand();
 
 #endif


Commit: e44a79fdd49e746947cbb88e3982dc8c89e2ae44
    https://github.com/scummvm/scummvm/commit/e44a79fdd49e746947cbb88e3982dc8c89e2ae44
Author: Max Horn (max at quendi.de)
Date: 2011-12-14T03:46:09-08:00

Commit Message:
DREAMWEB: Convert makeCaps to C++, fix bug in delChar

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.h



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 1ddb900..2a8d0be 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -530,6 +530,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'mainman',
 	'mainscreen',
 	'makebackob',
+	'makecaps',
 	'makeheader',
 	'makemainscreen',
 	'makename',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index 2048f39..a451704 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -52,6 +52,9 @@ public:
 
 public:
 	// from monitor.cpp
+	void input();
+	byte makeCaps(byte c);
+	void delChar();
 	void printOuterMon();
 	void showCurrentFile();
 	void accessLightOn();
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index ef96461..3831f38 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2813,14 +2813,6 @@ emptyinterface:
 	al = 0;
 }
 
-void DreamGenContext::makeCaps() {
-	STACK_CHECK;
-	_cmp(al, 'a');
-	if (flags.c())
-		return /* (notupperc) */;
-	_sub(al, 32);
-}
-
 void DreamGenContext::dirCom() {
 	STACK_CHECK;
 	cx = 30;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index dc06f1f..8d23f97 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -554,7 +554,6 @@ public:
 	void checkInside();
 	void findPathOfPoint();
 	void getDestInfo();
-	void makeCaps();
 	void read();
 	void additionalText();
 	void mugger();
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index dba0d56..5d0987b 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -185,7 +185,7 @@ void DreamBase::printLogo() {
 	showCurrentFile();
 }
 
-void DreamGenContext::input() {
+void DreamBase::input() {
 	char *inputLine = (char *)data.ptr(kInputline, 64);
 	memset(inputLine, 0, 64);
 	data.word(kCurpos) = 0;
@@ -215,9 +215,7 @@ void DreamGenContext::input() {
 			continue;
 		if ((currentKey == 32) && (data.word(kCurpos) == 0))
 			continue;
-		al = currentKey;
-		makeCaps();
-		currentKey = al;
+		currentKey = makeCaps(currentKey);
 		inputLine[data.word(kCurpos) * 2 + 0] = currentKey;
 		if (currentKey > 'Z')
 			continue;
@@ -231,7 +229,18 @@ void DreamGenContext::input() {
 	}
 }
 
-void DreamGenContext::delChar() {
+void DreamGenContext::makeCaps() {
+	al = makeCaps(al);
+}
+
+byte DreamBase::makeCaps(byte c) {
+	// TODO: Replace calls to this by toupper() ?
+	if (c >= 'a')
+		c -= 'a' - 'A'; // = 32
+	return c;
+}
+
+void DreamBase::delChar() {
 	char *inputLine = (char *)data.ptr(kInputline, 0);
 	--data.word(kCurpos);
 	inputLine[data.word(kCurpos) * 2] = 0;
@@ -241,7 +250,7 @@ void DreamGenContext::delChar() {
 	uint16 offset = data.word(kCurpos);
 	offset = ((offset & 0x00ff) << 8) | ((offset & 0xff00) >> 8);
 	multiPut(mapStore() + offset, data.word(kMonadx), data.word(kMonady), 8, 8);
-	multiDump(data.word(kMonadx), data.word(kMonady), al, 8);
+	multiDump(data.word(kMonadx), data.word(kMonady), 8, 8);
 }
 
 void DreamBase::printCurs() {
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index b3b974a..481e784 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -38,7 +38,6 @@
 	void loadTempCharset();
 	void loadTempCharset(const char *fileName);
 	void saveLoad();
-	void delChar();
 	void hangOnCurs(uint16 frameCount);
 	void hangOnCurs();
 	void workToScreen();
@@ -267,7 +266,10 @@
 	void dumpMenu();
 	void useMenu();
 	void useMon();
-	void input();
+	void makeCaps();
+	byte makeCaps(byte c) {
+		return DreamBase::makeCaps(c);
+	}
 	void monPrint();
 	const char *monPrint(const char *string) {
 		return DreamBase::monPrint(string);


Commit: b466575d9e36d1c36e64e2d3cccadfd44e2e6940
    https://github.com/scummvm/scummvm/commit/b466575d9e36d1c36e64e2d3cccadfd44e2e6940
Author: Max Horn (max at quendi.de)
Date: 2011-12-14T03:46:40-08:00

Commit Message:
DREAMWEB: Move more stuff to DreamBase

Changed paths:
    engines/dreamweb/dreambase.h
    engines/dreamweb/monitor.cpp
    engines/dreamweb/stubs.cpp
    engines/dreamweb/stubs.h



diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index a451704..1a730ac 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -55,6 +55,10 @@ public:
 	void input();
 	byte makeCaps(byte c);
 	void delChar();
+	void monMessage(uint8 index);
+	void netError();
+	void monitorLogo();
+	void randomAccess(uint16 count);
 	void printOuterMon();
 	void showCurrentFile();
 	void accessLightOn();
@@ -155,6 +159,21 @@ public:
 	void *getAnyAd(uint8 *value1, uint8 *value2);
 	const uint8 *getTextInFile1(uint16 index);
 	uint8 findNextColon(const uint8 **string);
+	uint16 allocateMem(uint16 paragraphs);
+	void deallocateMem(uint16 segment);
+	uint16 allocateAndLoad(unsigned int size);
+	uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
+	void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd
+	void loadIntoTemp(const char *fileName);
+	void loadIntoTemp2(const char *fileName);
+	void loadIntoTemp3(const char *fileName);
+	void loadTempCharset(const char *fileName);
+	void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize);
+	void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);
+	void sortOutMap();
+	void loadRoomData(const Room &room, bool skipDat);
+	void useTempCharset();
+	void useCharset1();
 
 	// from use.cpp
 	void placeFreeObject(uint8 index);
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp
index 5d0987b..30ba9b8 100644
--- a/engines/dreamweb/monitor.cpp
+++ b/engines/dreamweb/monitor.cpp
@@ -165,7 +165,7 @@ bool DreamGenContext::execCommand() {
 
 
 
-void DreamGenContext::monitorLogo() {
+void DreamBase::monitorLogo() {
 	if (data.byte(kLogonum) != data.byte(kOldlogonum)) {
 		data.byte(kOldlogonum) = data.byte(kLogonum);
 		printLogo();
@@ -283,10 +283,6 @@ void DreamBase::delCurs() {
 	multiDump(x, y, width, height);
 }
 
-void DreamGenContext::hangOnCurs() {
-	hangOnCurs(cx);
-}
-
 void DreamBase::scrollMonitor() {
 	printLogo();
 	printUnderMon();
@@ -318,7 +314,7 @@ void DreamGenContext::randomAccess() {
 	randomAccess(cx);
 }
 
-void DreamGenContext::randomAccess(uint16 count) {
+void DreamBase::randomAccess(uint16 count) {
 	for (uint16 i = 0; i < count; ++i) {
 		vSync();
 		vSync();
@@ -335,7 +331,7 @@ void DreamGenContext::monMessage() {
 	monMessage(al);
 }
 
-void DreamGenContext::monMessage(uint8 index) {
+void DreamBase::monMessage(uint8 index) {
 	assert(index > 0);
 	const char *string = (const char *)getSegment(data.word(kTextfile1)).ptr(kTextstart, 0);
 	for (uint8 i = 0; i < index; ++i) {
@@ -345,7 +341,7 @@ void DreamGenContext::monMessage(uint8 index) {
 	monPrint(string);
 }
 
-void DreamGenContext::netError() {
+void DreamBase::netError() {
 	monMessage(5);
 	scrollMonitor();
 }
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index c365ee4..55e7916 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -744,7 +744,7 @@ uint8 *DreamBase::textUnder() {
 	return getSegment(data.word(kBuffers)).ptr(kTextunder, 0);
 }
 
-uint16 DreamGenContext::standardLoad(const char *fileName, uint16 *outSizeInBytes) {
+uint16 DreamBase::standardLoad(const char *fileName, uint16 *outSizeInBytes) {
 	FileHeader header;
 
 	Common::File file;
@@ -758,7 +758,7 @@ uint16 DreamGenContext::standardLoad(const char *fileName, uint16 *outSizeInByte
 	return result;
 }
 
-void *DreamGenContext::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) {
+void *DreamBase::standardLoadCPP(const char *fileName, uint16 *outSizeInBytes) {
 	uint16 sizeInBytes;
 	uint16 seg = standardLoad(fileName, &sizeInBytes);
 	void *buffer = malloc(sizeInBytes);
@@ -769,28 +769,24 @@ void *DreamGenContext::standardLoadCPP(const char *fileName, uint16 *outSizeInBy
 	return buffer;
 }
 
-void DreamGenContext::loadIntoTemp() {
-	loadIntoTemp((const char *)data.ptr(dx, 0));
-}
-
-void DreamGenContext::loadIntoTemp(const char *fileName) {
+void DreamBase::loadIntoTemp(const char *fileName) {
 	data.word(kTempgraphics) = standardLoad(fileName);
 }
 
-void DreamGenContext::loadIntoTemp2(const char *fileName) {
+void DreamBase::loadIntoTemp2(const char *fileName) {
 	data.word(kTempgraphics2) = standardLoad(fileName);
 }
 
-void DreamGenContext::loadIntoTemp3(const char *fileName) {
+void DreamBase::loadIntoTemp3(const char *fileName) {
 	data.word(kTempgraphics3) = standardLoad(fileName);
 }
 
-void DreamGenContext::loadTempCharset() {
-	loadTempCharset((const char *)data.ptr(dx, 0));
+void DreamBase::loadTempCharset(const char *fileName) {
+	engine->setTempCharset(standardLoadCPP(fileName));
 }
 
-void DreamGenContext::loadTempCharset(const char *fileName) {
-	engine->setTempCharset(standardLoadCPP(fileName));
+void DreamGenContext::hangOnCurs() {
+	hangOnCurs(cx);
 }
 
 void DreamGenContext::hangOnCurs(uint16 frameCount) {
@@ -970,22 +966,25 @@ void DreamGenContext::getTime() {
 	data.byte(kHourcount) = ch;
 }
 
-uint16 DreamGenContext::allocateMem(uint16 paragraphs) {
+uint16 DreamBase::allocateMem(uint16 paragraphs) {
 	uint size = (paragraphs + 2) * 16;
 	debug(1, "allocate mem, %u bytes", size);
-	flags._c = false;
 	SegmentRef seg = allocateSegment(size);
 	uint16 result = (uint16)seg;
 	debug(1, "\tsegment address -> %04x", result);
 	return result;
 }
 
-void DreamGenContext::deallocateMem(uint16 segment) {
+void DreamBase::deallocateMem(uint16 segment) {
 	debug(1, "deallocating segment %04x", segment);
 	deallocateSegment(segment);
 
-	//fixing invalid entries in the sprite table
-	es = data;
+
+	// FIXME: The following line used to be enabled with the comment: "fixing
+	// invalid entries in the sprite table"
+	// So if there are regressions with sprites, we may want to investigate this
+	// closer.
+//	es = data;
 	uint tsize = 16 * 32;
 	uint16 bseg = data.word(kBuffers);
 	if (!bseg)
@@ -1075,21 +1074,21 @@ void DreamGenContext::makeBackOb(SetObject *objData) {
 	sprite->animFrame = 0;
 }
 
-uint16 DreamGenContext::allocateAndLoad(unsigned int size) {
+uint16 DreamBase::allocateAndLoad(unsigned int size) {
 	// allocatemem adds 32 bytes, so it doesn't matter that size/16 rounds down
 	uint16 result = allocateMem(size / 16);
 	engine->readFromFile(getSegment(result).ptr(0, size), size);
 	return result;
 }
 
-void DreamGenContext::clearAndLoad(uint8 *buf, uint8 c,
+void DreamBase::clearAndLoad(uint8 *buf, uint8 c,
                                    unsigned int size, unsigned int maxSize) {
 	assert(size <= maxSize);
 	memset(buf, c, maxSize);
 	engine->readFromFile(buf, size);
 }
 
-void DreamGenContext::clearAndLoad(uint16 seg, uint8 c,
+void DreamBase::clearAndLoad(uint16 seg, uint8 c,
                                    unsigned int size, unsigned int maxSize) {
 	assert(size <= maxSize);
 	uint8 *buf = getSegment(seg).ptr(0, maxSize);
@@ -2027,7 +2026,7 @@ void DreamGenContext::zoomOnOff() {
 	workToScreenM();
 }
 
-void DreamGenContext::sortOutMap() {
+void DreamBase::sortOutMap() {
 	const uint8 *src = workspace();
 	uint8 *dst = (uint8 *)getSegment(data.word(kMapdata)).ptr(0, 0);
 	for (uint16 y = 0; y < kMaplength; ++y) {
@@ -2262,11 +2261,11 @@ void DreamGenContext::doLook() {
 	workToScreenM();
 }
 
-void DreamGenContext::useCharset1() {
+void DreamBase::useCharset1() {
 	engine->setCurrentCharset((Frame *)getSegment(data.word(kCharset1)).ptr(0, 0));
 }
 
-void DreamGenContext::useTempCharset() {
+void DreamBase::useTempCharset() {
 	engine->setCurrentCharset(engine->tempCharset());
 }
 
@@ -2310,7 +2309,7 @@ void DreamGenContext::getRidOfAll() {
 }
 
 // if skipDat, skip clearing and loading Setdat and Freedat
-void DreamGenContext::loadRoomData(const Room &room, bool skipDat) {
+void DreamBase::loadRoomData(const Room &room, bool skipDat) {
 	engine->openFile(room.name);
 
 	FileHeader header;
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 481e784..089272b 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -27,16 +27,6 @@
 	void startup1();
 	void switchRyanOn();
 	void switchRyanOff();
-	uint16 allocateMem(uint16 paragraphs);
-	void deallocateMem(uint16 segment);
-	uint16 standardLoad(const char *fileName, uint16 *outSizeInBytes = NULL); // Returns a segment handle which needs to be freed with deallocatemem for symmetry
-	void *standardLoadCPP(const char *fileName, uint16 *outSizeInBytes = NULL); // And this one should be 'free'd
-	void loadIntoTemp();
-	void loadIntoTemp(const char *fileName);
-	void loadIntoTemp2(const char *fileName);
-	void loadIntoTemp3(const char *fileName);
-	void loadTempCharset();
-	void loadTempCharset(const char *fileName);
 	void saveLoad();
 	void hangOnCurs(uint16 frameCount);
 	void hangOnCurs();
@@ -236,7 +226,6 @@
 	void getBlockOfPixel();
 	uint8 getBlockOfPixel(uint8 x, uint8 y);
 	void examineObText();
-	void sortOutMap();
 	void showCity();
 	uint16 getPersFrame(uint8 index);
 	void convIcons();
@@ -274,11 +263,14 @@
 	const char *monPrint(const char *string) {
 		return DreamBase::monPrint(string);
 	}
-	void randomAccess(uint16 count);
 	void randomAccess();
-	void monMessage(uint8 index);
+	void randomAccess(uint16 count) {
+		DreamBase::randomAccess(count);
+	}
 	void monMessage();
-	void netError();
+	void monMessage(uint8 index) {
+		DreamBase::monMessage(index);
+	}
 	void playChannel1();
 	void playChannel1(uint8 index) {
 		DreamBase::playChannel1(index);
@@ -291,8 +283,6 @@
 	void look();
 	void autoLook();
 	void doLook();
-	void useTempCharset();
-	void useCharset1();
 	void getBackFromOb();
 	void getRidOfAll();
 	void getRidOfTemp();
@@ -307,10 +297,6 @@
 	void actualLoad();
 	void loadPosition(unsigned int slot);
 	void savePosition(unsigned int slot, const char *descbuf);
-	uint16 allocateAndLoad(unsigned int size);
-	void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize);
-	void clearAndLoad(uint16 seg, uint8 c, unsigned int size, unsigned int maxSize);
-	void loadRoomData(const Room &room, bool skipDat);
 	void restoreAll();
 	void restoreReels();
 	void enterSymbol();
@@ -570,7 +556,6 @@
 	void hangOnPQ();
 	void showGun();
 	void endGame();
-	void monitorLogo();
 	void quitSymbol();
 	void diaryKeyP();
 	void diaryKeyN();






More information about the Scummvm-git-logs mailing list