Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Software texture banks

TEXTURE.### files store indexed textures for the software renderer.

Overall Structure

[Header — entry count and bank name]
[Directory — 20-byte records]
[Image records — metadata and pixels]

The engine selects banks by a three-digit decimal suffix. Values are little-endian. Colors come from the world’s COL palette.

OffsetSizeTypeNameDescription
0x002u16entry_countNumber of directory entries
0x0224[u8; 24]nameNUL-terminated bank name, padded to 24 bytes

Directory

Each entry occupies 20 bytes, beginning at byte 26.

OffsetSizeTypeNameDescription
0x001u8unknown_00Auxiliary field
0x011u8colorPalette index when the image offset is zero
0x024u32image_offsetAbsolute file offset of the image record; zero for solid colors
0x0614[u8; 14]auxiliaryAuxiliary fields

Banks 0 and 1 contain solid-color entries for the two halves of the palette. Image IDs are directory indices.

Image record

OffsetSizeTypeNameDescription
0x002i16x_offsetImage X offset
0x022i16y_offsetImage Y offset
0x042u16widthImage width
0x062u16heightImage height
0x082u16flagsBit 8 enables transparent palette index zero; bit 11 selects a 256-byte row stride for single-frame data
0x0A4u32record_sizeRecord size field
0x0E4u32data_offsetPixel data offset relative to the image record
0x122u16unknown_12Auxiliary field
0x142u16frame_countNumber of frames; zero represents an empty record
0x162u16frame_delayAnimation frame duration in milliseconds
0x182i16scale_xStored X scale field
0x1A2i16scale_yStored Y scale field

Data offsets may address shared pixel storage beyond the record-size field. Resolve them against the complete bank.

Pixel data

Single-frame images contain raw palette indices. Rows have a stride of 256 bytes when flag bit 11 is set, otherwise the image width. Only width pixels from each row belong to the image.

Animated images begin with frame_count little-endian u32 offsets, each relative to the start of the pixel data. Each frame begins with its u16 width and height, followed by rows of run pairs:

[Transparent count — u8]
[Literal count — u8]
[Literal palette indices — literal count bytes]

Repeat pairs until exactly the frame width has been emitted, then start the next row. Transparent runs emit index zero. A pair must advance the row and must not overrun its width.

Software models select these banks through their v2.6/v2.7 texture fields. The layout differs from TEXBSI.

External References