FRM file

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 comes 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: 3F:2B: 3F:2B 2B:3F
 * With hex number
 * Big-Endian:
 * Little-Endian:

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

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.