FRM Image File Format.


This document is corrected version of "FRM Image File Format" from Noid

The FRM File Format is used to store the images used in both Fallout and Fallout 2. It stores all the images and animations, with the exception of those used on the splash screen and the movies. Each FRM file contains one or more frames of image data.

The FRM file uses an index colour model to store the image data. This means that each pixel is represented by an offset into a palette of colours. A colour index of 0, means that the pixel is transparent.

The palette file to use is generally color.pal, but certain FRM files have their own palette files. These specific palette files have the same name as the FRM file, but with the extension .pal. For example: the palette file of helpscrn.frm is helpscrn.pal.

A FRM file may contain image data for one or all of the 6 orientations used in Fallout. If a FRM file has the extension .fr[0-5] instead of the usual .frm, then that file contains image data for the orientation given by the last digit in the extension. Otherwise, the FRM file contains image data for either orientation 0, or all 6 orientations.

The FRM file contains info to correctly align (or centre) the image data. For example: Image data should be aligned so that each critter's feet should be on the same level.

Each frame contained within the FRM file has an offset from the previous frame which must be applied before rendering. This offset ensures that in an animation sequence each frame is correctly aligned.

The centre of the image data is the centre of the bottom edge of the frame. To find the position of the top left corner of the frame (needed for rendering):

  left = centre_x - (frame_width / 2)
  top  = centre_y - frame_height
Offset Size Data Type Description
0x0000 4 unsigned = 4 Version number of the FRM file format.
0x0004 2 unsigned Unknown.

Fallout 2 load this field into memory, but don't use them.

0x0006 2 unsigned Unknown.

Fallout 2 load this field into memory, but don't use them.

0x0008 2 unsigned Number of frames per direction in this FRM file.

This gives the number of frames for a particular orientation. For a static image, this number will be 1. For an animation of say 10 frames, this value will be 10, even though it is likely that there will be a total of 60 frames stored (10 for each of the 6 orientations).

0x000A 2 signed Required shift in the X direction, of frames with orientation 0.

This is the shift required so that the frames with orientation 0 are centred correctly. This shift is needed to correctly align objects when rendering, as the logical centre of the frame will not necessarily be the absolute centre of the frame (width/2, height/2). For example, the centre of a critter will be the position of its feet, while the centre of a tree will be its base. A positive value means shift the frame to the right of the screen when rendering.

0x000C 2 signed Required shift in the X direction, of frames with orientation 1.
0x000E 2 * (6 - 2) signed Required shift in the X direction, of frames with orientations [2-5].
0x0016 2 * 6 signed Required shift in the Y direction, of frames with orientations [0-5].

A positive value means shift the frame to the bottom of the screen when rendering.

0x0022 4 unsigned Offset of first frame for direction 0 from begining of frame area.

Frame area start from offset 0x3E

0x0026 4 unsigned Offset of first frame for direction 1 from begining of frame area.
0x002A 4 unsigned Offset of first frame for direction 2 from begining of frame area.
0x002E 4 unsigned Offset of first frame for direction 3 from begining of frame area.
0x0032 4 unsigned Offset of first frame for direction 4 from begining of frame area.
0x0036 4 unsigned Offset of first frame for direction 5 from begining of frame area.
0x003A 4 unsigned Size of frame area.

It could be used to allocating memory for frames.

0x003E 2 unsigned FRAME-0-WIDTH : Width of frame 0.

The width (in pixels) of the 0th frame in the orientation 0.

0x0040 2 unsigned FRAME-0-HEIGHT : Height of frame 0.

The height (in pixels) of the 0th frame in the orientation 0.

0x0042 4 unsigned = FRAME-0-WIDTH * FRAME-0-HEIGHT FRAME-0-SIZE : Number of pixels for frame 0.

The total area, and hence number of bytes taken up by the 0th frame.

0x0046 2 signed Offset in X direction of frame 0.

The offset of this frame from the previous frame.

0x0048 2 signed Offset in Y direction of frame 0.
0x004A FRAME-0-SIZE unsigned Pixel data for frame 0.

Contains the pixel data for the 0th frame. Each pixel in the glyph is represented by one byte, which is the index into the colour palette. Pixel data starts at the top left corner of the frame and increases left to right, then top to bottom.

0x004A + (FRAME-0-SIZE) ...   Frame data for all the following frames.

Frames are stored for all the rest of the frames of orientation 0, then moves on to orientation 1 up to 5 (if these orientations are stored in the file).


Note: All integers are in big endian format.

Created by Noid.

Corrected byAnchorite.