HDB: Add the Tile class to load 32x32 Tiles
This commit is contained in:
parent
6986e5495a
commit
07b3408ff4
2 changed files with 34 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue