An S16 file contains a set of uncompressed 16-bit sprites. They can be in either 555 (15-bit) or 565 (16-bit) color, depending on what the users graphic card needs. You should always distribute sprites as 565 and then allow things like the agent injector to convert them to 555 if needed.
A file is made up of a File Header, a set of Sprite Headers (one for each sprite) and then the data for each sprite.
File Header:
Type | Name | Description |
unsigned int | flags | Bit 1: if set, 565 format, otherwise in 555 format. All other bits are reserved and should be set to zero. |
unsigned short | nosprites | This value is the number of sprites in the file. |
Sprite Header:
Type | Name | Description |
unsigned int | offset | The offset into the file where the image data for this sprite is held. Useful if you need to seek to a specific image quickly. |
unsigned short | width | The width of this sprite. |
unsigned short | height | The height of this sprite. |
The actual sprite data is just a raw set of 16-bit color values. The size is (width * height * 2) bytes (*2 due to the fact that the values are shorts, ie 2-byte values).
555 format: bits 0/1/2/3/4 represent the blue value, 5/6/7/8/9 the green and 10/11/12/13/14 the red. Bit 15 should be set to zero.
565 format: bits 0/1/2/3/4 represent the blue value, 5/6/7/8/9/10 the green and 11/12/13/14/15 the red.