Win images

From AlephWiki

Jump to: navigation, search

Windows Image File Format

Return to History

Author unknown


When Marathon 2 was ported to Windows, the Images file, which previously stored pictures in the Resource Fork, had to be flattened. Here is the Windoews specification:

/*
* Data in this format can be found in the map file and in the images file
* (which in M2/95 uses the same format as the scenario and physics files).
*
* The index field in the directory_entry struct defined in wad.h is used as
* the resource id equivalent. Note that M2 always uses this for look-ups
* rather than the position in the directory, which explains why it handles
* Obed's scrambled directories without complaining.
*
* Each picture entry contains a 'pict' tag and (if the depth field in the
* pict head equals 8) a 'clut' tag.
*
* The 'pict' tag consists of a pict_head (defined below) followed by 8- or
* 16-bit pixel data. The bounds field defines the size of the picture:
* (bottom-top) rows of (right-left) pixels each.
*
* 8-bit pixels are indexes into the clut as expected. There is no alignment
* padding between pixel rows.
*
* 16-bit pixels are in big-endian ARGB 1555 format, exactly matching in-memory
* 16-bit pixels on a Mac.
*
* The 'clut' tag consists of a clut_record (defined below). The count field
* contains the actual colour count, unlike the ctSize field in a Quickdraw
* ColorTable struct.
*/

typedef struct pict_head {
screen_rectangle bounds; /* screen_rectangle from screen_drawing.h */
short depth; /* 8 or 16 */
/* pixel data follows here */
} pict_head;

typedef struct clut_record {
short count;
short unknown;
short id;
rgb_color colors[256]; /* rgb_color from cscluts.h */
Personal tools