diff options
-rw-r--r-- | engines/hdb/hdb.cpp | 3 | ||||
-rw-r--r-- | engines/hdb/map-loader.cpp | 25 | ||||
-rw-r--r-- | engines/hdb/map-loader.h | 5 |
3 files changed, 28 insertions, 5 deletions
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 871fe3c5c9..8f0f3a1767 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -151,12 +151,13 @@ Common::Error HDBGame::run() { lua->initScript(luaStream, "MAP00_DEMO_LUA", luaLength); Common::SeekableReadStream *mapStream = fileMan->findFirstData("MAP00_DEMO_MSM", TYPE_BINARY); + int32 mapLength = fileMan->getLength("MAP00_DEMO_MSM", TYPE_BINARY); if (mapStream == NULL) { debug("The MAP00_DEMO_MSM MPC entry can't be found."); return Common::kReadingFailed; } - mapLoader->loadMap(mapStream); + mapLoader->loadMap(mapStream, mapLength); #if 0 lua->executeFile("test.lua"); diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp index 85f119771f..ba0917cb7d 100644 --- a/engines/hdb/map-loader.cpp +++ b/engines/hdb/map-loader.cpp @@ -28,8 +28,29 @@ MapLoader::MapLoader() { _mapLoaded = false; } -bool MapLoader::loadMap(Common::SeekableReadStream *stream) { - warning("STUB: MAPLOADER: LOAD MAP"); +bool MapLoader::loadMap(Common::SeekableReadStream *stream, int32 length) { + + if (_mapLoaded) { + return false; + } + + // Load MSM data into mapHeader + mapHeader = new MSMHeader; + stream->read(mapHeader->name, 32); + mapHeader->width = stream->readUint16LE(); + mapHeader->height = stream->readUint16LE(); + mapHeader->background = stream->readUint32LE(); + mapHeader->foreground = stream->readUint32LE(); + mapHeader->iconNum = stream->readUint16LE(); + mapHeader->iconList = stream->readUint32LE(); + mapHeader->infoNum = stream->readUint16LE(); + mapHeader->infoList = stream->readUint32LE(); + + /* + TODO: Set the InMapName in hdb.cpp + */ + + warning("STUB: MAPLOADER: LOAD MAP INCOMPLETE"); return false; } diff --git a/engines/hdb/map-loader.h b/engines/hdb/map-loader.h index b1b2a4eedf..5f06817ac2 100644 --- a/engines/hdb/map-loader.h +++ b/engines/hdb/map-loader.h @@ -27,7 +27,7 @@ namespace HDB { -struct MSMEntry { +struct MSMHeader { char name[32]; uint16 width; uint16 height; @@ -56,7 +56,7 @@ class MapLoader { public: MapLoader(); - bool loadMap(Common::SeekableReadStream *stream); + bool loadMap(Common::SeekableReadStream *stream, int32 length); int loadTiles(); bool isLoaded() { @@ -64,6 +64,7 @@ public: } private: + MSMHeader *mapHeader; bool _mapLoaded; }; |