[Scummvm-cvs-logs] SF.net SVN: scummvm: [31538] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Apr 17 17:39:35 CEST 2008


Revision: 31538
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31538&view=rev
Author:   lordhoto
Date:     2008-04-17 08:39:34 -0700 (Thu, 17 Apr 2008)

Log Message:
-----------
Properly implemented KyraEngine_v3::lineIsPassable.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_v3.cpp
    scummvm/trunk/engines/kyra/kyra_v3.h
    scummvm/trunk/engines/kyra/scene_v3.cpp

Modified: scummvm/trunk/engines/kyra/kyra_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-17 15:29:10 UTC (rev 31537)
+++ scummvm/trunk/engines/kyra/kyra_v3.cpp	2008-04-17 15:39:34 UTC (rev 31538)
@@ -95,6 +95,7 @@
 	_noStartupChat = false;
 	_lastProcessedSceneScript = 0;
 	_specialSceneScriptRunFlag = false;
+	_pathfinderFlag = 0;
 }
 
 KyraEngine_v3::~KyraEngine_v3() {

Modified: scummvm/trunk/engines/kyra/kyra_v3.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-17 15:29:10 UTC (rev 31537)
+++ scummvm/trunk/engines/kyra/kyra_v3.h	2008-04-17 15:39:34 UTC (rev 31538)
@@ -140,8 +140,10 @@
 	void timerFleaDeath(int arg);
 
 	// pathfinder
-	bool lineIsPassable(int, int) { return false; }
+	int _pathfinderFlag;
 
+	bool lineIsPassable(int x, int y);
+
 private:
 	// main menu
 	static const char *_mainMenuStrings[];

Modified: scummvm/trunk/engines/kyra/scene_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v3.cpp	2008-04-17 15:29:10 UTC (rev 31537)
+++ scummvm/trunk/engines/kyra/scene_v3.cpp	2008-04-17 15:39:34 UTC (rev 31538)
@@ -688,4 +688,39 @@
 	return false;
 }
 
+bool KyraEngine_v3::lineIsPassable(int x, int y) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v3::lineIsPassable(%d, %d)", x, y);
+	static const uint8 widthTable[] = { 1, 1, 1, 1, 1, 2, 4, 6, 8 };
+
+	if ((_pathfinderFlag & 2) && x >= 320)
+		return false;
+	if ((_pathfinderFlag & 4) && y >= 188)
+		return false;
+	if ((_pathfinderFlag & 8) && x < 0)
+		return false;
+	if (y > 187)
+		return false;
+
+	uint width = widthTable[getScale(x, y) >> 5];
+
+	if (y < 0)
+		y = 0;
+	x -= width >> 1;
+	if (x < 0)
+		x = 0;
+	int x2 = x + width;
+	if (x2 > 320)
+		x2 = 320;
+
+	for (; x < x2; ++x) {
+		if (y < _maskPageMinY || y > _maskPageMinY)
+			return false;
+
+		if (!_screen->getShapeFlag1(x, y))
+			return false;
+	}
+
+	return true;
+}
+
 } // end of namespace Kyra


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