diff options
author | Nipun Garg | 2019-06-18 05:25:23 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:47 +0200 |
commit | bb9aeb4248360bc5a57f6730ed66aea5fd46dd86 (patch) | |
tree | 81782743a56123b272e1a8e1d2439868dcd0c494 /engines | |
parent | f9b71cf6603228a4911ce10f348f321e23b5ee9d (diff) | |
download | scummvm-rg350-bb9aeb4248360bc5a57f6730ed66aea5fd46dd86.tar.gz scummvm-rg350-bb9aeb4248360bc5a57f6730ed66aea5fd46dd86.tar.bz2 scummvm-rg350-bb9aeb4248360bc5a57f6730ed66aea5fd46dd86.zip |
HDB: Add getter-setter for _mapX and _mapY
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/map-loader.cpp | 22 | ||||
-rw-r--r-- | engines/hdb/map-loader.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp index c6de98e148..090dbf3abb 100644 --- a/engines/hdb/map-loader.cpp +++ b/engines/hdb/map-loader.cpp @@ -228,4 +228,26 @@ void Map::draw() { */ } +void Map::getMapXY(int *x, int *y) { + *x = _mapX; + *y = _mapY; +} + +void Map::setMapXY(int x, int y) { + if (x < 0) { + x = 0; + } else if (x > (_width * kTileWidth - 480)) { + x = _width * kTileWidth - 480; + } + + if (y < 0) { + y = 0; + } else if (y > (_height * kTileHeight - 480)) { + y = _height * kTileHeight - 480; + } + + _mapX = x; + _mapY = y; +} + } diff --git a/engines/hdb/map-loader.h b/engines/hdb/map-loader.h index 4b0317e810..cdae918f37 100644 --- a/engines/hdb/map-loader.h +++ b/engines/hdb/map-loader.h @@ -58,6 +58,8 @@ public: int loadTiles(); bool load(Common::SeekableReadStream *stream); void draw(); + void getMapXY(int *x, int *y); + void setMapXY(int x, int y); int _mapX, _mapY; // Coordinates of Map int _mapTileX, _mapTileY; // Tile Coordinates of Map |