DEL Format

From ModdingWiki
Jump to navigation Jump to search
DEL Format
DEL Format.png
Format typeImage
HardwareVGA
Colour depth8-bit
Minimum size (pixels)0×0
Maximum size (pixels)65535×65535
PaletteVaries
Plane count1
Transparent pixels?Yes
Hitmap pixels?No
Games

DEL is a delta-encoded VGA image format. It uses a similar mechanism to the STP Format to produce a transparency, which allows multiple DEL images to be layered on top of one another and create a full frame from composite parts.

In Nomad, the aliens shown during conversation are drawn using frames built up from several different DEL overlays. Each frame typically starts with a background image, over which different segments of the alien are drawn to create a complete picture. The alien's head, body, hands, and facial expressions are animated separately to allow for flexibility.

The DEL format was reverse engineered by cmb.

Header

The file starts with two 16-bit words that describe the image size. Delta-encoded raster data immediately follows.

Data type Description
UINT16LE width Width of the image in pixels
UINT16LE height Height of the image in pixels

Data

Each data chunk in the file is one of four different types, and the type is determined by the lowest two bits of the first byte in the chunk (which hereafter is referred to as the "command byte"):

Lowest two bits of command byte Sequence type Decode procedure
00 Delta encoded Determine a sequence length by isolating the top six bits of the command byte (cmdbyte >> 2). The first byte of output in this sequence is copied directly from the input stream. For each of the following bytes: read the next nibble from the input stream (starting with the high order nibble in each byte), and use its value to index into a hardcoded table that provides the deltas (see below). Add this delta to the value of the last byte that was written to the output, and write the result as the next byte in the output.
01 Repeat byte Copy the next single byte from the input to the output buffer n times, where n is (cmdbyte >> 2).
10 Advance output Shift the command byte right by two to isolate the top six bits (cmdbyte >> 2). If this value is nonzero, add it to the output buffer index. Otherwise, if the value in the top six bits is zero, read the next byte from the input and add its value to the output buffer position pointer. The effect of this is that the existing values are left at the skipped output buffer locations, which creates a transparency in the current layer.
11 Single copy Copy a single byte from the input to the output buffer.

Delta table

Index: 0 1 2 3 4 5 6 7 8 9 A B C D E F
Delta: 0 1 2 3 4 5 6 7 -8 -7 -6 -5 -4 -3 -2 -1