Mystic Towers Sprite Format
Files in this format begin with a generic bank header also found in other files used by Mystic Towers.
|UINT16LE||iNumEntries||Number of chunks (sub-files) in this file|
|UINT32LE[iNumEntries]||iOffsets||Offset of each chunk (from the beginning of the file)|
The sprite data found at each offset has the following header:
|UINT16LE||iWidth||Width of the sprite, in pixels|
|UINT16LE||iHeight||Height of the sprite, in pixels|
|UINT16LE||iUnused||Either 0 or 5. The game ignores this value.|
|INT16LE||iOffX||Offset for drawing the sprite; moves the sprite (iOffX & 0x3FFF) pixels to the left.|
|INT16LE||iOffY||Offset for drawing the sprite; moves the sprite up by iOffY pixels.|
The Sprite header is followed directly by the image data. For every row of the image, the following data structure is repeated:
|BYTE||bSkip||Skip this amount of pixels (move to the right)|
|BYTE||bLen||Amount of pixel bytes|
|BYTE[bLen]||pixels||pixel data (0=transparent)|
After parsing one of these data blocks, the draw pointer is moved to the beginning of the next row and the next data block is processed. That means the transparent parts at the left and right side of each row have no pixel data and are to be left untouched (or set to 0 to indicate transparency).
If one of the pixel bytes in the middle of the row is 0, that pixel is also supposed to be transparent and will not be drawn by the game.
Even though the sprite header stores the image width as a UINT16LE, the usage of BYTE values in the row data means that each row can only have up to 255 visible pixels and that it is impossible to access anything beyond the first 510 pixels.
This file format was reverse engineered by K1n9_Duk3. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)