aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-12-17 01:18:03 +0000
committerMax Horn2003-12-17 01:18:03 +0000
commitd1c9caa127ee115ca01d534130c845f31386d81f (patch)
tree80e993d869ca9c62cde899f7cc939cbf8632ce5e
parentb4f33afb8587ea1a53a7772cc95819f2f5b4e13d (diff)
downloadscummvm-rg350-d1c9caa127ee115ca01d534130c845f31386d81f.tar.gz
scummvm-rg350-d1c9caa127ee115ca01d534130c845f31386d81f.tar.bz2
scummvm-rg350-d1c9caa127ee115ca01d534130c845f31386d81f.zip
fix various warnings; whatTarget()'s paramters shadowed member vars, but it can just b e turned into a pure function (sidenote: the chaotic mix of spaces and tabs in router.cpp doesn't help readability :-)
svn-id: r11693
-rw-r--r--sword1/logic.cpp6
-rw-r--r--sword1/router.cpp21
-rw-r--r--sword1/router.h7
3 files changed, 17 insertions, 17 deletions
diff --git a/sword1/logic.cpp b/sword1/logic.cpp
index c5d8077f56..f2c1f295be 100644
--- a/sword1/logic.cpp
+++ b/sword1/logic.cpp
@@ -1414,13 +1414,13 @@ int SwordLogic::fnFace(BsObject *cpt, int32 id, int32 targetId, int32 b, int32 c
x = (target->o_mouse_x1 + target->o_mouse_x2) / 2;
y = (target->o_mouse_y1 + target->o_mouse_y2) / 2;
}
- int32 megaTarDir = _router->whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
+ int32 megaTarDir = whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
fnTurn(cpt, id, megaTarDir, 0, 0, 0, 0, 0);
return SCRIPT_STOP;
}
int SwordLogic::fnFaceXy(BsObject *cpt, int32 id, int32 x, int32 y, int32 c, int32 d, int32 a, int32 b) {
- int megaTarDir = _router->whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
+ int megaTarDir = whatTarget(cpt->o_xcoord, cpt->o_ycoord, x, y);
fnTurn(cpt, id, megaTarDir, 0, 0, 0, 0, 0);
return SCRIPT_STOP;
}
@@ -1435,7 +1435,7 @@ int SwordLogic::fnIsFacing(BsObject *cpt, int32 id, int32 targetId, int32 b, int
} else
error("fnIsFacing:: Target isn't a mega!");
- int32 lookDir = _router->whatTarget(x, y, cpt->o_xcoord, cpt->o_ycoord);
+ int32 lookDir = whatTarget(x, y, cpt->o_xcoord, cpt->o_ycoord);
lookDir -= dir;
lookDir = abs(lookDir);
diff --git a/sword1/router.cpp b/sword1/router.cpp
index a4d2ed7006..2564583219 100644
--- a/sword1/router.cpp
+++ b/sword1/router.cpp
@@ -352,7 +352,7 @@ int32 SwordRouter::SmoothestPath()
int32 turns[4];
int32 turntable[NO_DIRECTIONS] = {0,1,3,5,7,5,3,1};
- targetDir;// no warnings
+// targetDir;// no warnings
// route.X route.Y and route.Dir start at far end
smoothPath[0].x = startX;
@@ -903,8 +903,8 @@ int32 frame;
scale = (scaleA * moduleY + scaleB);
do
{
- module16X += dx[module]*scale;
- module16Y += dy[module]*scale;
+ module16X += _dx[module]*scale;
+ module16Y += _dy[module]*scale;
moduleX = module16X >> 16;
moduleY = module16Y >> 16;
walkAnim[stepCount].frame = module;
@@ -1425,8 +1425,8 @@ int32 frame;
scale = (scaleA * moduleY + scaleB);
do
{
- module16X += dx[module]*scale;
- module16Y += dy[module]*scale;
+ module16X += _dx[module]*scale;
+ module16Y += _dy[module]*scale;
moduleX = module16X >> 16;
moduleY = module16Y >> 16;
walkAnim[stepCount].frame = module;
@@ -2340,7 +2340,7 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
if (nbars >= O_GRID_SIZE)
{
- #if DEBUG == YES //check for id > number in file,
+ #ifdef DEBUG //check for id > number in file,
error("RouteFinder Error too many bars %d", nbars);
#endif
nbars = 0;
@@ -2350,7 +2350,7 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
if (nnodes >= O_GRID_SIZE)
{
- #if DEBUG == YES //check for id > number in file,
+ #ifdef DEBUG //check for id > number in file,
error("RouteFinder Error too many nodes %d", nnodes);
#endif
nnodes = 0;
@@ -2435,9 +2435,9 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
nTurnFrames = fMegaWalkData[1];
fMegaWalkData += 2;
- memmove(&dx[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
+ memmove(&_dx[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
fMegaWalkData += NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32);
- memmove(&dy[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
+ memmove(&_dy[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
fMegaWalkData += NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32);
memmove(&modX[0],fMegaWalkData,NO_DIRECTIONS*sizeof(int32));
@@ -2527,7 +2527,6 @@ void SwordRouter::ExtractRoute()
// now shuffle route down in the buffer
routeLength = 0;
- point;
do
{
route[routeLength].x = route[point].x;
@@ -2607,7 +2606,7 @@ void SwordRouter::BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *scre
#define DIAGONALX 36
#define DIAGONALY 8
-int SwordRouter::whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
+int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
int tar_dir;
//setting up
int deltaX = destX-startX;
diff --git a/sword1/router.h b/sword1/router.h
index 3685988010..62aba682d6 100644
--- a/sword1/router.h
+++ b/sword1/router.h
@@ -99,12 +99,13 @@ class ObjectMan;
class ResMan;
class SwordScreen;
+extern int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY);
+
class SwordRouter {
public:
SwordRouter(ObjectMan *pObjMan, ResMan *pResMan);
~SwordRouter(void);
int32 routeFinder(int32 id, BsObject *mega, int32 x, int32 y, int32 dir);
- int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY);
void setPlayerTarget(int32 x, int32 y, int32 dir, int32 stance);
void resetExtraData(void);
@@ -146,8 +147,8 @@ private:
int32 framesPerStep, framesPerChar;
uint8 nWalkFrames, nTurnFrames;
- int32 dx[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
- int32 dy[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
+ int32 _dx[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
+ int32 _dy[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
int32 modX[NO_DIRECTIONS];
int32 modY[NO_DIRECTIONS];
int32 diagonalx, diagonaly;