aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNipun Garg2019-06-25 02:04:53 +0530
committerEugene Sandulenko2019-09-03 17:16:59 +0200
commit595b520f4aaff697b62d049928763eafab29f3c0 (patch)
treecdeac906030792efc9f45241913fccc834472b62 /engines
parent855fd3805cde972f6a702206b8ea2a16f95483af (diff)
downloadscummvm-rg350-595b520f4aaff697b62d049928763eafab29f3c0.tar.gz
scummvm-rg350-595b520f4aaff697b62d049928763eafab29f3c0.tar.bz2
scummvm-rg350-595b520f4aaff697b62d049928763eafab29f3c0.zip
HDB: Add checkEntOnScreen() and checkXYOnScreen()
Diffstat (limited to 'engines')
-rw-r--r--engines/hdb/map-loader.cpp8
-rw-r--r--engines/hdb/map-loader.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp
index c8a31f5364..04a5ee6c2f 100644
--- a/engines/hdb/map-loader.cpp
+++ b/engines/hdb/map-loader.cpp
@@ -942,6 +942,14 @@ void Map::centerMapXY(int x, int y) {
setMapXY(x, y);
}
+bool Map::checkEntOnScreen(AIEntity *e) {
+ return ((e->x > _mapX - 32) && (e->x < _mapX + kScreenXTiles * kTileWidth) && (e->y > _mapY - 32) && (e->y < kScreenYTiles * kTileHeight));
+}
+
+bool Map::checkXYOnScreen(int x, int y) {
+ return ((x > _mapX - 32) && (x < _mapX + kScreenXTiles * kTileWidth) && (y > _mapY - 32) && (y < kScreenYTiles * kTileHeight));
+}
+
bool Map::checkOneTileExistInRange(int tileIndex, int count) {
for (int i = 0; i < _width*_height; i++) {
if (_background[i] >= tileIndex && _background[i] < tileIndex + count)
diff --git a/engines/hdb/map-loader.h b/engines/hdb/map-loader.h
index 69c82a8ee5..f94c2a77a2 100644
--- a/engines/hdb/map-loader.h
+++ b/engines/hdb/map-loader.h
@@ -101,6 +101,8 @@ public:
void getMapXY(int *x, int *y);
void setMapXY(int x, int y);
void centerMapXY(int x, int y);
+ bool checkEntOnScreen(AIEntity *);
+ bool checkXYOnScreen(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);