aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-08 00:21:32 +0530
committerEugene Sandulenko2019-09-03 17:16:45 +0200
commitb0146ffd2d7d0bef7f091bd766614c4503f94887 (patch)
tree4a703302a779971d32503f927ce114e233534065
parentfd593a1ef1647cc3a7b40597d829204ad33dac59 (diff)
downloadscummvm-rg350-b0146ffd2d7d0bef7f091bd766614c4503f94887.tar.gz
scummvm-rg350-b0146ffd2d7d0bef7f091bd766614c4503f94887.tar.bz2
scummvm-rg350-b0146ffd2d7d0bef7f091bd766614c4503f94887.zip
HDB: Call DrawMan::setSky from Map::load
-rw-r--r--engines/hdb/map-loader.cpp47
-rw-r--r--engines/hdb/map-loader.h2
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