diff options
author | Nipun Garg | 2019-06-01 17:56:04 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:42 +0200 |
commit | 07b3408ff4c79b16ae213bfca69b6dd2c71a754e (patch) | |
tree | 639710724e6dae64d0ab2991dbfcf03729ec41fe /engines/hdb | |
parent | 6986e5495a1024bf478ac71fa1fc35718ac0d10e (diff) | |
download | scummvm-rg350-07b3408ff4c79b16ae213bfca69b6dd2c71a754e.tar.gz scummvm-rg350-07b3408ff4c79b16ae213bfca69b6dd2c71a754e.tar.bz2 scummvm-rg350-07b3408ff4c79b16ae213bfca69b6dd2c71a754e.zip |
HDB: Add the Tile class to load 32x32 Tiles
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/draw-manager.cpp | 23 | ||||
-rw-r--r-- | engines/hdb/draw-manager.h | 11 |
2 files changed, 34 insertions, 0 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp index 6a0d1e0173..7e558e04a5 100644 --- a/engines/hdb/draw-manager.cpp +++ b/engines/hdb/draw-manager.cpp @@ -42,6 +42,7 @@ Graphics::Surface Picture::load(Common::SeekableReadStream *stream) { _width = stream->readUint32LE(); _height = stream->readUint32LE(); stream->read(_name, 64); + Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0); debug(8, "Picture: _width: %d, _height: %d", _width, _height); @@ -63,4 +64,26 @@ Graphics::Surface Picture::load(Common::SeekableReadStream *stream) { return _surface; } +Graphics::Surface Tile::load(Common::SeekableReadStream *stream) { + _flags = stream->readUint32LE(); + stream->read(_name, 64); + + Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0); + + _surface.create(32, 32, format); + stream->readUint32LE(); // Skip Win32 Surface + + uint16 *ptr; + + for (uint y = 0; y < 32; y++) { + ptr = (uint16 *)_surface.getBasePtr(0, y); + for (uint x = 0; x < 32; x++) { + *ptr = TO_LE_16(stream->readUint16LE()); + ptr++; + } + } + + return _surface; +} + } diff --git a/engines/hdb/draw-manager.h b/engines/hdb/draw-manager.h index 941e1bfc19..0f8d0442dc 100644 --- a/engines/hdb/draw-manager.h +++ b/engines/hdb/draw-manager.h @@ -75,6 +75,17 @@ private: }; +class Tile { +public: + Graphics::Surface load(Common::SeekableReadStream *stream); + +private: + uint32 _flags; + char _name[64]; + + Graphics::Surface _surface; +}; + } // End of Namespace HDB #endif // !HDB_DRAW_MANAGER_H |