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

bluegr md5 at scummvm.org
Sat Dec 24 12:33:36 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:
be1a4de291 DREAMWEB: Port 'dropobject' to C++


Commit: be1a4de2919e7a5fa26ee05d23792aacd0e33a7a
    https://github.com/scummvm/scummvm/commit/be1a4de2919e7a5fa26ee05d23792aacd0e33a7a
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-12-24T03:32:39-08:00

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

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 e519aeb..04e2047 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -385,6 +385,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'drawitall',
 	'drinker',
 	'droperror',
+	'dropobject',
 	'drunk',
 	'dumpblink',
 	'dumpcurrent',
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index bcb45f5..d1abe79 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -580,107 +580,6 @@ findopenp1:
 	_add(bx, (0+(228*13)));
 }
 
-void DreamGenContext::dropObject() {
-	STACK_CHECK;
-	_cmp(data.byte(kCommandtype), 223);
-	if (flags.z())
-		goto alreadydrop;
-	data.byte(kCommandtype) = 223;
-	_cmp(data.byte(kPickup), 0);
-	if (flags.z())
-		{ blank(); return; };
-	bl = data.byte(kItemframe);
-	bh = data.byte(kObjecttype);
-	al = 37;
-	commandWithOb();
-alreadydrop:
-	ax = data.word(kMousebutton);
-	_cmp(ax, data.word(kOldbutton));
-	if (flags.z())
-		return /* (nodrop) */;
-	_and(ax, 1);
-	if (!flags.z())
-		goto dodrop;
-	return;
-dodrop:
-	getEitherAd();
-	isItWorn();
-	if (!flags.z())
-		goto nowornerror;
-	wornError();
-	return;
-nowornerror:
-	_cmp(data.byte(kReallocation), 47);
-	if (flags.z())
-		goto nodrop2;
-	cl = data.byte(kRyanx);
-	_add(cl, 12);
-	ch = data.byte(kRyany);
-	_add(ch, 12);
-	checkOne();
-	_cmp(cl, 2);
-	if (flags.c())
-		goto nodroperror;
-nodrop2:
-	dropError();
-	return;
-nodroperror:
-	_cmp(data.byte(kMapxsize), 64);
-	if (!flags.z())
-		goto notinlift;
-	_cmp(data.byte(kMapysize), 64);
-	if (!flags.z())
-		goto notinlift;
-	dropError();
-	return;
-notinlift:
-	al = data.byte(kItemframe);
-	ah = 4;
-	cl = 'G';
-	ch = 'U';
-	dl = 'N';
-	dh = 'A';
-	compare();
-	if (flags.z())
-		{ cantDrop(); return; };
-	al = data.byte(kItemframe);
-	ah = 4;
-	cl = 'S';
-	ch = 'H';
-	dl = 'L';
-	dh = 'D';
-	compare();
-	if (flags.z())
-		{ cantDrop(); return; };
-	data.byte(kObjecttype) = 4;
-	al = data.byte(kItemframe);
-	getExAd();
-	es.byte(bx+2) = 0;
-	al = data.byte(kRyanx);
-	_add(al, 4);
-	cl = 4;
-	_shr(al, cl);
-	_add(al, data.byte(kMapx));
-	ah = data.byte(kRyany);
-	_add(ah, 8);
-	cl = 4;
-	_shr(ah, cl);
-	_add(ah, data.byte(kMapy));
-	es.byte(bx+3) = al;
-	es.byte(bx+5) = ah;
-	al = data.byte(kRyanx);
-	_add(al, 4);
-	_and(al, 15);
-	ah = data.byte(kRyany);
-	_add(ah, 8);
-	_and(ah, 15);
-	es.byte(bx+4) = al;
-	es.byte(bx+6) = ah;
-	data.byte(kPickup) = 0;
-	al = data.byte(kReallocation);
-	es.byte(bx) = al;
-}
-
 void DreamGenContext::selectOpenOb() {
 	STACK_CHECK;
 	al = data.byte(kCommand);
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 2df23e4..2041ab1 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -475,7 +475,6 @@ public:
 	void findAllOpen();
 	void fillOpen();
 	void getEitherAd();
-	void dropObject();
 	void useOpened();
 	void locationPic();
 	void swapWithOpen();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 8e7ade4..04081e2 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -704,5 +704,57 @@ const uint8 *DreamBase::getObTextStart() {
 	}
 }
 
+void DreamGenContext::dropObject() {
+	if (data.byte(kCommandtype) != 223) {
+		data.byte(kCommandtype) = 223;
+		if (!data.byte(kPickup)) {
+			blank();
+			return;
+		}
+		commandWithOb(37, data.byte(kObjecttype), data.byte(kItemframe));
+	}
+
+	if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
+		return;
+
+	if (isItWorn(getEitherAdCPP())) {
+		wornError();
+		return;
+	}
+
+	if (data.byte(kReallocation) != 47) {
+		byte flag, flagEx, type, flagX, flagY;
+		checkOne(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY);
+
+		if (flag >= 2) {
+			dropError();
+			return;
+		}
+	} else {
+		dropError();
+		return;
+	}
+
+	if (data.byte(kMapxsize) == 64 && data.byte(kMapysize) == 64) {
+		// Inside lift
+		dropError();
+		return;
+	}
+
+	if (compare(data.byte(kItemframe), 4, "GUNA") || compare(data.byte(kItemframe), 4, "SHLD")) {
+		cantDrop();
+		return;
+	}
+
+	data.byte(kObjecttype) = 4;
+	DynObject *object = getExAd(data.byte(kItemframe));
+	object->mapad[0] = 0;
+	object->mapad[1] = ((data.byte(kRyanx) + 4) >> 4) + data.byte(kMapx);
+	object->mapad[2] = (data.byte(kRyanx) + 4) & 0xF;
+	object->mapad[3] = ((data.byte(kRyany) + 8) >> 4) + data.byte(kMapy);
+	object->mapad[4] = (data.byte(kRyany) + 8) & 0xF;
+	data.byte(kPickup) = 0;
+	object->currentLocation = data.byte(kReallocation);
+}
 
 } // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 83b4ebf..5f4ad56 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -339,5 +339,6 @@
 	void outOfInv();
 	void edensFlatReminders();
 	void incRyanPage();
+	void dropObject();
 
 #endif






More information about the Scummvm-git-logs mailing list