FXX and WXX file format: Difference between revisions

From DF21 Wiki
No edit summary
No edit summary
Line 5: Line 5:
FXX and WXX sprites will be loaded in place of a classic sprite if they have the same name (eg. <code>hello.WAX</code>, <code>hello.WXX</code>). Their image(s) ''must'' be exactly double the dimensions of the image(s) in the FME or WAX they are substituting for.
FXX and WXX sprites will be loaded in place of a classic sprite if they have the same name (eg. <code>hello.WAX</code>, <code>hello.WXX</code>). Their image(s) ''must'' be exactly double the dimensions of the image(s) in the FME or WAX they are substituting for.


=== File format ===
== File format ==
FXX/WXX files contain minimal metadata. The game obtains key data (widths and heights of images, offsets, animation sequences, frame rates, etc.) from the corresponding FME or WAX.
FXX/WXX files contain minimal metadata. The game obtains key data (widths and heights of images, offsets, animation sequences, frame rates, etc.) from the corresponding FME or WAX.


==== Header ====
=== Header ===
The FXX/WXX header is as follows.
The FXX/WXX header is as follows.


Line 23: Line 23:
The header is followed by the data for each image.
The header is followed by the data for each image.


==== Image data ====
=== Image data ===
Images are encoded simply as an array of pixels. Pixels are arranged by rows (note this is different from FMEs and WAXs where pixels are arranged by columns). For some reason, rows are arranged from right-to-left.
Images are encoded simply as an array of pixels. Pixels are arranged by rows (note this is different from FMEs and WAXs where pixels are arranged by columns). For some reason, rows are arranged from right-to-left.


Line 49: Line 49:
| <code>0xFF</code> || An ordinary pixel.
| <code>0xFF</code> || An ordinary pixel.
|}
|}
== Order of images ==
In a WXX file, the images are ordered corresponding to the order in which cells are encountered in a WAX, as the WAX sequences and frames are traversed.
Note, this is often not the same as the order of cells in a WAX. For example, first frame of the first sequence of the Imperial Officer WAX points to the 12th cell in the WAX. Therefore the first image in the Imperial Officer WXX corresponds to the 12th cell.

Revision as of 11:46, 9 March 2024

FXX and WXX are the image format for high resolution sprites in the Dark Forces Remaster. They replace FMEs and WAXes respectively. FXX and WXX are actually the same format, differing only in file extension.

FXX and WXX are true colour with an alpha channel.

FXX and WXX sprites will be loaded in place of a classic sprite if they have the same name (eg. hello.WAX, hello.WXX). Their image(s) must be exactly double the dimensions of the image(s) in the FME or WAX they are substituting for.

File format

FXX/WXX files contain minimal metadata. The game obtains key data (widths and heights of images, offsets, animation sequences, frame rates, etc.) from the corresponding FME or WAX.

Header

The FXX/WXX header is as follows.

FXX/WXX header
{
   NumImages        int32
   ImageSizes       int32[NumImages]            // The values are the number of pixels in each image
}

FXXs will only have one image, WXXs may have one or more corresponding to the number of images in the base WAX.

The header is followed by the data for each image.

Image data

Images are encoded simply as an array of pixels. Pixels are arranged by rows (note this is different from FMEs and WAXs where pixels are arranged by columns). For some reason, rows are arranged from right-to-left.

Each pixel is a 4 byte struct:

Pixel 
{
   Red      byte
   Blue     byte
   Green    byte
   Alpha    byte
}

Each value can be between 0 and 0xFF.

The way the Alpha channel is handled by the game is as follows:

0 The pixel will be transparent
Any value from 0x1 to 0xFE The pixel will be full-bright (fully lit in all light levels and produce bloom)
0xFF An ordinary pixel.

Order of images

In a WXX file, the images are ordered corresponding to the order in which cells are encountered in a WAX, as the WAX sequences and frames are traversed.

Note, this is often not the same as the order of cells in a WAX. For example, first frame of the first sequence of the Imperial Officer WAX points to the 12th cell in the WAX. Therefore the first image in the Imperial Officer WXX corresponds to the 12th cell.