Star Wars Dark Forces LFD

From MultimediaWiki
Revision as of 04:44, 13 February 2021 by Kostya (talk | contribs) (document LFD somewhat)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

LFD is motion/animation format used in the [Star Wars: Dark Forces] game for IBM-PC. An incomplete player for such files can be found in engine reimplementations e.g. [3].

This is not a standalone movie format but rather a set of resources (like sprites and sounds) and commands telling game engine how to assemble them to play cutscene. For playing a cutscene you need three resource files: an entry inside DARK.GOB/CURSCENE.LST specifying metadata such as resource archive (LFD) to use, playback fps or even audio volume; image/sound data LFD archive specified above; and it can also refer to common sounds in JEDISFX.LFD.

The chunk header format is

bytes 0-3    block type FourCC
bytes 4-11   block name (ASCII)
bytes 12-15  payload length (bytes)

All multi-byte values are stored as little-endian.

Chunk Types

Files are found to begin with the RMAP chunk, followed by FILM, and then the other resource chunk.

  • RMAP: a random-access list of all chunks in file.
  • FILM: describes the film sequence using ANIM, CUST, DELT, END, PLTT, VIEW, VOIC commands.
  • PLTT: palette
  • DELT: single picture
  • ANIM: sprites

RMAP chunk

Resource map chunk that occurs in the beginning of the file and lists all other entries in LFD. Essentially it stores the same 16-byte header that every chunk has.

FILM chunk

Commands for cutscene playback.

bytes 0-1  unknown
bytes 2-3  cutscene duration
bytes 4-5  number of commands
bytes 6-   commands in form of chunks

Command chunk names and types tell on which resource to perform the command (except VIEW chunk, which is for general compositing).

Commands start with 16-bit type and may be followed by command-specific data (in 16-bit words as well):

  • End (2) - no more commands for this chunk
  • Time (3) - wait before executing next command for this chunks for a value specified in next word
  • Move (4) - move sprite to coordinates provided in the following two words
  • Speed (5) - set scrolling using the following two words
  • Layer (6) - move sprite to layer specified in the next word
  • Frame (7) - show animation frame with the provided frame index and move value
  • Animate (8) - set animation using the provided direction and move values
  • Cue (9) - display cue with the given index
  • Var (10) - unknown
  • Window (11) - unknown
  • Switch (13) - switch sprite/animation on or off using provided value
  • Palette (15) - set as current palette
  • Cut (18) - read three 16-bit words and perform some cut or fade action depending on them
  • Loop (20) - tells to start or stop looping animation using provided value
  • Preload (24) - tells to preload resource, has an unknown argument
  • Sound (25) - play audio. Arguments are: on/off, volume, unknown, unknown.
  • Stereo (28) - sets stereo panning for audio. Arguments are: on/off, volume, unknown, unknown, panning.

PLTT chunk

Palette change chunk. First byte is start colour index, second byte is end colour index, the rest of data is RGB triplets.

DELT/ANIM chunks

Image data chunks. They store image (DELT) or sequence of images (ANIM) coded as rectangles of certain size and at certain position with parts of it coded either raw or with RLE.