From a0b6b08ecd294003eaceb8b2aba037bb4d56f069 Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Fri, 7 Jun 2019 22:27:29 +0530 Subject: HDB: Add TileLookup struct and _tLookupArray _tLookupArray is a reference needed to cache the tiles in the current level --- engines/hdb/draw-manager.cpp | 40 +++++++++++++++++++++++++++++++++++++++- engines/hdb/draw-manager.h | 12 ++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp index 85ee4ec9aa..564e178f35 100644 --- a/engines/hdb/draw-manager.cpp +++ b/engines/hdb/draw-manager.cpp @@ -25,17 +25,55 @@ namespace HDB { DrawMan::DrawMan() { + _tLookupArray = NULL; _systemInit = false; } bool DrawMan::init() { + // Read total number of tiles in game _numTiles = g_hdb->_fileMan->getCount("t32_", TYPE_TILE32); - if (!_numTiles) { return false; } + // Setup Tile Lookup Array + _tLookupArray = new TileLookup[_numTiles]; + Common::Array tileData = *g_hdb->_fileMan->findFiles("t32_", TYPE_TILE32); + + int index = 0, skyIndex = 0; + for (; index < _numTiles; index++) { + _tLookupArray[index].filename = tileData[index]; + _tLookupArray[index].tData = NULL; + _tLookupArray[index].skyIndex = 0; + _tLookupArray[index].animIndex = index; + // Check if the loaded Tile is a Sky Tile + if (((Common::String)tileData[index]).contains("sky") && (skyIndex < kMaxSkies)) { + _tLookupArray[index].skyIndex = skyIndex + 1; + _skyTiles[skyIndex] = index; + skyIndex++; + } + } + + /* + TODO: Add Animating Tile Info + */ + + // Init Sky Data + _currentSky = 0; + + /* + TODO: Setup Gamma Table + */ + + /* + TODO: Load Mouse Pointer and Display Cursor + */ + + /* + TODO: Load all 4 levels of star colors and the snowflake + */ + _systemInit = true; return true; } diff --git a/engines/hdb/draw-manager.h b/engines/hdb/draw-manager.h index c3e6d91eb6..2c651dd816 100644 --- a/engines/hdb/draw-manager.h +++ b/engines/hdb/draw-manager.h @@ -33,6 +33,15 @@ enum { kMaxSkies = 10, }; +class Tile; + +struct TileLookup { + const char *filename; + Tile *tData; + uint16 skyIndex; + uint16 animIndex; +}; + class DrawMan { public: @@ -42,6 +51,9 @@ public: private: int _numTiles; + TileLookup *_tLookupArray; + uint16 _skyTiles[kMaxSkies]; + int _currentSky; // 0 if no Sky, 1+ for which Sky to use bool _systemInit; }; -- cgit v1.2.3