[Scummvm-cvs-logs] SF.net SVN: scummvm: [20805] scummvm/trunk/engines/sword1

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Tue Feb 21 02:23:06 CET 2006


Revision: 20805
Author:   eriktorbjorn
Date:     2006-02-21 02:22:37 -0800 (Tue, 21 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20805&view=rev

Log Message:
-----------
Removed the "extra bars/nodes" code, since nothing ever added the extra bars or
nodes.

Removed the path-plotting debugging code, since the line-drawing function has
been a stub for the past few years, as far as I can tell.

Similar code was removed from the BS2 router long ago, so this could be a first
tiny step towards bringing them together.

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/logic.cpp
    scummvm/trunk/engines/sword1/router.cpp
    scummvm/trunk/engines/sword1/router.h
Modified: scummvm/trunk/engines/sword1/logic.cpp
===================================================================
--- scummvm/trunk/engines/sword1/logic.cpp	2006-02-21 09:25:39 UTC (rev 20804)
+++ scummvm/trunk/engines/sword1/logic.cpp	2006-02-21 10:22:37 UTC (rev 20805)
@@ -87,7 +87,6 @@
 	_screen->useTextManager(_textMan);
 	_textRunning = _speechRunning = false;
 	_speechFinished = true;
-	_router->resetExtraData();
 }
 
 void Logic::newScreen(uint32 screen) {
@@ -1390,7 +1389,6 @@
 	int32 routeRes = _router->routeFinder(id, cpt, x, y, dir);
 
 	if (id == PLAYER) {
-		_router->resetExtraData();
 		if ((routeRes == 1) || (routeRes == 2)) {
 			_scriptVars[MEGA_ON_GRID] = 0;
 			_scriptVars[REROUTE_GEORGE] = 0;

Modified: scummvm/trunk/engines/sword1/router.cpp
===================================================================
--- scummvm/trunk/engines/sword1/router.cpp	2006-02-21 09:25:39 UTC (rev 20804)
+++ scummvm/trunk/engines/sword1/router.cpp	2006-02-21 10:22:37 UTC (rev 20805)
@@ -68,13 +68,10 @@
 #define		SLOW_IN								3
 #define		SLOW_OUT							7
 #define		ROUTE_END_FLAG				255
-//#define		PLOT_PATHS						1
-#undef		PLOT_PATHS
 
 Router::Router(ObjectMan *pObjMan, ResMan *pResMan) {
 	_objMan = pObjMan;
 	_resMan = pResMan;
-	_numExtraBars = _numExtraNodes = 0;
 	nnodes = nbars = 0;
 	_playerTargetX = _playerTargetY = _playerTargetDir = _playerTargetStance = 0;
 	diagonalx = diagonaly = 0;
@@ -402,19 +399,6 @@
 		}
 		while ((steps == 0) && (i < 4));
 
-#ifdef PLOT_PATHS	// plot the best path
-		if (steps != 0)
-		{
-			i = 0;
-			do
-			{
-				RouteLine(smoothPath[i].x, smoothPath[i].y, smoothPath[i+1].x, smoothPath[i+1].y, 228);
-				i = i + 1;
-			}
-			while (i < steps);
-		}
-#endif
-
 		if (steps == 0)
 		{
 			/*Tdebug("BestTurns failed %d %d %d %d",route[p].x, route[p].y, route[p + 1].x, route[p + 1].y);
@@ -1537,9 +1521,6 @@
 	{
 		if (!Check(modularPath[i].x, modularPath[i].y, modularPath[i+1].x, modularPath[i+1].y))
 			p=0;
-#ifdef PLOT_PATHS
-		RouteLine(modularPath[i].x, modularPath[i].y, modularPath[i+1].x, modularPath[i+1].y, 227);
-#endif
 		i += 1;
 	}
 	while (i<p-1);
@@ -1696,14 +1677,6 @@
 			{
 				steps = step1 + step2;	// yes
 				options = options + 2;
-#ifdef PLOT_PATHS
-				if (status == 1)
-					RouteLine(x1, y1, x1+dx, y1, 231);
-#endif
-#ifdef PLOT_PATHS
-				if (status == 1)
-					RouteLine(x1+dx, y1, x2, y2, 231);
-#endif
 			}
 		}
 		//diagonal, square a code 2 route
@@ -1717,14 +1690,6 @@
 				{
 					steps = step1 + step2;	// yes
 					options = options + 4;
-#ifdef PLOT_PATHS
-					if (status == 1)
-						RouteLine(x1, y1, x1+dlx,y1+dly, 231);
-#endif
-#ifdef PLOT_PATHS
-					if (status == 1)
-						RouteLine(x1+dlx, y2, x2, y2, 231);
-#endif
 				}
 			}
 		}
@@ -1742,18 +1707,6 @@
 					{
 						steps = step1 + step2 + step3;	// yes
 						options = options + 1;
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1, y1, x1+dx/2, y1, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1+dx/2, y1, x1+dx/2+dlx, y2, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1+dx/2+dlx, y2, x2, y2, 231);
-#endif
 					}
 				}
 			}
@@ -1771,18 +1724,6 @@
 					if (step3 != 0)
 					{
 						steps = step1 + step2 + step3;	// yes
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1, y1, x1+dlx/2, y1+dly/2, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1+dlx/2, y1+dly/2, x1+dx+dlx/2, y1+dly/2, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1+dx+dlx/2, y1+dly/2, x2, y2, 231);
-#endif
 						options = options + 8;
 					}
 				}
@@ -1808,14 +1749,6 @@
 			if (step2 != 0)
 			{
 				steps = step1 + step2;	// yes
-#ifdef PLOT_PATHS
-				if (status == 1)
-					RouteLine(x1 ,y1 ,x1 ,y1+dy, 231);
-#endif
-#ifdef PLOT_PATHS
-				if (status == 1)
-					RouteLine(x1 ,y1+dy ,x2, y2, 231);
-#endif
 				options = options + 2;
 			}
 		}
@@ -1829,14 +1762,6 @@
 				if (step2 != 0)
 				{
 					steps = step1 + step2;	// yes
-#ifdef PLOT_PATHS
-					if (status == 1)
-						RouteLine(x1, y1, x2, y1+dly, 231);
-#endif
-#ifdef PLOT_PATHS
-					if (status == 1)
-						RouteLine(x2, y1+dly, x2, y2, 231);
-#endif
 					options = options + 4;
 				}
 			}
@@ -1854,18 +1779,6 @@
 					if (step3 != 0)
 					{
 						steps = step1 + step2 + step3;	// yes
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1, y1, x1, y1+dy/2, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1, y1+dy/2, x2, y1+dy/2+dly, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x2, y1+dy/2+dly, x2, y2, 231);
-#endif
 						options = options + 1;
 					}
 				}
@@ -1885,18 +1798,6 @@
 					{
 						steps = step1 + step2 + step3;	// yes
 						options = options + 8;
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1, y1, x1+dlx/2, y1+dly/2, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1+dlx/2, y1+dly/2, x1+dlx/2, y1+dy+dly/2, 231);
-#endif
-#ifdef PLOT_PATHS
-						if (status == 1)
-							RouteLine(x1+dlx/2, y1+dy+dly/2, x2, y2, 231);
-#endif
 					}
 				}
 			}
@@ -2219,7 +2120,6 @@
 {
 	WalkGridHeader	floorHeader;
 	int32 	i;
-	int32 	j;
 	uint8  *fPolygrid;
 	uint8  *fMegaWalkData;
 
@@ -2302,29 +2202,7 @@
 
 
 	// floor grid loaded
-	// if its george copy extra bars and nodes
 
-	if (megaId == GEORGE)
-	{
-		// copy any extra bars from extraBars array
-
-		//Zdebug("%d", nExtraBars);
-
-	 	memmove(&bars[nbars], &_extraBars[0], _numExtraBars*sizeof(BarData));
-		nbars += _numExtraBars;
-
-		// copy any extra nodes from extraNode array
-		j = 0;
-		while (j < _numExtraNodes)//array starts at 0
-		{
-			node[nnodes+j].x = _extraNodes[j].x ;
-			node[nnodes+j].y = _extraNodes[j].y ;
-			j++;
-		}
-
-		nnodes += _numExtraNodes;
-	}
-
 // copy the mega structure into the local variables for use in all subroutines
 
 	startX = megaObject->o_xcoord;
@@ -2463,9 +2341,6 @@
 	p = 0;
 	do
 	{
-#ifdef PLOT_PATHS
-		BresenhamLine(route[p+1].x-128,route[p+1].y-128, route[p].x-128,route[p].y-128, (uint8*)screen_ad, true_pixel_size_x, pixel_size_y, ROUTE_END_FLAG);
-#endif
 		dx = route[p+1].x - route[p].x;
 		dy = route[p+1].y - route[p].y;
 		dirx = 1;
@@ -2513,19 +2388,6 @@
 	return;
 }
 
-#define screen_ad NULL
-#define pixel_size_y 1
-#define true_pixel_size_x 1
-void Router::RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour)
-{
-	BresenhamLine(x1-128, y1-128, x2-128, y2-128, (uint8*)screen_ad, true_pixel_size_x, pixel_size_y, colour);
-	return;
-}
-
-void Router::BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *screen, int32 width, int32 height, int32 colour) {
-
-}
-
 #define DIAGONALX 36
 #define DIAGONALY 8
 int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
@@ -2568,10 +2430,6 @@
 	return tar_dir;
 }
 
-void Router::resetExtraData(void) {
-	_numExtraBars = _numExtraNodes = 0;
-}
-
 void Router::setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance) {
 	_playerTargetX = x;
 	_playerTargetY = y;

Modified: scummvm/trunk/engines/sword1/router.h
===================================================================
--- scummvm/trunk/engines/sword1/router.h	2006-02-21 09:25:39 UTC (rev 20804)
+++ scummvm/trunk/engines/sword1/router.h	2006-02-21 10:22:37 UTC (rev 20805)
@@ -28,7 +28,6 @@
 
 namespace Sword1 {
 
-#define EXTRA_GRID_SIZE 20
 #define O_GRID_SIZE 200
 
 #if !defined(__GNUC__)
@@ -99,20 +98,16 @@
 	Router(ObjectMan *pObjMan, ResMan *pResMan);
 	int32 routeFinder(int32 id, Object *mega, int32 x, int32 y, int32 dir);
 	void setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance);
-	void resetExtraData(void);
 
 	// these should be private but are read by Screen for debugging:
-	BarData   bars[O_GRID_SIZE+EXTRA_GRID_SIZE];
-	NodeData  node[O_GRID_SIZE+EXTRA_GRID_SIZE];
+	BarData   bars[O_GRID_SIZE];
+	NodeData  node[O_GRID_SIZE];
 	int32 nbars, nnodes;
 private:
 	// when the player collides with another mega, we'll receive a ReRouteRequest here.
 	// that's why we need to remember the player's target coordinates
 	int32 _playerTargetX, _playerTargetY, _playerTargetDir, _playerTargetStance;
-	// additional route data to block parts of the floor and enable routine around megas:
-	int32 _numExtraBars, _numExtraNodes;
-	BarData _extraBars[EXTRA_GRID_SIZE];
-	NodeData _extraNodes[EXTRA_GRID_SIZE];
+
 	ObjectMan *_objMan;
 	ResMan *_resMan;
 
@@ -171,8 +166,6 @@
 
 	int32 SolidPath();
 	int32 SolidWalkAnimator(WalkData *walkAnim);
-	void RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour);
-	void BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *screen, int32 width, int32 height, int32 colour);
 };
 
 } // End of namespace Sword1







More information about the Scummvm-git-logs mailing list