C16community.htm

generic file icon
Fact Value
Original File C16community.htm
Wiki Link Search "C16community" on creatures.wiki
File Size: 5 KB

Description(Generated)

Text File Composite

::----- C16community.htm -----::
C16 FileFormat

... a new vehicle from Sir Clive? Nope, it's an image innit?

In the following descriptions, 'uint16' is an unsigned 16 bit value and 'uint32' is an unsigned 32 bit value.

Both are specified in little-endian format - i.e. the least significant byte is stored first (this is the same format used by the Pentium processor family).

OVERVIEWThe C16 format can be broken down into three sections:
1) a small file header
2) sprite headers
3) actual image data

1) FILE HEADERuint32 flags
- bit 0: RGB pixel format 0=555, 1=565
- bit 1: must be 1!
- bits 2 to 31 are unused and should be 0.

uint16 spritecount
- The number of sprite images in the file.

2) SPRITE HEADER ARRAYThen comes an array of sprite headers, one for each sprite in the file.
Each header has the following structure:

uint32: offset to beginning of first line (line 0) in the image data
uint16: width (in pixels)
uint16: height (in pixels)
uint32[height-1]: an array of offsets to remaining lines in image data (this does _not_ include the line 0 offset, because we already know it).

Note that offsets are measured from the beginning of the file.

3) IMAGE DATAThe image data itself follows after the array of sprite headers.

Each line of image data is individually compressed down into a set of 'runs'.

A run begins with a uint16 tag.
- Bit 0 of the tag gives the type of run: 0 = transparent run. 1 = colour run.

The remaining bits (1..15) specify the length of the run in pixels. This implies that a run can be up to 32767 pixels in length(!).

 <...truncated>