From 2eacf30d8204b2a94750bccb01920645fa125699 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Tue, 18 Jun 2019 05:35:00 +0530 Subject: HDB: Add getMapBGTileIndex() + getMapFGTileIndex() --- engines/hdb/map-loader.cpp | 14 ++++++++++++++ engines/hdb/map-loader.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp index 090dbf3abb..c5d682c03a 100644 --- a/engines/hdb/map-loader.cpp +++ b/engines/hdb/map-loader.cpp @@ -228,6 +228,20 @@ void Map::draw() { */ } +uint16 Map::getMapBGTileIndex(int x, int y) { + if (x < 0 || x >= _width || y < 0 || y >= _height) { + return 0; + } + return _background[y * _width + x]; +} + +uint16 Map::getMapFGTileIndex(int x, int y) { + if (x < 0 || x >= _width || y < 0 || y >= _height) { + return 0; + } + return _foreground[y * _width + x]; +} + void Map::getMapXY(int *x, int *y) { *x = _mapX; *y = _mapY; diff --git a/engines/hdb/map-loader.h b/engines/hdb/map-loader.h index cdae918f37..35f1357ec3 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(); + uint16 getMapBGTileIndex(int x, int y); + uint16 getMapFGTileIndex(int x, int y); void getMapXY(int *x, int *y); void setMapXY(int x, int y); -- cgit v1.2.3