User Tools

Site Tools


formats:frm16

This is an old revision of the document!


FRM16

*.frm16 files are images, used for many things like UI elements, icons, minimaps, textures, portraits … Also they are embedded in .SEQ16 and .MDL16 files. They use 16bits (2 bytes) per color and between 2 and 3 bits for transparency.

Allegedly they are cached form of .FRM files which in turn are created from .TGA files. To speed up loading, they do not use any JPEG-type compression like FRM files and use only RLE and 16bit colors. They reside in Cache/ subdir, which supports the theory. In some related games (Ricochet) it's possible to delete .FRM16 files and they get recreated automatically from FRM ones. Unfortunately there are not any .FRM files in Lionheart.

FRM16 file consists of a header and up to five layers. Layers are a way to encode alpha (transparency) in FRM16 files - the first layer is opaque (possibly with fully transparent pixels), the second layer is 80% opacity (FIXME: or 20% ?) and so on.

  • header
  • Opaque layer
    • Scanline LUT for the opaque layer
  • 80% opacity layer
    • Scanline LUT for the 80% layer
  • 60% opacity layer
    • Scanline LUT for the 60% layer
  • 40% opacity layer
    • Scanline LUT for the 40% layer
  • 20% opacity layer
    • Scanline LUT for the 20% layer

Any (FIXME: even the fully opaque) layer might be missing

[FIXME: quotes on FRM/FRM16 and JPEG-like compression] [FIXME: links to convertors by Balder, Miloch, …]

There are at least two types of FRM16 files - type 64 and type 68. Type 64 uses uncompressed pixels, while type 68 uses RLE.

Header (36 bytes)

Offset Size Description
0x00 2 Signature (0x1032)
0x02 2 Anchor X ?
0x04 2 Anchor Y ?
0x06 2 Width in pixels (portraits = 90, areas = 779)
0x08 2 Height in pixels (portraits = 111, areas = 330)
0x0a 2 Flags? Either 0 (normal) or 107 (immediate)
0x0c 2 Type (64 or 68)
0x0e 2 Unknown, possibly padding, always 0 in standalone files
0x10 4 Data size for opaque layer
0x14 4 Data size for % layer
0x18 4 Data size for % layer
0x1c 4 Data size for % layer
0x20 4 Data size for % layer

Layers

Layer

Offset Size Description

Pixel Encoding, RLE

Pixel color is encoded as a 16bit word, probably with a common 5-6-5 RGB? encoding. FIXME: How are fully transparent pixels encoded?

Type 64 files do not use any compression. Each layer contains all Width x Height pixels.

Type 68 FRM16 files use Run Length Encoding, RLE. Each image scanline consists of a series of pixel runs. The scheme uses two highest bits in the first byte of each run. If bit 7 is set, bits 0-6 contain number of pixels to skip. If bit 7 is clear and bit 6 is set, bits 0-5 contain number of 16bit pixels which follow. If both bits 7 and 6 are cleared, bits 0-5 contain a number of repetitions of the following 16 bit pixel.

Color Encoding

Pixels' color is encoded as a 16bit word, probably with a common 5-6-5 RGB? encoding. Transparent pixels …

formats/frm16.1285536373.txt.gz · Last modified: 2010-09-26 21:26 by edheldil