[Scummvm-cvs-logs] scummvm master -> 389afc46660918409d69458bfbb096a6ba128f63

digitall digitall at scummvm.org
Mon Dec 26 04:57:52 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:
389afc4666 DREAMWEB: Port 'findpathofpoint' to C++


Commit: 389afc46660918409d69458bfbb096a6ba128f63
    https://github.com/scummvm/scummvm/commit/389afc46660918409d69458bfbb096a6ba128f63
Author: D G Turner (digitall at scummvm.org)
Date: 2011-12-25T21:02:51-08:00

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

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



diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover
index 61d5a81..a076c9e 100755
--- a/devtools/tasmrecover/tasm-recover
+++ b/devtools/tasmrecover/tasm-recover
@@ -454,6 +454,7 @@ generator = cpp(context, "DreamGen", blacklist = [
 	'findobname',
 	'findopenpos',
 	'findormake',
+	'findpathofpoint',
 	'findpuztext',
 	'findroominloc',
 	'findsetobject',
diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h
index a669e6b..cbcfa1e 100644
--- a/engines/dreamweb/dreambase.h
+++ b/engines/dreamweb/dreambase.h
@@ -221,6 +221,7 @@ public:
 	void bresenhams();
 	void workoutFrames();
 	byte findFirstPath(byte x, byte y);
+	byte findPathOfPoint(byte x, byte y);
 
 	// from people.cpp
 	void setupInitialReelRoutines();
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index fcf8dc6..6c16274 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -652,50 +652,6 @@ finishpars:
 	di = offset_operand1;
 }
 
-void DreamGenContext::findPathOfPoint() {
-	STACK_CHECK;
-	push(ax);
-	bx = (0);
-	es = data.word(kReels);
-	al = data.byte(kRoomnum);
-	ah = 0;
-	cx = 144;
-	_mul(cx);
-	_add(bx, ax);
-	cx = pop();
-	dl = 0;
-pathloop:
-	al = es.byte(bx+6);
-	_cmp(al, 255);
-	if (!flags.z())
-		goto flunkedit;
-	ax = es.word(bx+2);
-	_cmp(ax, 0x0ffff);
-	if (flags.z())
-		goto flunkedit;
-	_cmp(cl, al);
-	if (flags.c())
-		goto flunkedit;
-	_cmp(ch, ah);
-	if (flags.c())
-		goto flunkedit;
-	ax = es.word(bx+4);
-	_cmp(cl, al);
-	if (!flags.c())
-		goto flunkedit;
-	_cmp(ch, ah);
-	if (!flags.c())
-		goto flunkedit;
-	return /* (gotvalidpath) */;
-flunkedit:
-	_add(bx, 8);
-	_inc(dl);
-	_cmp(dl, 12);
-	if (!flags.z())
-		goto pathloop;
-	dl = 255;
-}
-
 void DreamGenContext::__start() { 
 	static const uint8 src[] = {
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x13, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index 40046c4..6c5bf19 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -463,7 +463,6 @@ public:
 	void findAllOpen();
 	void fillOpen();
 	void dreamweb();
-	void findPathOfPoint();
 	void read();
 	void searchForString();
 	void searchForFiles();
diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp
index 7864b2a..9d5ea15 100644
--- a/engines/dreamweb/object.cpp
+++ b/engines/dreamweb/object.cpp
@@ -354,8 +354,7 @@ void DreamGenContext::identifyOb() {
 	data.byte(kInmaparea) = 1;
 	ah = bl;
 	push(ax);
-	findPathOfPoint();
-	data.byte(kPointerspath) = dl;
+	data.byte(kPointerspath) = findPathOfPoint(al, ah);
 	ax = pop();
 	push(ax);
 	data.byte(kPointerfirstpath) = findFirstPath(al, ah);
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index 20bbf7d..4f887db 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -328,5 +328,26 @@ byte DreamBase::findFirstPath(byte x, byte y) {
 	return 0;
 }
 
+byte DreamBase::findPathOfPoint(byte x, byte y) {
+	PathNode *paths = (PathNode *)getSegment(data.word(kReels)).ptr(kPathdata + 144 * data.byte(kRoomnum), 0);
+
+	for (uint8 index = 0; index < 12; index++) {
+		if (paths[index].on != 0xff)
+			continue; // "flunkedit"
+
+		if (paths[index].x1 == 0xff && paths[index].y1 == 0xff)
+			continue; // "flunkedit"
+
+		if (x < paths[index].x1 || y < paths[index].y1)
+			continue; // "flunkedit"
+
+		if (x >= paths[index].x2 || y >= paths[index].y2)
+			continue; // "flunkedit"
+
+		return index; // "gotvalidpath"
+	}
+
+	return 0xff;
+}
 
 } // End of namespace DreamGen
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index e8fa176..413bd27 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -3067,10 +3067,7 @@ void DreamGenContext::afterNewRoom() {
 	data.byte(kCommandtype) = 0;
 	findRoomInLoc();
 	if (data.byte(kRyanon) != 1) {
-		al = data.byte(kRyanx) + 12;
-		ah = data.byte(kRyany) + 12;
-		findPathOfPoint();
-		data.byte(kManspath) = dl;
+		data.byte(kManspath) = findPathOfPoint(data.byte(kRyanx) + 12, data.byte(kRyany) + 12);
 		findXYFromPath();
 		data.byte(kResetmanxy) = 1;
 	}






More information about the Scummvm-git-logs mailing list