FXX and WXX file format: Difference between revisions

From DF21 Wiki
(Created page with "'''FXX''' and '''WXX''' are the image format for high resolution sprites in the Dark Forces Remaster. They replace [https://df-21.net/documentation/DFSPECS/s_fme.htm FMEs] and [https://df-21.net/documentation/DFSPECS/s_wax.htm WAXes] respectively. FXX and WXX are actually the same format, differing only in file extension. FXX/WXX are true colour with an alpha channel. FXX/WXX sprites will be loaded in place of a classic sprite if they have the same name (eg. <code>hell...")
 
No edit summary
Line 1: Line 1:
'''FXX''' and '''WXX''' are the image format for high resolution sprites in the Dark Forces Remaster. They replace [https://df-21.net/documentation/DFSPECS/s_fme.htm FMEs] and [https://df-21.net/documentation/DFSPECS/s_wax.htm WAXes] respectively. FXX and WXX are actually the same format, differing only in file extension.
'''FXX''' and '''WXX''' are the image format for high resolution sprites in the Dark Forces Remaster. They replace [https://df-21.net/documentation/DFSPECS/s_fme.htm FMEs] and [https://df-21.net/documentation/DFSPECS/s_wax.htm WAXes] respectively. FXX and WXX are actually the same format, differing only in file extension.


FXX/WXX are true colour with an alpha channel.
FXX and WXX are true colour with an alpha channel.


FXX/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 20: Line 20:


FXXs will only have one image, WXXs may have one or more corresponding to the number of images in the base WAX.
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:
<pre>
Pixel
{
  Red      byte
  Blue    byte
  Green    byte
  Alpha    byte
}
</pre>
Each value can be between 0 and 0xFF.
The way the Alpha channel is handled by the game is as follows:
{| class="wikitable"
|-
| <code>0</code> || The pixel will be transparent
|-
| <code>Any value from 0x1 to 0xFE</code> || The pixel will be full-bright (fully lit in all light levels and produce bloom)
|-
| <code>0xFF</code> || An ordinary pixel.
|}

Revision as of 11:32, 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.