Bay 12 CMV

From MultimediaWiki
Jump to: navigation, search

The CMV file format is used by the game Dwarf Fortress to store intro movies and player recordings.

File structure

Header

Type Name Description
uint32 Version The format version used; should be >= 10000
uint32 Width Width (in characters) of each frame
uint32 Height Height (in characters) of each frame
uint32 DelayRate How long each frame is displayed; seems to be in hundredths of a second.

Sounds

Sound data is present in version 10001 files, but not in 10000 or 10005.

Type Name Description
uint32 SoundCount Number of sound references defined.
char[50]*SoundCount SoundName Filename (no dir or ext) of an external file which contains the sound data.

Sound timing data

An array of 3200 (16 channels x 200 frames?) 32-bit signed integers, each specifying an index into the array of sound refs defined above. An index of -1 indicates that no new sound is played at that point.

Frame data

Frame data is stored in zlib-compressed chunks containing a maximum of 200 frames:

Type Name Description
uint32 z_size Size of compressed data.
bytes z_data z_size bytes of compressed data.

The uncompressed structure of each frame roughly corresponds to a text-mode screen buffer:

Type Name Description
char[Width*Height] Characters An array of characters, encoded in the CP437 character set.
char[Width*Height] Attributes Encodes the ANSI color codes for each character.

Note that the encoding of color attributes is nonstandard:

0ibbbfff
i   - Foreground Intensity Bit
bbb - Background Color Bits
fff - Foreground Color Bits

Related software

CMV Movie Editor