[Scummvm-cvs-logs] CVS: scummvm/gob goblin.cpp,1.22,1.23 map.cpp,1.15,1.16 map.h,1.8,1.9
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Sun Dec 18 01:58:01 CET 2005
Update of /cvsroot/scummvm/scummvm/gob
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26210
Modified Files:
goblin.cpp map.cpp map.h
Log Message:
Minor simplification.
Index: goblin.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/goblin.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- goblin.cpp 18 Oct 2005 01:30:17 -0000 1.22
+++ goblin.cpp 18 Dec 2005 09:57:44 -0000 1.23
@@ -969,9 +969,7 @@
void gob_initiateMove(void) {
map_findNearestToDest();
map_findNearestToGob();
-
- map_nearestWayPoint =
- map_optimizePoints(map_curGoblinX, map_curGoblinY);
+ map_optimizePoints();
gob_pathExistence = map_checkDirectPath(map_curGoblinX, map_curGoblinY,
gob_pressedMapX, gob_pressedMapY);
@@ -1237,8 +1235,7 @@
map_curGoblinX = gob_gobPositions[gob_currentGoblin].x;
map_curGoblinY = gob_gobPositions[gob_currentGoblin].y;
- if (map_curGoblinX == gob_gobDestX &&
- map_curGoblinY == gob_gobDestY) {
+ if (map_curGoblinX == gob_gobDestX && map_curGoblinY == gob_gobDestY) {
gob_pathExistence = 1;
map_destX = gob_pressedMapX;
map_destY = gob_pressedMapY;
@@ -1248,13 +1245,10 @@
gob_gobDestX, gob_gobDestY) == 1) {
map_destX = gob_gobDestX;
map_destY = gob_gobDestY;
- } else if (map_curGoblinX == map_destX
- && map_curGoblinY == map_destY) {
+ } else if (map_curGoblinX == map_destX && map_curGoblinY == map_destY) {
if (map_nearestWayPoint > map_nearestDest) {
- map_nearestWayPoint =
- map_optimizePoints(map_curGoblinX,
- map_curGoblinY);
+ map_optimizePoints();
map_destX =
map_wayPoints[map_nearestWayPoint].
@@ -1263,14 +1257,10 @@
map_wayPoints[map_nearestWayPoint].
y;
- if (map_nearestWayPoint >
- map_nearestDest)
+ if (map_nearestWayPoint > map_nearestDest)
map_nearestWayPoint--;
- } else if (map_nearestWayPoint <
- map_nearestDest) {
- map_nearestWayPoint =
- map_optimizePoints(map_curGoblinX,
- map_curGoblinY);
+ } else if (map_nearestWayPoint < map_nearestDest) {
+ map_optimizePoints();
map_destX =
map_wayPoints[map_nearestWayPoint].
Index: map.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/map.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- map.cpp 22 Nov 2005 13:17:08 -0000 1.15
+++ map.cpp 18 Dec 2005 09:57:44 -0000 1.16
@@ -376,23 +376,22 @@
}
}
-int16 map_optimizePoints(int16 xPos, int16 yPos) {
+void map_optimizePoints(void) {
int16 i;
if (map_nearestWayPoint < map_nearestDest) {
for (i = map_nearestWayPoint; i <= map_nearestDest; i++) {
- if (map_checkDirectPath(xPos, yPos,
+ if (map_checkDirectPath(map_curGoblinX, map_curGoblinY,
map_wayPoints[i].x, map_wayPoints[i].y) == 1)
map_nearestWayPoint = i;
}
} else if (map_nearestWayPoint > map_nearestDest) {
for (i = map_nearestWayPoint; i >= map_nearestDest; i--) {
- if (map_checkDirectPath(xPos, yPos,
+ if (map_checkDirectPath(map_curGoblinX, map_curGoblinY,
map_wayPoints[i].x, map_wayPoints[i].y) == 1)
map_nearestWayPoint = i;
}
}
- return map_nearestWayPoint;
}
void map_loadDataFromAvo(char *dest, int16 size) {
Index: map.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/map.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- map.h 18 Oct 2005 01:30:17 -0000 1.8
+++ map.h 18 Dec 2005 09:57:44 -0000 1.9
@@ -38,18 +38,20 @@
};
#pragma START_PACK_STRUCTS
-#define szMap_Point 4
+
typedef struct Map_Point {
int16 x;
int16 y;
} GCC_PACK Map_Point;
#define szMap_ItemPos 3
-typedef struct Map_ItemPos {
+
+ typedef struct Map_ItemPos {
int8 x;
int8 y;
int8 orient; // ??
} GCC_PACK Map_ItemPos;
+
#pragma END_PACK_STRUCTS
extern int8 map_passMap[28][26]; // [y][x]
@@ -74,7 +76,7 @@
void map_findNearestToDest(void);
int16 map_checkDirectPath(int16 x0, int16 y0, int16 x1, int16 y1);
int16 map_checkLongPath(int16 x0, int16 y0, int16 x1, int16 y1, int16 i0, int16 i1);
-int16 map_optimizePoints(int16 xPos, int16 yPos);
+void map_optimizePoints(void);
void map_loadItemToObject(void);
void map_loadMapObjects(char *avjFile);
void map_loadDataFromAvo(int8 *dest, int16 size);
More information about the Scummvm-git-logs
mailing list