Here follows the structure of the DATA section in the TILE section.
It contains the image data of the tileset.
The DATA section:
Code:
char Head[4] = "DATA";
int32 Size; //Size of following data chunk (minus head & size)
Tile Tiles[tilecount]; //The tilecount is probably in the TILE or INFO sections
The "Tile" structure:
Code:
byte TrasparencyFlags; //This shows which parts the bits represent: 43210000
Part TilePart[4];
Each tile is divided into four 16x16 images, appearing in the order:
topleft, topright, bottomleft, bottomright.
These parts use RLE if they contain transparency.
The most significant half of the TransparencyFlags byte contains flags for each part.
Flags are set if the part is nontransparent, and unset if transparent(RLE encoded).
The "Part" structure:
if the part is nontransparent then it's really simple
a transparent one is more complicated though
Code:
int16 Size; //Length of following data
int16 W = 16; //Probably width and height since they're always 16
int16 H = 16;
byte Data[Size-4]; //RLE encoded data
the Data starts with an infobyte of the structure: F00COUNT where
the F bit indicates transparency (0 if transparent).
the COUNT bits is the amout of pixels with the F attribute.
If not transparent then the following COUNT bytes are nontransparent pixel data
then comes another infobyte.
If transparent, the pixels are not stored of course, and the next byte is another infobyte.
If the COUNT bits = 0 (and F=1) then the row is finished and the rest of the line should be filled with transparent pixels.