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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Apr 10 01:35:04 CEST 2006


Revision: 21757
Author:   eriktorbjorn
Date:     2006-04-10 01:34:16 -0700 (Mon, 10 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21757&view=rev

Log Message:
-----------
Merged o_pathfind() into o1_getPathPosn().

Modified Paths:
--------------
    scummvm/trunk/engines/simon/items.cpp
    scummvm/trunk/engines/simon/simon.cpp
    scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/items.cpp
===================================================================
--- scummvm/trunk/engines/simon/items.cpp	2006-04-10 08:28:29 UTC (rev 21756)
+++ scummvm/trunk/engines/simon/items.cpp	2006-04-10 08:34:16 UTC (rev 21757)
@@ -1475,11 +1475,57 @@
 
 void SimonEngine::o1_getPathPosn() {
 	// 178: path find
-	uint a = getVarOrWord();
-	uint b = getVarOrWord();
-	uint c = getVarOrByte();
-	uint d = getVarOrByte();
-	o_pathfind(a, b, c, d);
+	uint x = getVarOrWord();
+	uint y = getVarOrWord();
+	uint var_1 = getVarOrByte();
+	uint var_2 = getVarOrByte();
+
+	const uint16 *p;
+	uint i, j;
+	uint prev_i;
+	uint x_diff, y_diff;
+	uint best_i = 0, best_j = 0, best_dist = 0xFFFFFFFF;
+
+	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];
+		if (!p)
+			continue;
+		for (j = 0; readUint16Wrapper(&p[0]) != end; j++, p += 2) {
+			x_diff = abs((int)(readUint16Wrapper(&p[0]) - x));
+			y_diff = abs((int)(readUint16Wrapper(&p[1]) - 12 - y));
+
+			if (x_diff < y_diff) {
+				x_diff /= 4;
+				y_diff *= 4;
+			}
+			x_diff += y_diff /= 4;
+
+			if (x_diff < best_dist || x_diff == best_dist && prev_i == i) {
+				best_dist = x_diff;
+				best_i = 21 - 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;
+	}
 }
 
 void SimonEngine::o1_scnTxtLongText() {

Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp	2006-04-10 08:28:29 UTC (rev 21756)
+++ scummvm/trunk/engines/simon/simon.cpp	2006-04-10 08:34:16 UTC (rev 21757)
@@ -2941,55 +2941,6 @@
 	return 0;
 }
 
-void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) {
-	const uint16 *p;
-	uint i, j;
-	uint prev_i;
-	uint x_diff, y_diff;
-	uint best_i = 0, best_j = 0, best_dist = 0xFFFFFFFF;
-
-	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];
-		if (!p)
-			continue;
-		for (j = 0; readUint16Wrapper(&p[0]) != end; j++, p += 2) {
-			x_diff = abs((int)(readUint16Wrapper(&p[0]) - x));
-			y_diff = abs((int)(readUint16Wrapper(&p[1]) - 12 - y));
-
-			if (x_diff < y_diff) {
-				x_diff /= 4;
-				y_diff *= 4;
-			}
-			x_diff += y_diff /= 4;
-
-			if (x_diff < best_dist || x_diff == best_dist && prev_i == i) {
-				best_dist = x_diff;
-				best_i = 21 - 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;
-	}
-}
-
 void SimonEngine::delete_hitarea_by_index(uint index) {
 	CHECK_BOUNDS(index, _hitAreas);
 	_hitAreas[index].flags = 0;

Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h	2006-04-10 08:28:29 UTC (rev 21756)
+++ scummvm/trunk/engines/simon/simon.h	2006-04-10 08:34:16 UTC (rev 21757)
@@ -579,7 +579,6 @@
 
 	uint getOffsetOfChild2Param(SubObject *child, uint prop);
 	void o_setTextColor(uint color);
-	void o_pathfind(int x, int y, uint var_1, uint var_2);
 	void o_mouseOn();
 	void o_mouseOff();
 	void o_unfreezeBottom();


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