aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2010-10-30 17:26:06 +0000
committerSven Hesse2010-10-30 17:26:06 +0000
commit4c23f3e1631ed904fa67b77b964e73aae4873850 (patch)
tree82a1deffcaf8ed9343dc01a62e81ffb5af8d4a3d
parent1612a96285d4da48208fad2f704a6335925deac5 (diff)
downloadscummvm-rg350-4c23f3e1631ed904fa67b77b964e73aae4873850.tar.gz
scummvm-rg350-4c23f3e1631ed904fa67b77b964e73aae4873850.tar.bz2
scummvm-rg350-4c23f3e1631ed904fa67b77b964e73aae4873850.zip
GOB: Make Map::_passMap protected and group some vars
svn-id: r53948
-rw-r--r--engines/gob/map.cpp38
-rw-r--r--engines/gob/map.h19
-rw-r--r--engines/gob/map_v1.cpp2
-rw-r--r--engines/gob/map_v2.cpp8
4 files changed, 40 insertions, 27 deletions
diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp
index ba02c1727e..e20a51b0c6 100644
--- a/engines/gob/map.cpp
+++ b/engines/gob/map.cpp
@@ -32,33 +32,39 @@
namespace Gob {
Map::Map(GobEngine *vm) : _vm(vm) {
- _widthByte = 0;
- _mapWidth = -1;
+ _passWidth = 0;
+ _mapWidth = -1;
_mapHeight = -1;
- _screenWidth = 0;
+ _passMap = 0;
+
+ _widthByte = 0;
+
+ _screenWidth = 0;
_screenHeight = 0;
- _tilesWidth = 0;
- _tilesHeight = 0;
- _passWidth = 0;
+ _tilesWidth = 0;
+ _tilesHeight = 0;
- _passMap = 0;
- _itemsMap = 0;
- _wayPointsCount = 0;
- _wayPoints = 0;
_bigTiles = false;
+ _wayPointCount = 0;
+ _wayPoints = 0;
+
+ _nearestWayPoint = 0;
+ _nearestDest = 0;
+
+ _itemsMap = 0;
+
for (int i = 0; i < 40; i++) {
- _itemPoses[i].x = 0;
- _itemPoses[i].y = 0;
+ _itemPoses[i].x = 0;
+ _itemPoses[i].y = 0;
_itemPoses[i].orient = 0;
}
- _nearestWayPoint = 0;
- _nearestDest = 0;
_curGoblinX = 0;
_curGoblinY = 0;
_destX = 0;
_destY = 0;
+
_sourceFile[0] = 0;
_loadFromAvo = false;
@@ -285,7 +291,7 @@ int16 Map::findNearestWayPoint(int16 x, int16 y) {
length = 30000;
- for (int i = 0; i < _wayPointsCount; i++) {
+ for (int i = 0; i < _wayPointCount; i++) {
if ((_wayPoints[i].x < 0) || (_wayPoints[i].x >= _mapWidth) ||
(_wayPoints[i].y < 0) || (_wayPoints[i].y >= _mapHeight))
break;
@@ -419,7 +425,7 @@ int16 Map::checkDirectPath(Mult::Mult_Object *obj, int16 x0, int16 y0, int16 x1,
// Check for a blocking waypoint
if (obj->nearestWayPoint < obj->nearestDest)
- if ((obj->nearestWayPoint + 1) < _wayPointsCount)
+ if ((obj->nearestWayPoint + 1) < _wayPointCount)
if (_wayPoints[obj->nearestWayPoint + 1].notWalkable == 1)
return 3;
diff --git a/engines/gob/map.h b/engines/gob/map.h
index a3919cdeb7..f1cd91d6d0 100644
--- a/engines/gob/map.h
+++ b/engines/gob/map.h
@@ -77,24 +77,28 @@ public:
#include "common/pack-end.h" // END STRUCT PACKING
- byte _widthByte;
int16 _mapWidth;
int16 _mapHeight;
+
+ byte _widthByte;
+
int16 _screenWidth;
int16 _screenHeight;
int16 _tilesWidth;
int16 _tilesHeight;
- int16 _passWidth;
+
bool _bigTiles;
+
bool _mapUnknownBool;
- int8 *_passMap; // [y * _mapWidth + x], getPass(x, y);
- int16 **_itemsMap; // [y][x]
- int16 _wayPointsCount;
+ int16 _wayPointCount;
Point *_wayPoints;
+
int16 _nearestWayPoint;
int16 _nearestDest;
+ int16 **_itemsMap; // [y][x]
+
int16 _curGoblinX;
int16 _curGoblinY;
int16 _destX;
@@ -132,9 +136,12 @@ public:
virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) = 0;
protected:
+ GobEngine *_vm;
+
bool _loadFromAvo;
- GobEngine *_vm;
+ int16 _passWidth;
+ int8 *_passMap; // [y * _mapWidth + x], getPass(x, y);
int16 findNearestWayPoint(int16 x, int16 y);
diff --git a/engines/gob/map_v1.cpp b/engines/gob/map_v1.cpp
index 9503c97260..92e1d3a03b 100644
--- a/engines/gob/map_v1.cpp
+++ b/engines/gob/map_v1.cpp
@@ -57,7 +57,7 @@ void Map_v1::init() {
memset(_itemsMap[i], 0, _mapWidth * sizeof(int16));
}
- _wayPointsCount = 40;
+ _wayPointCount = 40;
_wayPoints = new Point[40];
memset(_wayPoints, 0, sizeof(Point));
}
diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp
index 83f02bb69b..7460128ca9 100644
--- a/engines/gob/map_v2.cpp
+++ b/engines/gob/map_v2.cpp
@@ -114,7 +114,7 @@ void Map_v2::loadMapObjects(const char *avjFile) {
_screenHeight = 200;
}
- _wayPointsCount = mapData.readByte();
+ _wayPointCount = mapData.readByte();
_tilesWidth = mapData.readSint16LE();
_tilesHeight = mapData.readSint16LE();
@@ -133,13 +133,13 @@ void Map_v2::loadMapObjects(const char *avjFile) {
mapData.skip(_mapWidth * _mapHeight);
if (resource->getData()[0] == 1)
- wayPointsCount = _wayPointsCount = 40;
+ wayPointsCount = _wayPointCount = 40;
else
- wayPointsCount = _wayPointsCount == 0 ? 1 : _wayPointsCount;
+ wayPointsCount = _wayPointCount == 0 ? 1 : _wayPointCount;
delete[] _wayPoints;
_wayPoints = new Point[wayPointsCount];
- for (int i = 0; i < _wayPointsCount; i++) {
+ for (int i = 0; i < _wayPointCount; i++) {
_wayPoints[i].x = mapData.readSByte();
_wayPoints[i].y = mapData.readSByte();
_wayPoints[i].notWalkable = mapData.readSByte();