Fallout Wiki
Advertisement
Fallout Wiki

FRM is a file format used in Fallout and Fallout 2.

Purpose of FRM files[]

FRM files are unpaletted 256-color image files containing either one or several images in one file. The palette used for FRM files come in the form of external palette files.

All values within the FRM file are stored in Big-Endian (Motorola) format as opposed to Little-Endian (Intel) format. For those who don't know what the difference is, Big-Endian stores the most-significant (largest digit place) digits closest to the number's starting address, whereas Little-Endian stores values with the least-significant digits closest to the starting address. Ex:

  • With hex number
3F:2B:
  • Big-Endian:
3F:2B
  • Little-Endian:
2B:3F

General information[]

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 color model to store the image data. This means that each pixel is represented by an offset into a palette of colors. A color 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 center) 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 center of the image data is the center of the bottom edge of the frame. To find the position of the top left corner of the frame (needed for rendering):

left = center_x - (frame_width / 2)
top  = center_y - frame_height

FRM header & data[]

Offset Size Datatype Possible values in Fallout 1/2 .FRM's Description
0x0000 4 byte unsigned 0x04 Version number of the FRM file format
0x0004 2 byte unsigned 0x04 FPS - Frames per second rate of the animation
0x0006 2 byte unsigned 0x01 -> 0xFF (if the .FRM got 255 single frames which is highly unlikely) Action frame - Frame of the animation on which actions occur (shot, open doors, etc.)
0x0008 2 byte unsigned 0x01 -> 0xFF 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 byte signed Unknown Required shift in the X direction, of frames with orientation 0 - This is the shift required so that the frames with orientation 0 are centered correctly. This shift is needed to correctly align objects when rendering, as the logical center of the frame will not necessarily be the absolute center of the frame (width/2, height/2). For example, the center of a critter will be the position of its feet, while the center of a tree will be its base. A positive value means shift the frame to the right of the screen when rendering
0x000C 2 byte signed Unknown Required shift in the X direction, of frames with orientation 1
0x000E 2 * (6 - 2) byte signed Unknown Required shift in the X direction, of frames with orientations [2-5]
0x0016 2 * 6 byte signed Unknown 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 byte unsigned Unknown Offset of first frame for direction 0 from beginning of frame area - Frame area start from offset 0x003E
0x0026 4 byte unsigned Unknown Offset of first frame for direction 1 from beginning of frame area
0x002A 4 byte unsigned Unknown Offset of first frame for direction 2 from beginning of frame area
0x002E 4 byte unsigned Unknown Offset of first frame for direction 3 from beginning of frame area
0x0032 4 byte unsigned Unknown Offset of first frame for direction 4 from beginning of frame area
0x0036 4 byte unsigned Unknown Offset of first frame for direction 5 from beginning of frame area
0x003A 4 byte unsigned Unknown Size of frame area - Could be used to allocating memory for frames
0x003E 2 byte unsigned Unknown FRAME-0-WIDTH: Width of frame 0 - The width (in pixels) of the 0th frame in the orientation 0
0x0040 2 byte unsigned Unknown FRAME-0-HEIGHT: Height of frame 0 - The height (in pixels) of the 0th frame in the orientation 0
0x0042 4 byte 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 byte signed FRAME-0-WIDTH * FRAME-0-HEIGHT Offset in X direction of frame 0 - The offset of this frame from the previous frame
0x0048 2 byte signed FRAME-0-WIDTH * FRAME-0-HEIGHT Offset in Y direction of frame 0
0x004A FRAME-0-SIZE byte unsigned 0x00 -> 0x3F(hex) / 63(dec) colorIndex for frame 0 - Contains the colorIndex for the 0th frame. Each index is represented by one byte; there are 256 possible indexes and their RGB values can be found in the appropriate .pal file. Pixel data starts at the top left corner of the frame and increases left to right, then top to bottom
0x004A + (FRAME-0-SIZE) flexible unsigned 0x00 -> 0xFF 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)

Information about palette[]

Frame data comes in the form of byte color indexes to a 256-color palette. Hence a byte with the number 137 would correspond to color 137 in the palette.

Sources[]

Advertisement