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

wjp wjp at usecode.org
Mon Nov 14 21:45:20 CET 2011


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

Summary:
ceb36fe0d6 DREAMWEB: Move 'examineob' from dreamgen
ae2c4bcaf0 DREAMWEB: Convert 'examineob'
65e1eeb990 DREAMWEB: Move 'inventory' from dreamgen
d3a84d6e68 DREAMWEB: Convert 'inventory'
36278dccde DREAMWEB: Move 'mainscreen' from dreamgen
e254e54929 DREAMWEB: Convert 'mainscreen'
b53a299790 DREAMWEB: Unhardcode checkcoords tables


Commit: ceb36fe0d634f38200dad4e18b5c74464d3a0a13
    https://github.com/scummvm/scummvm/commit/ceb36fe0d634f38200dad4e18b5c74464d3a0a13
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-14T12:43:35-08:00

Commit Message:
DREAMWEB: Move 'examineob' from dreamgen

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index b834017..02d1aaf 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -205,6 +205,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'wornerror',
 	'getpersframe',
 	'convicons',
+	'examineob'
 	], skip_output = [
 	# These functions are processed but not output
 	'dreamweb',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 5b869d4..d9a2f7a 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -3851,81 +3851,6 @@ findopen2a:
 		goto findopen1a;
 }
 
-void DreamGenContext::examineob() {
-	STACK_CHECK;
-	data.byte(kPointermode) = 0;
-	data.word(kTimecount) = 0;
-examineagain:
-	data.byte(kInmaparea) = 0;
-	data.byte(kExamagain) = 0;
-	data.byte(kOpenedob) = 255;
-	data.byte(kOpenedtype) = 255;
-	data.byte(kInvopen) = 0;
-	al = data.byte(kCommandtype);
-	data.byte(kObjecttype) = al;
-	data.byte(kItemframe) = 0;
-	data.byte(kPointerframe) = 0;
-	createpanel();
-	showpanel();
-	showman();
-	showexit();
-	obicons();
-	obpicture();
-	describeob();
-	undertextline();
-	data.byte(kCommandtype) = 255;
-	readmouse();
-	showpointer();
-	worktoscreen();
-	delpointer();
-waitexam:
-	readmouse();
-	showpointer();
-	vsync();
-	dumppointer();
-	dumptextline();
-	delpointer();
-	data.byte(kGetback) = 0;
-	bx = offset_examlist;
-	_cmp(data.byte(kInvopen), 0);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_invlist1;
-	_cmp(data.byte(kInvopen), 1);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_withlist1;
-notuseinv:
-	checkcoords();
-	_cmp(data.byte(kQuitrequested),  0);
-	if (!flags.z())
-		goto stopwaiting;
-	_cmp(data.byte(kExamagain), 0);
-	if (flags.z())
-		goto norex;
-	goto examineagain;
-norex:
-	_cmp(data.byte(kGetback), 0);
-	if (flags.z())
-		goto waitexam;
-stopwaiting:
-	data.byte(kPickup) = 0;
-	_cmp(data.word(kWatchingtime), 0);
-	if (!flags.z())
-		goto iswatching;
-	_cmp(data.byte(kNewlocation), 255);
-	if (!flags.z())
-		goto justgetback;
-iswatching:
-	makemainscreen();
-	data.byte(kInvopen) = 0;
-	data.byte(kOpenedob) = 255;
-	return;
-justgetback:
-	data.byte(kInvopen) = 0;
-	data.byte(kOpenedob) = 255;
-}
-
 void DreamGenContext::makemainscreen() {
 	STACK_CHECK;
 	createpanel();
@@ -16698,7 +16623,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
 		case addr_monprint: monprint(); break;
 		case addr_fillopen: fillopen(); break;
 		case addr_findallopen: findallopen(); break;
-		case addr_examineob: examineob(); break;
 		case addr_makemainscreen: makemainscreen(); break;
 		case addr_getbackfromob: getbackfromob(); break;
 		case addr_incryanpage: incryanpage(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 4ba7e40..e74f68c 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -479,7 +479,6 @@ public:
 	static const uint16 addr_incryanpage = 0xc348;
 	static const uint16 addr_getbackfromob = 0xc344;
 	static const uint16 addr_makemainscreen = 0xc340;
-	static const uint16 addr_examineob = 0xc33c;
 	static const uint16 addr_findallopen = 0xc32c;
 	static const uint16 addr_fillopen = 0xc324;
 	static const uint16 addr_monprint = 0xc314;
@@ -1680,7 +1679,7 @@ public:
 	void openinv();
 	void lookatplace();
 	void useaxe();
-	void examineob();
+	//void examineob();
 	void buttonnought();
 	void useelvdoor();
 	void putbackobstuff();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index e2da902..a1d6e1d 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -110,5 +110,81 @@ void DreamGenContext::obicons() {
 	}
 }
 
+void DreamGenContext::examineob() {
+	STACK_CHECK;
+	data.byte(kPointermode) = 0;
+	data.word(kTimecount) = 0;
+examineagain:
+	data.byte(kInmaparea) = 0;
+	data.byte(kExamagain) = 0;
+	data.byte(kOpenedob) = 255;
+	data.byte(kOpenedtype) = 255;
+	data.byte(kInvopen) = 0;
+	al = data.byte(kCommandtype);
+	data.byte(kObjecttype) = al;
+	data.byte(kItemframe) = 0;
+	data.byte(kPointerframe) = 0;
+	createpanel();
+	showpanel();
+	showman();
+	showexit();
+	obicons();
+	obpicture();
+	describeob();
+	undertextline();
+	data.byte(kCommandtype) = 255;
+	readmouse();
+	showpointer();
+	worktoscreen();
+	delpointer();
+waitexam:
+	readmouse();
+	showpointer();
+	vsync();
+	dumppointer();
+	dumptextline();
+	delpointer();
+	data.byte(kGetback) = 0;
+	bx = offset_examlist;
+	_cmp(data.byte(kInvopen), 0);
+	if (flags.z())
+		goto notuseinv;
+	bx = offset_invlist1;
+	_cmp(data.byte(kInvopen), 1);
+	if (flags.z())
+		goto notuseinv;
+	bx = offset_withlist1;
+notuseinv:
+	checkcoords();
+	_cmp(data.byte(kQuitrequested),  0);
+	if (!flags.z())
+		goto stopwaiting;
+	_cmp(data.byte(kExamagain), 0);
+	if (flags.z())
+		goto norex;
+	goto examineagain;
+norex:
+	_cmp(data.byte(kGetback), 0);
+	if (flags.z())
+		goto waitexam;
+stopwaiting:
+	data.byte(kPickup) = 0;
+	_cmp(data.word(kWatchingtime), 0);
+	if (!flags.z())
+		goto iswatching;
+	_cmp(data.byte(kNewlocation), 255);
+	if (!flags.z())
+		goto justgetback;
+iswatching:
+	makemainscreen();
+	data.byte(kInvopen) = 0;
+	data.byte(kOpenedob) = 255;
+	return;
+justgetback:
+	data.byte(kInvopen) = 0;
+	data.byte(kOpenedob) = 255;
+}
+
+
 } /*namespace dreamgen */
 
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 27bbe31..52e0e85 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -249,4 +249,5 @@
 	void showcity();
 	uint16 getpersframe(uint8 index);
 	void convicons();
+	void examineob();
 


Commit: ae2c4bcaf0a0362e5eaba70c021e7a44a7a46b49
    https://github.com/scummvm/scummvm/commit/ae2c4bcaf0a0362e5eaba70c021e7a44a7a46b49
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-14T12:43:36-08:00

Commit Message:
DREAMWEB: Convert 'examineob'

Changed paths:
    engines/dreamweb/object.cpp
    engines/dreamweb/stubs.h



diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index a1d6e1d..1c58559 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -110,77 +110,71 @@ void DreamGenContext::obicons() {
 	}
 }
 
-void DreamGenContext::examineob() {
-	STACK_CHECK;
+void DreamGenContext::examineob(bool examineAgain) {
 	data.byte(kPointermode) = 0;
 	data.word(kTimecount) = 0;
-examineagain:
-	data.byte(kInmaparea) = 0;
-	data.byte(kExamagain) = 0;
-	data.byte(kOpenedob) = 255;
-	data.byte(kOpenedtype) = 255;
-	data.byte(kInvopen) = 0;
-	al = data.byte(kCommandtype);
-	data.byte(kObjecttype) = al;
-	data.byte(kItemframe) = 0;
-	data.byte(kPointerframe) = 0;
-	createpanel();
-	showpanel();
-	showman();
-	showexit();
-	obicons();
-	obpicture();
-	describeob();
-	undertextline();
-	data.byte(kCommandtype) = 255;
-	readmouse();
-	showpointer();
-	worktoscreen();
-	delpointer();
-waitexam:
-	readmouse();
-	showpointer();
-	vsync();
-	dumppointer();
-	dumptextline();
-	delpointer();
-	data.byte(kGetback) = 0;
-	bx = offset_examlist;
-	_cmp(data.byte(kInvopen), 0);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_invlist1;
-	_cmp(data.byte(kInvopen), 1);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_withlist1;
-notuseinv:
-	checkcoords();
-	_cmp(data.byte(kQuitrequested),  0);
-	if (!flags.z())
-		goto stopwaiting;
-	_cmp(data.byte(kExamagain), 0);
-	if (flags.z())
-		goto norex;
-	goto examineagain;
-norex:
-	_cmp(data.byte(kGetback), 0);
-	if (flags.z())
-		goto waitexam;
-stopwaiting:
+	while (true) {
+		if (examineAgain) {
+			data.byte(kInmaparea) = 0;
+			data.byte(kExamagain) = 0;
+			data.byte(kOpenedob) = 255;
+			data.byte(kOpenedtype) = 255;
+			data.byte(kInvopen) = 0;
+			al = data.byte(kCommandtype);
+			data.byte(kObjecttype) = al;
+			data.byte(kItemframe) = 0;
+			data.byte(kPointerframe) = 0;
+			createpanel();
+			showpanel();
+			showman();
+			showexit();
+			obicons();
+			obpicture();
+			describeob();
+			undertextline();
+			data.byte(kCommandtype) = 255;
+			readmouse();
+			showpointer();
+			worktoscreen();
+			delpointer();
+			examineAgain = false;
+		}
+
+		readmouse();
+		showpointer();
+		vsync();
+		dumppointer();
+		dumptextline();
+		delpointer();
+		data.byte(kGetback) = 0;
+		switch (data.byte(kInvopen)) {
+		case 0:
+			bx = offset_examlist;
+			checkcoords();
+			break;
+		case 1:
+			bx = offset_invlist1;
+			checkcoords();
+			break;
+		default:
+			bx = offset_withlist1;
+			checkcoords();
+			break;
+		}
+		if (data.byte(kQuitrequested) != 0)
+			break;
+		if (data.byte(kExamagain) != 0)
+			examineAgain = true;
+		else if (data.byte(kGetback) != 0)
+			break;
+	}
+
 	data.byte(kPickup) = 0;
-	_cmp(data.word(kWatchingtime), 0);
-	if (!flags.z())
-		goto iswatching;
-	_cmp(data.byte(kNewlocation), 255);
-	if (!flags.z())
-		goto justgetback;
-iswatching:
-	makemainscreen();
-	data.byte(kInvopen) = 0;
-	data.byte(kOpenedob) = 255;
-	return;
-justgetback:
+	if (data.word(kWatchingtime) != 0 || data.byte(kNewlocation) == 255) {
+		// iswatching
+		makemainscreen();
+	}
+
 	data.byte(kInvopen) = 0;
 	data.byte(kOpenedob) = 255;
 }
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 52e0e85..1ced8ea 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -249,5 +249,5 @@
 	void showcity();
 	uint16 getpersframe(uint8 index);
 	void convicons();
-	void examineob();
+	void examineob(bool examineAgain = true);
 


Commit: 65e1eeb99051b4acfb88cf9fae352c83e34d9f67
    https://github.com/scummvm/scummvm/commit/65e1eeb99051b4acfb88cf9fae352c83e34d9f67
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-14T12:43:36-08:00

Commit Message:
DREAMWEB: Move 'inventory' from dreamgen

Changed paths:
    devtools/tasmrecover/tasm-recover
    engines/dreamweb/dreamgen.cpp
    engines/dreamweb/object.cpp



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 02d1aaf..7fc9e52 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -215,6 +215,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'loadgame',
 	'savegame',
 	'zoomonoff',
+	'inventory',
 	'doload'
 	])
 generator.generate('dreamweb') #start routine
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index d9a2f7a..a2c83f0 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -4158,126 +4158,6 @@ foundmatch:
 	bx = pop();
 }
 
-void DreamGenContext::inventory() {
-	STACK_CHECK;
-	_cmp(data.byte(kMandead), 1);
-	if (flags.z())
-		goto iswatchinv;
-	_cmp(data.word(kWatchingtime), 0);
-	if (flags.z())
-		goto notwatchinv;
-iswatchinv:
-	blank();
-	return;
-notwatchinv:
-	_cmp(data.byte(kCommandtype), 239);
-	if (flags.z())
-		goto alreadyopinv;
-	data.byte(kCommandtype) = 239;
-	al = 32;
-	commandonly();
-alreadyopinv:
-	ax = data.word(kMousebutton);
-	_cmp(ax, data.word(kOldbutton));
-	if (flags.z())
-		return /* (cantopinv) */;
-	_and(ax, 1);
-	if (!flags.z())
-		goto doopeninv;
-	return;
-doopeninv:
-	data.word(kTimecount) = 0;
-	data.byte(kPointermode) = 0;
-	data.byte(kInmaparea) = 0;
-	animpointer();
-	createpanel();
-	showpanel();
-	examicon();
-	showman();
-	showexit();
-	undertextline();
-	data.byte(kPickup) = 0;
-	data.byte(kInvopen) = 2;
-	openinv();
-	readmouse();
-	showpointer();
-	worktoscreen();
-	delpointer();
-	data.byte(kOpenedob) = 255;
-	goto waitexam;
-	return;
-/*continuing to unbounded code: examineagain from examineob:3-69*/
-examineagain:
-	data.byte(kInmaparea) = 0;
-	data.byte(kExamagain) = 0;
-	data.byte(kOpenedob) = 255;
-	data.byte(kOpenedtype) = 255;
-	data.byte(kInvopen) = 0;
-	al = data.byte(kCommandtype);
-	data.byte(kObjecttype) = al;
-	data.byte(kItemframe) = 0;
-	data.byte(kPointerframe) = 0;
-	createpanel();
-	showpanel();
-	showman();
-	showexit();
-	obicons();
-	obpicture();
-	describeob();
-	undertextline();
-	data.byte(kCommandtype) = 255;
-	readmouse();
-	showpointer();
-	worktoscreen();
-	delpointer();
-waitexam:
-	readmouse();
-	showpointer();
-	vsync();
-	dumppointer();
-	dumptextline();
-	delpointer();
-	data.byte(kGetback) = 0;
-	bx = offset_examlist;
-	_cmp(data.byte(kInvopen), 0);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_invlist1;
-	_cmp(data.byte(kInvopen), 1);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_withlist1;
-notuseinv:
-	checkcoords();
-	_cmp(data.byte(kQuitrequested),  0);
-	if (!flags.z())
-		goto stopwaiting;
-	_cmp(data.byte(kExamagain), 0);
-	if (flags.z())
-		goto norex;
-	goto examineagain;
-norex:
-	_cmp(data.byte(kGetback), 0);
-	if (flags.z())
-		goto waitexam;
-stopwaiting:
-	data.byte(kPickup) = 0;
-	_cmp(data.word(kWatchingtime), 0);
-	if (!flags.z())
-		goto iswatching;
-	_cmp(data.byte(kNewlocation), 255);
-	if (!flags.z())
-		goto justgetback;
-iswatching:
-	makemainscreen();
-	data.byte(kInvopen) = 0;
-	data.byte(kOpenedob) = 255;
-	return;
-justgetback:
-	data.byte(kInvopen) = 0;
-	data.byte(kOpenedob) = 255;
-}
-
 void DreamGenContext::setpickup() {
 	STACK_CHECK;
 	_cmp(data.byte(kObjecttype), 1);
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 1c58559..4462782 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -179,6 +179,126 @@ void DreamGenContext::examineob(bool examineAgain) {
 	data.byte(kOpenedob) = 255;
 }
 
+void DreamGenContext::inventory() {
+	STACK_CHECK;
+	_cmp(data.byte(kMandead), 1);
+	if (flags.z())
+		goto iswatchinv;
+	_cmp(data.word(kWatchingtime), 0);
+	if (flags.z())
+		goto notwatchinv;
+iswatchinv:
+	blank();
+	return;
+notwatchinv:
+	_cmp(data.byte(kCommandtype), 239);
+	if (flags.z())
+		goto alreadyopinv;
+	data.byte(kCommandtype) = 239;
+	al = 32;
+	commandonly();
+alreadyopinv:
+	ax = data.word(kMousebutton);
+	_cmp(ax, data.word(kOldbutton));
+	if (flags.z())
+		return /* (cantopinv) */;
+	_and(ax, 1);
+	if (!flags.z())
+		goto doopeninv;
+	return;
+doopeninv:
+	data.word(kTimecount) = 0;
+	data.byte(kPointermode) = 0;
+	data.byte(kInmaparea) = 0;
+	animpointer();
+	createpanel();
+	showpanel();
+	examicon();
+	showman();
+	showexit();
+	undertextline();
+	data.byte(kPickup) = 0;
+	data.byte(kInvopen) = 2;
+	openinv();
+	readmouse();
+	showpointer();
+	worktoscreen();
+	delpointer();
+	data.byte(kOpenedob) = 255;
+	goto waitexam;
+	return;
+/*continuing to unbounded code: examineagain from examineob:3-69*/
+examineagain:
+	data.byte(kInmaparea) = 0;
+	data.byte(kExamagain) = 0;
+	data.byte(kOpenedob) = 255;
+	data.byte(kOpenedtype) = 255;
+	data.byte(kInvopen) = 0;
+	al = data.byte(kCommandtype);
+	data.byte(kObjecttype) = al;
+	data.byte(kItemframe) = 0;
+	data.byte(kPointerframe) = 0;
+	createpanel();
+	showpanel();
+	showman();
+	showexit();
+	obicons();
+	obpicture();
+	describeob();
+	undertextline();
+	data.byte(kCommandtype) = 255;
+	readmouse();
+	showpointer();
+	worktoscreen();
+	delpointer();
+waitexam:
+	readmouse();
+	showpointer();
+	vsync();
+	dumppointer();
+	dumptextline();
+	delpointer();
+	data.byte(kGetback) = 0;
+	bx = offset_examlist;
+	_cmp(data.byte(kInvopen), 0);
+	if (flags.z())
+		goto notuseinv;
+	bx = offset_invlist1;
+	_cmp(data.byte(kInvopen), 1);
+	if (flags.z())
+		goto notuseinv;
+	bx = offset_withlist1;
+notuseinv:
+	checkcoords();
+	_cmp(data.byte(kQuitrequested),  0);
+	if (!flags.z())
+		goto stopwaiting;
+	_cmp(data.byte(kExamagain), 0);
+	if (flags.z())
+		goto norex;
+	goto examineagain;
+norex:
+	_cmp(data.byte(kGetback), 0);
+	if (flags.z())
+		goto waitexam;
+stopwaiting:
+	data.byte(kPickup) = 0;
+	_cmp(data.word(kWatchingtime), 0);
+	if (!flags.z())
+		goto iswatching;
+	_cmp(data.byte(kNewlocation), 255);
+	if (!flags.z())
+		goto justgetback;
+iswatching:
+	makemainscreen();
+	data.byte(kInvopen) = 0;
+	data.byte(kOpenedob) = 255;
+	return;
+justgetback:
+	data.byte(kInvopen) = 0;
+	data.byte(kOpenedob) = 255;
+}
+
 
 } /*namespace dreamgen */
 


Commit: d3a84d6e68fcbb87bb70a6e8a17fb540dee61326
    https://github.com/scummvm/scummvm/commit/d3a84d6e68fcbb87bb70a6e8a17fb540dee61326
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-14T12:43:36-08:00

Commit Message:
DREAMWEB: Convert 'inventory'

Changed paths:
    engines/dreamweb/object.cpp



diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 4462782..1e5646d 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -180,33 +180,23 @@ void DreamGenContext::examineob(bool examineAgain) {
 }
 
 void DreamGenContext::inventory() {
-	STACK_CHECK;
-	_cmp(data.byte(kMandead), 1);
-	if (flags.z())
-		goto iswatchinv;
-	_cmp(data.word(kWatchingtime), 0);
-	if (flags.z())
-		goto notwatchinv;
-iswatchinv:
-	blank();
-	return;
-notwatchinv:
-	_cmp(data.byte(kCommandtype), 239);
-	if (flags.z())
-		goto alreadyopinv;
-	data.byte(kCommandtype) = 239;
-	al = 32;
-	commandonly();
-alreadyopinv:
-	ax = data.word(kMousebutton);
-	_cmp(ax, data.word(kOldbutton));
-	if (flags.z())
-		return /* (cantopinv) */;
-	_and(ax, 1);
-	if (!flags.z())
-		goto doopeninv;
-	return;
-doopeninv:
+	if (data.byte(kMandead) == 1 || data.word(kWatchingtime) != 0) {
+		blank();
+		return;
+	}
+
+	if (data.byte(kCommandtype) != 239) {
+		data.byte(kCommandtype) = 239;
+		al = 32;
+		commandonly();
+	}
+
+	if (data.word(kMousebutton) == data.word(kOldbutton))
+		return;
+	if (!(data.word(kMousebutton) & 1)) // only on left mouse button
+		return;
+
+
 	data.word(kTimecount) = 0;
 	data.byte(kPointermode) = 0;
 	data.byte(kInmaparea) = 0;
@@ -225,78 +215,7 @@ doopeninv:
 	worktoscreen();
 	delpointer();
 	data.byte(kOpenedob) = 255;
-	goto waitexam;
-	return;
-/*continuing to unbounded code: examineagain from examineob:3-69*/
-examineagain:
-	data.byte(kInmaparea) = 0;
-	data.byte(kExamagain) = 0;
-	data.byte(kOpenedob) = 255;
-	data.byte(kOpenedtype) = 255;
-	data.byte(kInvopen) = 0;
-	al = data.byte(kCommandtype);
-	data.byte(kObjecttype) = al;
-	data.byte(kItemframe) = 0;
-	data.byte(kPointerframe) = 0;
-	createpanel();
-	showpanel();
-	showman();
-	showexit();
-	obicons();
-	obpicture();
-	describeob();
-	undertextline();
-	data.byte(kCommandtype) = 255;
-	readmouse();
-	showpointer();
-	worktoscreen();
-	delpointer();
-waitexam:
-	readmouse();
-	showpointer();
-	vsync();
-	dumppointer();
-	dumptextline();
-	delpointer();
-	data.byte(kGetback) = 0;
-	bx = offset_examlist;
-	_cmp(data.byte(kInvopen), 0);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_invlist1;
-	_cmp(data.byte(kInvopen), 1);
-	if (flags.z())
-		goto notuseinv;
-	bx = offset_withlist1;
-notuseinv:
-	checkcoords();
-	_cmp(data.byte(kQuitrequested),  0);
-	if (!flags.z())
-		goto stopwaiting;
-	_cmp(data.byte(kExamagain), 0);
-	if (flags.z())
-		goto norex;
-	goto examineagain;
-norex:
-	_cmp(data.byte(kGetback), 0);
-	if (flags.z())
-		goto waitexam;
-stopwaiting:
-	data.byte(kPickup) = 0;
-	_cmp(data.word(kWatchingtime), 0);
-	if (!flags.z())
-		goto iswatching;
-	_cmp(data.byte(kNewlocation), 255);
-	if (!flags.z())
-		goto justgetback;
-iswatching:
-	makemainscreen();
-	data.byte(kInvopen) = 0;
-	data.byte(kOpenedob) = 255;
-	return;
-justgetback:
-	data.byte(kInvopen) = 0;
-	data.byte(kOpenedob) = 255;
+	examineob(false);
 }
 
 


Commit: 36278dccded41106e242b28810b13a5d702cc72a
    https://github.com/scummvm/scummvm/commit/36278dccded41106e242b28810b13a5d702cc72a
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-14T12:43:36-08:00

Commit Message:
DREAMWEB: Move 'mainscreen' from dreamgen

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 7fc9e52..ba631a8 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -216,6 +216,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'savegame',
 	'zoomonoff',
 	'inventory',
+	'mainscreen',
 	'doload'
 	])
 generator.generate('dreamweb') #start routine
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index a2c83f0..24968bd 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -14008,22 +14008,6 @@ notzeronum:
 	ch = 1;
 }
 
-void DreamGenContext::mainscreen() {
-	STACK_CHECK;
-	data.byte(kInmaparea) = 0;
-	bx = offset_mainlist;
-	_cmp(data.byte(kWatchon), 1);
-	if (flags.z())
-		goto checkmain;
-	bx = offset_mainlist2;
-checkmain:
-	checkcoords();
-	_cmp(data.byte(kWalkandexam), 0);
-	if (flags.z())
-		return /* (finishmain) */;
-	walkandexamine();
-}
-
 void DreamGenContext::madmanrun() {
 	STACK_CHECK;
 	_cmp(data.byte(kLocation), 14);
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 5fa6e8a..fed7a39 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1918,5 +1918,22 @@ void DreamGenContext::showcity() {
 	showframe(tempGraphics, 120+57, 32, 1, 0);
 }
 
+void DreamGenContext::mainscreen() {
+	STACK_CHECK;
+	data.byte(kInmaparea) = 0;
+	bx = offset_mainlist;
+	_cmp(data.byte(kWatchon), 1);
+	if (flags.z())
+		goto checkmain;
+	bx = offset_mainlist2;
+checkmain:
+	checkcoords();
+	_cmp(data.byte(kWalkandexam), 0);
+	if (flags.z())
+		return /* (finishmain) */;
+	walkandexamine();
+}
+
+
 } /*namespace dreamgen */
 


Commit: e254e549293b8b13e8d1765b553a448e73169de9
    https://github.com/scummvm/scummvm/commit/e254e549293b8b13e8d1765b553a448e73169de9
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-14T12:43:36-08:00

Commit Message:
DREAMWEB: Convert 'mainscreen'

Changed paths:
    engines/dreamweb/stubs.cpp



diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index fed7a39..767db2b 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1919,19 +1919,17 @@ void DreamGenContext::showcity() {
 }
 
 void DreamGenContext::mainscreen() {
-	STACK_CHECK;
 	data.byte(kInmaparea) = 0;
-	bx = offset_mainlist;
-	_cmp(data.byte(kWatchon), 1);
-	if (flags.z())
-		goto checkmain;
-	bx = offset_mainlist2;
-checkmain:
-	checkcoords();
-	_cmp(data.byte(kWalkandexam), 0);
-	if (flags.z())
-		return /* (finishmain) */;
-	walkandexamine();
+	if (data.byte(kWatchon) == 1) {
+		bx = offset_mainlist;
+		checkcoords();
+	} else {
+		bx = offset_mainlist2;
+		checkcoords();
+	}
+
+	if (data.byte(kWalkandexam) != 0)
+		walkandexamine();
 }
 
 


Commit: b53a2997909d04ae3d3b87607f336d97d123eeb8
    https://github.com/scummvm/scummvm/commit/b53a2997909d04ae3d3b87607f336d97d123eeb8
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-11-14T12:44:10-08:00

Commit Message:
DREAMWEB: Unhardcode checkcoords tables

This patch makes __dispatch_call (even more) superfluous,
but does not yet remove it.

Changed paths:
    engines/dreamweb/object.cpp
    engines/dreamweb/saveload.cpp
    engines/dreamweb/structs.h
    engines/dreamweb/stubs.cpp



diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 1e5646d..2712bc9 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -148,19 +148,45 @@ void DreamGenContext::examineob(bool examineAgain) {
 		delpointer();
 		data.byte(kGetback) = 0;
 		switch (data.byte(kInvopen)) {
-		case 0:
-			bx = offset_examlist;
-			checkcoords();
+		case 0: {
+			RectWithCallback examlist[] = {
+				{ 273,320,157,198,&DreamGenContext::getbackfromob },
+				{ 260,300,0,44,&DreamGenContext::useobject },
+				{ 210,254,0,44,&DreamGenContext::selectopenob },
+				{ 144,176,64,96,&DreamGenContext::setpickup },
+				{ 0,50,50,200,&DreamGenContext::examinventory },
+				{ 0,320,0,200,&DreamGenContext::blank },
+				{ 0xFFFF,0,0,0,0 }
+			};
+			checkcoords(examlist);
 			break;
-		case 1:
-			bx = offset_invlist1;
-			checkcoords();
+		}
+		case 1: {
+			// NB: This table contains the non-constant openchangesize!
+			RectWithCallback invlist1[] = {
+				{ 273,320,157,198,&DreamGenContext::getbackfromob },
+				{ 255,294,0,24,&DreamGenContext::dropobject },
+				{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incryanpage },
+				{ kInventx, cs.word(offset_openchangesize),kInventy+100,kInventy+100+kItempicsize,&DreamGenContext::useopened },
+				{ kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::intoinv },
+				{ 0,320,0,200,&DreamGenContext::blank },
+				{ 0xFFFF,0,0,0,0 }
+			};
+			checkcoords(invlist1);
 			break;
-		default:
-			bx = offset_withlist1;
-			checkcoords();
+		}
+		default: {
+			RectWithCallback withlist1[] = {
+				{ 273,320,157,198,&DreamGenContext::getbackfromob },
+				{ kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamGenContext::incryanpage },
+				{ kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamGenContext::selectob },
+				{ 0,320,0,200,&DreamGenContext::blank },
+				{ 0xFFFF,0,0,0,0 }
+			};
+			checkcoords(withlist1);
 			break;
 		}
+		}
 		if (data.byte(kQuitrequested) != 0)
 			break;
 		if (data.byte(kExamagain) != 0)
diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp
index 636182d..f68ec86 100644
--- a/engines/dreamweb/saveload.cpp
+++ b/engines/dreamweb/saveload.cpp
@@ -72,8 +72,14 @@ void DreamGenContext::doload() {
 			vsync();
 			dumppointer();
 			dumptextline();
-			bx = offset_loadlist;
-			checkcoords();
+			RectWithCallback loadlist[] = {
+				{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops },
+				{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualload },
+				{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectslot },
+				{ 0,320,0,200,&DreamGenContext::blank },
+				{ 0xFFFF,0,0,0,0 }
+			};
+			checkcoords(loadlist);
 			if (data.byte(kGetback) == 1)
 				break;
 			if (data.byte(kGetback) == 2)
@@ -213,8 +219,15 @@ void DreamGenContext::savegame() {
 			vsync();
 			dumppointer();
 			dumptextline();
-			bx = offset_savelist;
-			checkcoords();
+
+			RectWithCallback savelist[] = {
+				{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops },
+				{ kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamGenContext::actualsave },
+				{ kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamGenContext::selectslot },
+				{ 0,320,0,200,&DreamGenContext::blank },
+				{ 0xFFFF,0,0,0,0 }
+			};
+			checkcoords(savelist);
 			_cmp(data.byte(kGetback), 0);
 			if (flags.z())
 				continue;
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 0d7bbb6..ceb30e3 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -54,19 +54,15 @@ struct Sprite {
 	uint8  hidden;
 };
 
+class DreamGenContext;
+
 struct RectWithCallback {
 	uint16 _xMin, _xMax;
 	uint16 _yMin, _yMax;
-	uint16 _callback;
-
-	uint16 xMin() const { return READ_LE_UINT16(&_xMin); }
-	uint16 xMax() const { return READ_LE_UINT16(&_xMax); }
-	uint16 yMin() const { return READ_LE_UINT16(&_yMin); }
-	uint16 yMax() const { return READ_LE_UINT16(&_yMax); }
-	uint16 callback() const { return READ_LE_UINT16(&_callback); }
+	void (DreamGenContext::*_callback)();
 
 	bool contains(uint16 x, uint16 y) const {
-		return (x >= xMin()) && (x < xMax()) && (y >= yMin()) && (y < yMax());
+		return (x >= _xMin) && (x < _xMax) && (y >= _yMin) && (y < _yMax);
 	}
 };
 
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 767db2b..4f956d3 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1434,156 +1434,160 @@ void DreamGenContext::dumppointer() {
 }
 
 void DreamGenContext::checkcoords() {
-	checkcoords((const RectWithCallback *)cs.ptr(bx, 0));
+
+	// FIXME: Move all these lists to the callers
+
+	switch ((uint16)bx) {
+	case offset_talklist: {
+		RectWithCallback talklist[] = {
+			{ 273,320,157,198,&DreamGenContext::getback1 },
+			{ 240,290,2,44,&DreamGenContext::moretalk },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(talklist);
+		break;
+	}
+	case offset_quitlist: {
+		RectWithCallback quitlist[] = {
+			{ 273,320,157,198,&DreamGenContext::getback1 },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(quitlist);
+		break;
+	}
+	case offset_destlist: {
+		RectWithCallback destlist[] = {
+			{ 238,258,4,44,&DreamGenContext::nextdest },
+			{ 104,124,4,44,&DreamGenContext::lastdest },
+			{ 280,308,4,44,&DreamGenContext::lookatplace },
+			{ 104,216,138,192,&DreamGenContext::destselect },
+			{ 273,320,157,198,&DreamGenContext::getback1 },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(destlist);
+		break;
+	}
+	case offset_keypadlist: {
+		RectWithCallback keypadlist[] = {
+			{ kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamGenContext::buttonone },
+			{ kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamGenContext::buttontwo },
+			{ kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamGenContext::buttonthree },
+			{ kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamGenContext::buttonfour },
+			{ kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamGenContext::buttonfive },
+			{ kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamGenContext::buttonsix },
+			{ kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamGenContext::buttonseven },
+			{ kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamGenContext::buttoneight },
+			{ kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamGenContext::buttonnine },
+			{ kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamGenContext::buttonnought },
+			{ kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamGenContext::buttonenter },
+			{ kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamGenContext::quitkey },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(keypadlist);
+		break;
+	}
+	case offset_menulist: {
+		RectWithCallback menulist[] = {
+			{ kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamGenContext::quitkey },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(menulist);
+		break;
+	}
+	case offset_folderlist: {
+		RectWithCallback folderlist[] = {
+			{ 280,320,160,200,&DreamGenContext::quitkey },
+			{ 143,300,6,194,&DreamGenContext::nextfolder },
+			{ 0,143,6,194,&DreamGenContext::lastfolder },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(folderlist);
+		break;
+	}
+	case offset_symbollist: {
+		RectWithCallback symbollist[] = {
+			{ kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamGenContext::quitsymbol },
+			{ kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamGenContext::settopleft },
+			{ kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamGenContext::settopright },
+			{ kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamGenContext::setbotleft },
+			{ kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamGenContext::setbotright },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(symbollist);
+
+		break;
+	}
+	case offset_diarylist: {
+		RectWithCallback diarylist[] = {
+			{ kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamGenContext::diarykeyn },
+			{ kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamGenContext::diarykeyp },
+			{ kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamGenContext::quitkey },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(diarylist);
+		break;
+	}
+	case offset_opslist: {
+		RectWithCallback opslist[] = {
+			{ kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getbackfromops },
+			{ kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamGenContext::dosreturn },
+			{ kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discops },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(opslist);
+		break;
+	}
+	case offset_discopslist: {
+		RectWithCallback discopslist[] = {
+			{ kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::loadgame },
+			{ kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamGenContext::savegame },
+			{ kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamGenContext::getbacktoops },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(discopslist);
+		break;
+	}
+	case offset_decidelist: {
+		RectWithCallback decidelist[] = {
+			{ kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamGenContext::newgame },
+			{ kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamGenContext::dosreturn },
+			{ kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamGenContext::loadold },
+			{ 0,320,0,200,&DreamGenContext::blank },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(decidelist);
+		break;
+	}
+	default:
+		::error("Unimplemented checkcoords() call");
+	}
 }
 
+
 void DreamGenContext::checkcoords(const RectWithCallback *rectWithCallbacks) {
 	if (data.byte(kNewlocation) != 0xff)
 		return;
 
-	const RectWithCallback *rectWithCallback = rectWithCallbacks;
-	while (rectWithCallback->xMin() != 0xffff) {
-		if (rectWithCallback->contains(data.word(kMousex), data.word(kMousey))) {
-			uint16 callback = rectWithCallback->callback();
-
-			// common
-			if(callback == addr_blank)
-				blank();
-			else if(callback == addr_getbackfromob)
-				getbackfromob();
-			else if(callback == addr_incryanpage)
-				incryanpage();
-			else if(callback == addr_getback1)
-				getback1();
-			else if(callback == addr_quitkey)
-				quitkey();
-			else if(callback == addr_dosreturn)
-				dosreturn();
-			else if(callback == addr_getbacktoops)
-				getbacktoops();
-			else if(callback == addr_selectslot)
-				selectslot();
-			// examlist
-			else if(callback == addr_useobject)
-				useobject();
-			else if(callback == addr_selectopenob)
-				selectopenob();
-			else if(callback == addr_setpickup)
-				setpickup();
-			else if(callback == addr_examinventory)
-				examinventory();
-			// invlist1
-			else if(callback == addr_dropobject)
-				dropobject();
-			else if(callback == addr_useopened)
-				useopened();
-			else if(callback == addr_intoinv)
-				intoinv();
-			// withlist1
-			else if(callback == addr_selectob)
-				selectob();
-			// talklist
-			else if(callback == addr_moretalk)
-				moretalk();
-			// quitlist
-			// destlist
-			else if(callback == addr_nextdest)
-				nextdest();
-			else if(callback == addr_lastdest)
-				lastdest();
-			else if(callback == addr_lookatplace)
-				lookatplace();
-			else if(callback == addr_destselect)
-				destselect();
-			// keypadlist
-			else if(callback == addr_buttonone)
-				buttonone();
-			else if(callback == addr_buttontwo)
-				buttontwo();
-			else if(callback == addr_buttonthree)
-				buttonthree();
-			else if(callback == addr_buttonfour)
-				buttonfour();
-			else if(callback == addr_buttonfive)
-				buttonfive();
-			else if(callback == addr_buttonsix)
-				buttonsix();
-			else if(callback == addr_buttonseven)
-				buttonseven();
-			else if(callback == addr_buttoneight)
-				buttoneight();
-			else if(callback == addr_buttonnine)
-				buttonnine();
-			else if(callback == addr_buttonnought)
-				buttonnought();
-			else if(callback == addr_buttonenter)
-				buttonenter();
-			// menulist
-			// folderlist
-			else if(callback == addr_nextfolder)
-				nextfolder();
-			else if(callback == addr_lastfolder)
-				lastfolder();
-			// symbollist
-			else if(callback == addr_quitsymbol)
-				quitsymbol();
-			else if(callback == addr_settopleft)
-				settopleft();
-			else if(callback == addr_settopright)
-				settopright();
-			else if(callback == addr_setbotleft)
-				setbotleft();
-			else if(callback == addr_setbotright)
-				setbotright();
-			// diarylist
-			else if(callback == addr_diarykeyn)
-				diarykeyn();
-			else if(callback == addr_diarykeyp)
-				diarykeyp();
-			// opslist
-			else if(callback == addr_getbackfromops)
-				getbackfromops();
-			else if(callback == addr_discops)
-				discops();
-			// discopslist
-			else if(callback == addr_loadgame)
-				loadgame();
-			else if(callback == addr_savegame)
-				savegame();
-			// mainlist, mainlist2
-			else if(callback == addr_look)
-				look();
-			else if(callback == addr_inventory)
-				inventory();
-			else if(callback == addr_zoomonoff)
-				zoomonoff();
-			else if(callback == addr_saveload)
-				saveload();
-			else if(callback == addr_madmanrun)
-				madmanrun();
-			else if(callback == addr_identifyob)
-				identifyob();
-			// decidelist
-			else if(callback == addr_newgame)
-				newgame();
-			else if(callback == addr_loadold)
-				loadold();
-			// loadlist
-			else if(callback == addr_actualload)
-				actualload();
-			// savelist
-			else if(callback == addr_actualsave)
-				actualsave();
-			else {
-				debug("__dispatch_call remaining in checkcoords! %d", (int)callback);
-				__dispatch_call(callback);
-			}
+	const RectWithCallback *r;
+	for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) {
+		if (r->contains(data.word(kMousex), data.word(kMousey))) {
+			(this->*(r->_callback))();
 			return;
 		}
-		++rectWithCallback;
 	}
 }
 
+
 void DreamGenContext::showpointer() {
 	showblink();
 	const Frame *icons1 = ((const Frame *)segRef(data.word(kIcons1)).ptr(0, 0));
@@ -1921,11 +1925,27 @@ void DreamGenContext::showcity() {
 void DreamGenContext::mainscreen() {
 	data.byte(kInmaparea) = 0;
 	if (data.byte(kWatchon) == 1) {
-		bx = offset_mainlist;
-		checkcoords();
+		RectWithCallback mainlist[] = {
+			{ 44,70,32,46,&DreamGenContext::look },
+			{ 0,50,0,180,&DreamGenContext::inventory },
+			{ 226,244,10,26,&DreamGenContext::zoomonoff },
+			{ 226,244,26,40,&DreamGenContext::saveload },
+			{ 240,260,100,124,&DreamGenContext::madmanrun },
+			{ 0,320,0,200,&DreamGenContext::identifyob },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(mainlist);
 	} else {
-		bx = offset_mainlist2;
-		checkcoords();
+		RectWithCallback mainlist2[] = {
+			{ 44,70,32,46,&DreamGenContext::look },
+			{ 0,50,0,180,&DreamGenContext::inventory },
+			{ 226+48,244+48,10,26,&DreamGenContext::zoomonoff },
+			{ 226+48,244+48,26,40,&DreamGenContext::saveload },
+			{ 240,260,100,124,&DreamGenContext::madmanrun },
+			{ 0,320,0,200,&DreamGenContext::identifyob },
+			{ 0xFFFF,0,0,0,0 }
+		};
+		checkcoords(mainlist2);
 	}
 
 	if (data.byte(kWalkandexam) != 0)






More information about the Scummvm-git-logs mailing list