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

bluegr md5 at scummvm.org
Fri Dec 16 23:44:12 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:
b371c46af9 DREAMWEB: Port 'checkinside' to C++


Commit: b371c46af9d5dd7e1282a9e227a853e0d2054fb2
    https://github.com/scummvm/scummvm/commit/b371c46af9d5dd7e1282a9e227a853e0d2054fb2
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-12-16T14:43:09-08:00

Commit Message:
DREAMWEB: Port 'checkinside' to C++

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 94a74e5..6d99cb2 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -291,6 +291,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'checkifperson',
 	'checkifset',
 	'checkinput',
+	'checkinside',
 	'checkone',
 	'checksoundint',
 	'checkspeed',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 47b01d3..0a891cb 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2837,27 +2837,6 @@ doselob:
 	useRoutine();
 }
 
-void DreamGenContext::checkInside() {
-	STACK_CHECK;
-	es = data.word(kExtras);
-	bx = (0+2080+30000);
-	cl = 0;
-insideloop:
-	_cmp(al, es.byte(bx+3));
-	if (!flags.z())
-		goto notfoundinside;
-	_cmp(ah, es.byte(bx+2));
-	if (!flags.z())
-		goto notfoundinside;
-	return;
-notfoundinside:
-	_add(bx, 16);
-	_inc(cl);
-	_cmp(cl, (114));
-	if (!flags.z())
-		goto insideloop;
-}
-
 void DreamGenContext::showDiaryKeys() {
 	STACK_CHECK;
 	_cmp(data.byte(kPresscount), 0);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 94826e8..86768e6 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -525,7 +525,6 @@ public:
 	void locationPic();
 	void swapWithOpen();
 	void dreamweb();
-	void checkInside();
 	void findPathOfPoint();
 	void getDestInfo();
 	void read();
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index fb5fba8..376a681 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1794,6 +1794,20 @@ bool DreamGenContext::isRyanHolding(const char *id) {
 	return false;
 }
 
+void DreamGenContext::checkInside() {
+	cl = checkInside(al, ah);
+}
+
+uint16 DreamGenContext::checkInside(uint16 command, uint16 type) {
+	for (uint16 index = 0; index < kNumexobjects; index++) {
+		DynObject *object = getExAd(index);
+		if (object->mapad[1] == command && object->mapad[0] == type)
+			return index;
+	}
+
+	return kNumexobjects;
+}
+
 bool DreamBase::isItDescribed(const ObjPos *pos) {
 	uint16 offset = getSegment(data.word(kSetdesc)).word(kSettextdat + pos->index * 2);
 	uint8 result = getSegment(data.word(kSetdesc)).byte(kSettext + offset);
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index ab09fd3..27a5cee 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -395,5 +395,7 @@
 	void identifyOb();
 	void showSlots();
 	void useCashCard();
+	void checkInside();
+	uint16 checkInside(uint16 command, uint16 type);
 
 #endif
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
index 6b59faf..b4e7efd 100644
--- a/engines/dreamweb/use.cpp
+++ b/engines/dreamweb/use.cpp
@@ -994,11 +994,7 @@ void DreamGenContext::useObject() {
 }
 
 void DreamGenContext::useWinch() {
-	al = 40;
-	ah = 1;
-	checkInside();
-
-	if (cl == kNumexobjects || !compare(cl, 4, "FUSE")) {
+	if (checkInside(40, 1) == kNumexobjects || !compare(cl, 4, "FUSE")) {
 		// No winch
 		showFirstUse();
 		putBackObStuff();
@@ -1244,11 +1240,7 @@ void DreamGenContext::hotelControl() {
 }
 
 void DreamGenContext::useCooker() {
-	al = data.byte(kCommand);
-	ah = data.byte(kObjecttype);
-	checkInside();
-
-	if (cl == 114)
+	if (checkInside(data.byte(kCommand), data.byte(kObjecttype)) == kNumexobjects)
 		showFirstUse();
 	else
 		showSecondUse();	// Food inside






More information about the Scummvm-git-logs mailing list