Z Palette Format

From ModdingWiki
Jump to navigation Jump to search

Terrain palettes in Z are 256-colour VGA palettes shared by tiles and sprites.

File format

The file is 768 bytes with no header. For colour i, bytes 3*i, 3*i+1 and 3*i+2 are red, green and blue. Components use the VGA DAC range 0–63.

For an 8-bit RGB preview use round((component & 63) * 255 / 63). Do not apply this expansion when writing a replacement PAL: its stored components remain six-bit values.

Notes

Gamma and fades alter the displayed palette at runtime. They are not additional PAL fields. The game uses five gamma exponents: 1.5, 1.25, 1, 0.75 and 0.5. Only the neutral exponent is identified as regression-validated in the notes.

Source code

From re-z, the open-source browser port:

Credits

This file format was reverse engineered by VorticonCmdr. 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!)