aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/map.cpp24
-rw-r--r--engines/gob/map.h56
-rw-r--r--engines/gob/map_v1.cpp3
3 files changed, 32 insertions, 51 deletions
diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp
index 03708298d7..ba02c1727e 100644
--- a/engines/gob/map.cpp
+++ b/engines/gob/map.cpp
@@ -76,6 +76,30 @@ Map::~Map() {
delete[] _wayPoints;
}
+int8 Map::getPass(int x, int y, int width) const {
+ if (!_passMap)
+ return 0;
+
+ if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
+ return 0;
+
+ if (width == -1)
+ width = _passWidth;
+ return _passMap[y * width + x];
+}
+
+void Map::setPass(int x, int y, int8 pass, int width) {
+ if (!_passMap)
+ return;
+
+ if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
+ return;
+
+ if (width == -1)
+ width = _passWidth;
+ _passMap[y * width + x] = pass;
+}
+
void Map::placeItem(int16 x, int16 y, int16 id) {
if ((getItem(x, y) & 0xFF00) != 0)
setItem(x, y, (getItem(x, y) & 0xFF00) | id);
diff --git a/engines/gob/map.h b/engines/gob/map.h
index a38826d1d0..a3919cdeb7 100644
--- a/engines/gob/map.h
+++ b/engines/gob/map.h
@@ -103,6 +103,12 @@ public:
ItemPos _itemPoses[40];
char _sourceFile[15];
+ Map(GobEngine *vm);
+ virtual ~Map();
+
+ int8 getPass(int x, int y, int width = -1) const;
+ void setPass(int x, int y, int8 pass, int width = -1);
+
void findNearestWalkable(int16 &gobDestX, int16 &gobDestY,
int16 mouseX, int16 mouseY);
@@ -120,17 +126,11 @@ public:
virtual int16 getItem(int x, int y) = 0;
virtual void setItem(int x, int y, int16 item) = 0;
- virtual int8 getPass(int x, int y, int heightOff = -1) = 0;
- virtual void setPass(int x, int y, int8 pass, int heightOff = -1) = 0;
-
virtual void loadMapObjects(const char *avjFile) = 0;
virtual void findNearestToGob(Mult::Mult_Object *obj) = 0;
virtual void findNearestToDest(Mult::Mult_Object *obj) = 0;
virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) = 0;
- Map(GobEngine *vm);
- virtual ~Map();
-
protected:
bool _loadFromAvo;
@@ -167,26 +167,6 @@ public:
_itemsMap[y][x] = item;
}
- virtual int8 getPass(int x, int y, int heightOff = -1) {
- if (!_passMap)
- return 0;
-
- if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
- return 0;
-
- return _passMap[y * _mapWidth + x];
- }
-
- virtual void setPass(int x, int y, int8 pass, int heightOff = -1) {
- if (!_passMap)
- return;
-
- if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
- return;
-
- _passMap[y * _mapWidth + x] = pass;
- }
-
Map_v1(GobEngine *vm);
virtual ~Map_v1();
@@ -205,30 +185,6 @@ public:
virtual void findNearestToDest(Mult::Mult_Object *obj);
virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y);
- virtual int8 getPass(int x, int y, int heightOff = -1) {
- if (!_passMap)
- return 0;
-
- if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
- return 0;
-
- if (heightOff == -1)
- heightOff = _passWidth;
- return _passMap[y * heightOff + x];
- }
-
- virtual void setPass(int x, int y, int8 pass, int heightOff = -1) {
- if (!_passMap)
- return;
-
- if ((x < 0) || (y < 0) || (x >= _mapWidth) || (y >= _mapHeight))
- return;
-
- if (heightOff == -1)
- heightOff = _passWidth;
- _passMap[y * heightOff + x] = pass;
- }
-
Map_v2(GobEngine *vm);
virtual ~Map_v2();
diff --git a/engines/gob/map_v1.cpp b/engines/gob/map_v1.cpp
index d8898c83d3..9503c97260 100644
--- a/engines/gob/map_v1.cpp
+++ b/engines/gob/map_v1.cpp
@@ -44,7 +44,8 @@ void Map_v1::init() {
if (_passMap || _itemsMap)
return;
- _mapWidth = 26;
+ _passWidth = 26;
+ _mapWidth = 26;
_mapHeight = 28;
_passMap = new int8[_mapHeight * _mapWidth];