[Scummvm-cvs-logs] scummvm master -> 05c5e224b45f910d9db50e6c9ce451ede31452f2

bluegr md5 at scummvm.org
Sat Dec 17 12:49:02 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:
05c5e224b4 DREAMWEB: Port 'findinvpos', 'selectob' to C++ and fix a regression in identifyOb()


Commit: 05c5e224b45f910d9db50e6c9ce451ede31452f2
    https://github.com/scummvm/scummvm/commit/05c5e224b45f910d9db50e6c9ce451ede31452f2
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-12-17T03:48:12-08:00

Commit Message:
DREAMWEB: Port 'findinvpos', 'selectob' to C++ and fix a regression in identifyOb()

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 2b0e086..8d5eb11 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -412,6 +412,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'finalframe',
 	'findallryan',
 	'findexobject',
+	'findinvpos',
 	'findlen',
 	'findnextcolon',
 	'findobname',
@@ -710,6 +711,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'security',
 	'seecommandtail',
 	'selectlocation',
+	'selectob',
 	'selectslot',
 	'selectslot2',
 	'set16colpalette',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 939e8c0..ff91eb6 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -1091,36 +1091,6 @@ void DreamGenContext::getSetAd() {
 	es = data.word(kSetdat);
 }
 
-void DreamGenContext::findInvPos() {
-	STACK_CHECK;
-	cx = data.word(kMousex);
-	_sub(cx, (80));
-	bx = -1;
-findinv1:
-	_inc(bx);
-	_sub(cx, (44));
-	if (!flags.c())
-		goto findinv1;
-	cx = data.word(kMousey);
-	_sub(cx, (58));
-	_sub(bx, 5);
-findinv2:
-	_add(bx, 5);
-	_sub(cx, (44));
-	if (!flags.c())
-		goto findinv2;
-	al = data.byte(kRyanpage);
-	ah = 0;
-	cx = 10;
-	_mul(cx);
-	_add(bx, ax);
-	al = bl;
-	data.byte(kLastinvpos) = al;
-	_add(bx, bx);
-	es = data.word(kBuffers);
-	_add(bx, (0+(228*13)+32));
-}
-
 void DreamGenContext::findOpenPos() {
 	STACK_CHECK;
 	cx = data.word(kMousex);
@@ -2736,45 +2706,6 @@ lookcolon:
 		goto lookcolon;
 }
 
-void DreamGenContext::selectOb() {
-	STACK_CHECK;
-	findInvPos();
-	ax = es.word(bx);
-	_cmp(al, 255);
-	if (!flags.z())
-		goto canselectob;
-	blank();
-	return;
-canselectob:
-	data.byte(kWithobject) = al;
-	data.byte(kWithtype) = ah;
-	_cmp(ax, data.word(kOldsubject));
-	if (!flags.z())
-		goto diffsub3;
-	_cmp(data.byte(kCommandtype), 221);
-	if (flags.z())
-		goto alreadyselob;
-	data.byte(kCommandtype) = 221;
-diffsub3:
-	data.word(kOldsubject) = ax;
-	bx = ax;
-	al = 0;
-	commandWithOb();
-alreadyselob:
-	ax = data.word(kMousebutton);
-	_cmp(ax, data.word(kOldbutton));
-	if (flags.z())
-		return /* (notselob) */;
-	_and(ax, 1);
-	if (!flags.z())
-		goto doselob;
-	return;
-doselob:
-	delPointer();
-	data.byte(kInvopen) = 0;
-	useRoutine();
-}
-
 void DreamGenContext::showDiaryKeys() {
 	STACK_CHECK;
 	_cmp(data.byte(kPresscount), 0);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 28711bb..139253c 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -496,9 +496,7 @@ public:
 	void removeObFromInv();
 	void dirFile();
 	void pickupConts();
-	void findInvPos();
 	void getKeyAndLogo();
-	void selectOb();
 	void fadeUpMon();
 	void reExFromInv();
 	void outOfInv();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 747b793..283e44b 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -331,6 +331,8 @@ void DreamGenContext::identifyOb() {
 	push(ax);
 	findPathOfPoint();
 	data.byte(kPointerspath) = dl;
+	ax = pop();
+	push(ax);
 	findFirstPath();
 	data.byte(kPointerfirstpath) = al;
 	ax = pop();
@@ -354,4 +356,43 @@ void DreamGenContext::identifyOb() {
 		blank();
 }
 
+uint16 DreamGenContext::findInvPosCPP() {
+	uint16 x = data.word(kMousex) - kInventx;
+	uint16 y = data.word(kMousey) - kInventy;
+	uint16 pos = (x / kItempicsize) + (y / kItempicsize) * 5;
+	uint16 invPos = data.byte(kRyanpage) * 10 + pos;
+	data.byte(kLastinvpos) = invPos & 0xFF;
+	return invPos * 2 + kRyaninvlist;
+}
+
+void DreamGenContext::findInvPos() {
+	bx = findInvPosCPP();
+	es = data.word(kBuffers);
+}
+
+void DreamGenContext::selectOb() {
+	es = data.word(kBuffers);
+
+	uint16 objectId = es.word(findInvPosCPP());
+	if ((objectId & 0xFF) == 255) {
+		blank();
+		return;
+	}
+
+	data.byte(kWithobject) = objectId & 0x00FF;
+	data.byte(kWithtype)   = objectId & 0xFF00;
+
+	if (objectId == data.word(kOldsubject) && data.byte(kCommandtype) != 221)
+		data.byte(kCommandtype) = 221;
+
+	data.word(kOldsubject) = objectId;
+	commandWithOb(0, data.byte(kWithtype), data.byte(kWithobject));
+
+	if (data.word(kMousebutton) != data.word(kOldbutton) && (data.word(kMousebutton) & 1)) {
+		delPointer();
+		data.byte(kInvopen) = 0;
+		useRoutine();
+	}
+}
+
 } // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index b2417e7..d9823fb 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -398,5 +398,8 @@
 	void useStereo();
 	void checkInside();
 	uint16 checkInside(uint16 command, uint16 type);
+	void selectOb();
+	void findInvPos();
+	uint16 findInvPosCPP();
 
 #endif






More information about the Scummvm-git-logs mailing list