Zone 66 Tileset Format
Format type | Tileset |
---|---|
Hardware | VGA |
Max tile count | 232-1 |
Palette | Shared VGA |
Tile names? | No |
Minimum tile size (pixels) | 0×0 |
Maximum tile size (pixels) | 65535×65535 |
Plane count | 1 |
Plane arrangement | Linear VGA |
Transparent pixels? | No |
Hitmap pixels? | No |
Metadata? | None |
Supports sub-tilesets? | No |
Compressed tiles? | No |
Hidden data? | No |
Games |
This file format is used by Zone 66 to store tiles used for drawing maps, among other things.
File format
Signature
There is no signature, however careful processing of the header can be used to check whether the file is valid (e.g. no tiles are stored past the end of the file, the first tile's offset is always zero, etc.)
Header
Each tileset begins with the following header.
Data type | Name | Description |
---|---|---|
UINT32LE | count | Number of images in the file |
UINT32LE[count] | offsets | Array of file offsets |
BYTE[] | data | Start of first tile's image data |
Each offset is relative to the start of the first tile's data, so the first tile will always have an offset of zero even though it starts some distance into the file.
Image data
Each tile begins with its dimensions, followed by the pixel data.
Data type | Name | Description |
---|---|---|
UINT16LE | width | Width of tile, in pixels |
UINT16LE | height | Height of tile, in pixels |
The image data is encoded in a type of RLE. Each byte read should perform one of the following actions:
Byte value | Action |
---|---|
0xFF | End of image data |
0xFE | Go to the start of the next row |
0xFD | Read next byte, then move right that many pixels |
0x00 | Invalid |
Any pixels skipped over by one of the above jumps should be left black (value 0x00). Each line is always terminated by 0xFE (even if the exact number of pixels to fill the whole line has been read), except the last line which is terminated by 0xFF.
If the byte read isn't in the table above, it is a length of data to read. That many bytes should be read in from the file and each byte treated as the value of the next pixel.
Note: Some files (e.g. maingrfx.z66) write pixels beyond the width of the image, and consequently may overrun a buffer if this situation is not catered for.
Credits
This file format was reverse engineered by john_doe. 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!)