From b0146ffd2d7d0bef7f091bd766614c4503f94887 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Sat, 8 Jun 2019 00:21:32 +0530 Subject: HDB: Call DrawMan::setSky from Map::load --- engines/hdb/map-loader.cpp | 47 +++++++++++++++++++++++++--------------------- engines/hdb/map-loader.h | 2 +- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp index 9537224ce3..aa20a8a7a7 100644 --- a/engines/hdb/map-loader.cpp +++ b/engines/hdb/map-loader.cpp @@ -28,6 +28,26 @@ Map::Map() { _mapLoaded = false; } +int Map::loadTiles() { + + int tile, temp; + int skyIndex = 0; + + // Load all tiles + for (uint j = 0; j < _height; j++) { + for (uint i = 0; i < _width; i++) { + tile = _background[j * _width + i]; + if ((temp = g_hdb->_drawMan->isSky(tile)) && !skyIndex) { + skyIndex = temp; + } + g_hdb->_drawMan->getTile(tile); + g_hdb->_drawMan->getTile(_foreground[j * _width + i]); + } + } + + return skyIndex; +} + bool Map::load(Common::SeekableReadStream *stream) { if (_mapLoaded) { return false; @@ -87,31 +107,16 @@ bool Map::load(Common::SeekableReadStream *stream) { _mapExpBarrels = new byte[_width * _height]; _mapLaserBeams = new byte[_width * _height]; - + int sky = loadTiles(); + g_hdb->_drawMan->setSky(sky); _mapX = _mapY = 0; + + /* + TODO: Add the animating tile lists + */ _mapLoaded = true; return true; } - -int Map::loadTiles() { - - int tile, temp; - int skyIndex = 0; - - // Load all tiles - for (uint j = 0; j < _height; j++) { - for (uint i = 0; i < _width; i++) { - tile = _background[j * _width + i]; - if ((temp = g_hdb->_drawMan->isSky(tile)) && !skyIndex) { - skyIndex = temp; - } - g_hdb->_drawMan->getTile(tile); - g_hdb->_drawMan->getTile(_foreground[j * _width + i]); - } - } - - return skyIndex; -} } diff --git a/engines/hdb/map-loader.h b/engines/hdb/map-loader.h index 578dc1d589..991d134ffd 100644 --- a/engines/hdb/map-loader.h +++ b/engines/hdb/map-loader.h @@ -50,8 +50,8 @@ class Map { public: Map(); - bool load(Common::SeekableReadStream *stream); int loadTiles(); + bool load(Common::SeekableReadStream *stream); int _mapX, _mapY; // Coordinates of Map int _mapTileX, _mapTileY; // Tile Coordinates of Map -- cgit v1.2.3