Worldstone
|
Decoder for the DC6 image format. More...
#include <dc6.h>
Classes | |
struct | FrameHeader |
struct | Header |
Public Types | |
enum | Flags { IsSerialized = 1 << 0, IsLoadedInHW = 1 << 1, Is24Bits = 1 << 2 } |
Public Member Functions | |
bool | initDecoder (StreamPtr &&streamPtr) |
Start decoding the stream and preparing data. More... | |
void | reset () |
Resets the decoder and frees resources. | |
const Header & | getHeader () const |
const std::vector< FrameHeader > & | getFrameHeaders () const |
std::vector< uint8_t > | decompressFrame (size_t frameNumber) const |
Decompress the given frame. More... | |
bool | decompressFrameIn (size_t frameNumber, uint8_t *data) const |
Same as decompressFrame but will output the data in a given buffer. | |
void | exportToPPM (const char *ppmFilenameBase, const Palette &palette) const |
Protected Member Functions | |
bool | extractHeaders () |
Protected Attributes | |
StreamPtr | stream = nullptr |
Header | header |
std::vector< uint32_t > | framePointers |
std::vector< FrameHeader > | frameHeaders |
Decoder for the DC6 image format.
The DC6 (Diablo Cel 6) format is a compressed sprite image format. It can store multiple directions and frames in a single file. A palette is used to generate the colors, but the file itself doesn't have any information about the palette to use, it is up to the user to know which one to use.
This format is mostly used for menu, items but also for some monsters (eg:Mephisto) This is an update of diablo 1 Cel format
Layout of a DC6 file:
Name | Type | Size in bytes | Offsets |
---|---|---|---|
header | DC6::Header | 24 | 0x00 |
framePointers | uint32_t[dirs][framesPerDir] | 4 * header.directions * header.framesPerDir | 0x18 |
frameHeader[0] | DC6::FrameHeader | 32 | framePointers[0] |
frameData[0] | uint8_t[frameHeader.length] | frameHeader[0].length | ^ |
skipColor[0] | uint8_t[3] | 3 | ^ |
... other frames ... | |||
frameHeader[totalFrames-1] | DC6::FrameHeader | 32 | framePointers[nbFrames-1] |
frameData[totalFrames-1] | uint8_t[frameHeader.length] | frameHeader[nbFrames-1].length | ^ |
skipColor[totalFrames-1] | uint8_t[3] | 3 | ^ |
std::vector< uint8_t > WorldStone::DC6::decompressFrame | ( | size_t | frameNumber | ) | const |
bool WorldStone::DC6::initDecoder | ( | StreamPtr && | streamPtr | ) |
Start decoding the stream and preparing data.
Prepares the decoder to read the frames using decompressFrame. Basically calls extractHeaders(), so that you can call getHeader() and getFrameHeaders().