Sprite (S16) File Format

The Sprite file format for Creatures2 (The S16) files is not very complex. It consists of a file header, then sprite description blocks, and then sprite data

S16 File Header

LONG flags

WORD SpriteCount

The Flags field is a 32bit field in which the upper 31 bits are reserved and should be zero. The least significant bit indicates the file format of the file. If the bit is set, then the file is in 565 format, if clear, then the file is in 555 format. The Sprite count is the number of images in the file. If the count is non-zero, then the following sections exist

Sprite Headers

The Sprite Header section of the file is defined as follows

{

LONGOffsetThe offset into the sprite file of the image data.
WORDWidthThe width of the sprite.
WORDHeightThe height of the sprite.

}[SpriteCount]

Therefore, there are two words and one long per sprite in the file at this point

Sprite Data Section

In the sprite Data Section, the following is defined

{

WORD [Widthn*Heightn]Sprite DataEach word is a single pixel.

}