aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-02-21 10:22:37 +0000
committerTorbjörn Andersson2006-02-21 10:22:37 +0000
commitc5cf806f8276786017bd69e61a2db1c014ec52ce (patch)
treee9ff01f87ccc586cb75328bd6b3311c710c65059
parentdd6b20702546a52e871df1eaeb2a752238437e24 (diff)
downloadscummvm-rg350-c5cf806f8276786017bd69e61a2db1c014ec52ce.tar.gz
scummvm-rg350-c5cf806f8276786017bd69e61a2db1c014ec52ce.tar.bz2
scummvm-rg350-c5cf806f8276786017bd69e61a2db1c014ec52ce.zip
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. svn-id: r20805
-rw-r--r--engines/sword1/logic.cpp2
-rw-r--r--engines/sword1/router.cpp142
-rw-r--r--engines/sword1/router.h13
3 files changed, 3 insertions, 154 deletions
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index 27108e9e51..0b789559e0 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -87,7 +87,6 @@ void Logic::initialize(void) {
_screen->useTextManager(_textMan);
_textRunning = _speechRunning = false;
_speechFinished = true;
- _router->resetExtraData();
}
void Logic::newScreen(uint32 screen) {
@@ -1390,7 +1389,6 @@ int Logic::fnWalk(Object *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stan
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;
diff --git a/engines/sword1/router.cpp b/engines/sword1/router.cpp
index d8a2cf3c95..68f8ca6756 100644
--- a/engines/sword1/router.cpp
+++ b/engines/sword1/router.cpp
@@ -68,13 +68,10 @@ namespace Sword1 {
#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 @@ int32 Router::SmoothestPath()
}
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 @@ int32 Router::SolidWalkAnimator(WalkData *walkAnim)
{
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
{
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
{
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
{
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
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 @@ int32 Router::NewCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2)
{
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 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
{
WalkGridHeader floorHeader;
int32 i;
- int32 j;
uint8 *fPolygrid;
uint8 *fMegaWalkData;
@@ -2302,28 +2202,6 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
// 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
@@ -2463,9 +2341,6 @@ void Router::ExtractRoute()
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 @@ void Router::ExtractRoute()
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 @@ int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
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;
diff --git a/engines/sword1/router.h b/engines/sword1/router.h
index e7c835f6d2..ca660d1b8f 100644
--- a/engines/sword1/router.h
+++ b/engines/sword1/router.h
@@ -28,7 +28,6 @@
namespace Sword1 {
-#define EXTRA_GRID_SIZE 20
#define O_GRID_SIZE 200
#if !defined(__GNUC__)
@@ -99,20 +98,16 @@ public:
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 @@ private:
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