aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-22 22:23:34 +0530
committerEugene Sandulenko2019-09-03 17:16:56 +0200
commitb2ee1c680292b0a16544d2a583db2fd730522878 (patch)
tree7c7472763b103055e0dd463d3ab4cbf92a682a5b
parentef7eaa925748c17765079b837eae5d42e6dd948e (diff)
downloadscummvm-rg350-b2ee1c680292b0a16544d2a583db2fd730522878.tar.gz
scummvm-rg350-b2ee1c680292b0a16544d2a583db2fd730522878.tar.bz2
scummvm-rg350-b2ee1c680292b0a16544d2a583db2fd730522878.zip
HDB: Add checkOneTileExistInRange()
-rw-r--r--engines/hdb/map-loader.cpp10
-rw-r--r--engines/hdb/map-loader.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp
index 0cf84e4f69..17da352e27 100644
--- a/engines/hdb/map-loader.cpp
+++ b/engines/hdb/map-loader.cpp
@@ -916,4 +916,14 @@ void Map::centerMapXY(int x, int y) {
setMapXY(x, y);
}
+bool Map::checkOneTileExistInRange(int tileIndex, int count) {
+ for (int i = 0; i < _width*_height;i++) {
+ if (_background[i] >= tileIndex && _background[i] < tileIndex + count)
+ return true;
+ if (_foreground[i] >= tileIndex && _foreground[i] < tileIndex + count)
+ return true;
+ }
+ return true;
+}
+
}
diff --git a/engines/hdb/map-loader.h b/engines/hdb/map-loader.h
index da8b7d6713..f59159a699 100644
--- a/engines/hdb/map-loader.h
+++ b/engines/hdb/map-loader.h
@@ -92,6 +92,9 @@ public:
void setMapXY(int x, int y);
void centerMapXY(int x, int y);
+ // Check if one of the tiles in a range exists in the map on either layer
+ bool checkOneTileExistInRange(int tileIndex, int count);
+
int _mapX, _mapY; // Coordinates of Map
int _mapTileX, _mapTileY; // Tile Coordinates of Map
int _mapTileXOff, _mapTileYOff; // Tile Coordinates Offset (0-31)