diff options
author | Nipun Garg | 2019-06-01 16:20:56 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:42 +0200 |
commit | e3eaf42515a9872b896883697b6bcd87731671b7 (patch) | |
tree | 3a68fbb6a2a14084e1662c4faebd65154476c1c3 /engines | |
parent | fb00f5cb4e7edcf912b56952a5b1a77768a36286 (diff) | |
download | scummvm-rg350-e3eaf42515a9872b896883697b6bcd87731671b7.tar.gz scummvm-rg350-e3eaf42515a9872b896883697b6bcd87731671b7.tar.bz2 scummvm-rg350-e3eaf42515a9872b896883697b6bcd87731671b7.zip |
HDB: Add Picture class to load non-tile graphics
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/draw-manager.cpp | 25 | ||||
-rw-r--r-- | engines/hdb/draw-manager.h | 21 |
2 files changed, 43 insertions, 3 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp index dc41fdb7a2..6a0d1e0173 100644 --- a/engines/hdb/draw-manager.cpp +++ b/engines/hdb/draw-manager.cpp @@ -38,4 +38,29 @@ void DrawMan::loadTile32(char *name, uint32 *length) { } +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); + debug(8, "Picture: _name: %s", _name); + + _surface.create(_width, _height, format); + stream->readUint32LE(); // Skip Win32 Surface + + uint16 *ptr; + + for (uint y = 0; y < _height; y++) { + ptr = (uint16 *) _surface.getBasePtr(0, y); + for (uint x = 0; x < _width; 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 c9b94c1c6f..941e1bfc19 100644 --- a/engines/hdb/draw-manager.h +++ b/engines/hdb/draw-manager.h @@ -25,6 +25,7 @@ #include "common/array.h" #include "common/file.h" +#include "graphics/surface.h" #include "hdb/hdb.h" #include "hdb/file-manager.h" @@ -35,7 +36,7 @@ class DrawMan { public: DrawMan(); - + /* struct Tile { MPCEntry *mpcData; Tile32Type *tileData; @@ -43,7 +44,7 @@ public: uint16 loaded; uint16 skyIndex; uint16 animIndex; - }; + };*/ bool init(); // void saveToFile(const Common::String &filename); @@ -52,7 +53,7 @@ public: bool cursorDisplay; int cursorX, cursorY; - Common::Array<Tile *> tileArray; +// Common::Array<Tile *> tileArray; private: @@ -60,6 +61,20 @@ private: }; +class Picture { +public: + + Graphics::Surface load(Common::SeekableReadStream *stream); + +private: + + uint _width, _height; + char _name[64]; + + Graphics::Surface _surface; + +}; + } // End of Namespace HDB #endif // !HDB_DRAW_MANAGER_H |