[Scummvm-cvs-logs] SF.net SVN: scummvm: [21876] scummvm/trunk/engines/simon

kirben at users.sourceforge.net kirben at users.sourceforge.net
Fri Apr 14 00:25:04 CEST 2006


Revision: 21876
Author:   kirben
Date:     2006-04-14 00:24:40 -0700 (Fri, 14 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21876&view=rev

Log Message:
-----------
A few corrections to path finding in FF

Modified Paths:
--------------
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/vga.cpp
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-14 07:06:54 UTC (rev 21875)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-14 07:24:40 UTC (rev 21876)
@@ -1479,20 +1479,20 @@
 	uint prev_i;
 	uint x_diff, y_diff;
 	uint best_i = 0, best_j = 0, best_dist = 0xFFFFFFFF;
+	uint maxPath = (getGameType() == GType_FF) ? 100 : 20;
 
 	if (getGameType() == GType_FF) {
 		x += _scrollX;
 		y += _scrollY;
 	}
-
 	if (getGameType() == GType_SIMON2) {
 		x += _scrollX * 8;
 	}
 
 	int end = (getGameType() == GType_FF) ? 9999 : 999;
-	prev_i = 21 - _variableArray[12];
-	for (i = 20; i != 0; --i) {
-		p = (const uint16 *)_pathFindArray[20 - i];
+	prev_i = maxPath + 1 - readVariable(12);
+	for (i = maxPath; i != 0; --i) {
+		p = (const uint16 *)_pathFindArray[maxPath - i];
 		if (!p)
 			continue;
 		for (j = 0; readUint16Wrapper(&p[0]) != end; j++, p += 2) {
@@ -1507,19 +1507,14 @@
 
 			if (x_diff < best_dist || x_diff == best_dist && prev_i == i) {
 				best_dist = x_diff;
-				best_i = 21 - i;
+				best_i = maxPath + 1 - i;
 				best_j = j;
 			}
 		}
 	}
 
-	if (getGameType() == GType_FF && getBitFlag(83)) {
-		_variableArray[var_1] = best_i;
-		_variableArray[var_2] = best_j;
-	} else {
-		_variableArray[var_1] = best_i;
-		_variableArray[var_2] = best_j;
-	}
+	writeVariable(var_1, best_i);
+	writeVariable(var_2, best_j);
 }
 
 void SimonEngine::o_scnTxtLongText() {

Modified: scummvm/trunk/engines/simon/vga.cpp
===================================================================
--- scummvm/trunk/engines/simon/vga.cpp	2006-04-14 07:06:54 UTC (rev 21875)
+++ scummvm/trunk/engines/simon/vga.cpp	2006-04-14 07:24:40 UTC (rev 21876)
@@ -1863,7 +1863,7 @@
 		int16 x, x2, y, y1, y2, ydiff;
 		uint pos = 0;
 
-		while(vsp->x > readUint16Wrapper(p + 2)) {
+		while (vsp->x >= readUint16Wrapper(p + 2)) {
 			p += 2;
 			pos++;
 		}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list