Daggerfall Mod:Image formats/CIF
< Mod / Daggerfall: Daggerfall Mod: File Formats: Image formats(Redirected from Daggerfall:Image formats/CIF)CIF files are slightly more complicated than IMG files, because CIF files were designed to support multiple animated images. That is to say, each contained image is an animation of 1 or more frames. SHOK00C6.CIF, for example, contains a single 6-frame image. Most CIF files contain images of only a single frame.
Single-frame CIF FilesEdit
The basic format of a single-frame CIF file is a contiguous list of ImgFile structures. In essence one merely reads the contained elements one after another until the reaching the end of the file. Since there is no master header indicating the count or sizes of contained images, there is no way to know how many ImgFile structures are so contained without reading the entire file. Since each ImgFile structure does possess her own ImgHeader structure, one can skip elements by reading an ImgHeader and skipping forward ImgHeader.DataLength bytes until one has reached the element of interest. The ImgFile elements are stored in frame-ascending order; this is to say the first ImgFile is to be displayed before the second ImgFile when animated.
FACES.CIFEdit
FACES.CIF is actually an RCI File.
Multi-frame CIF FilesEdit
Multi-frame CIF Files are a tad more complex because of the animation frames for each contained image. For example, "FRST00C6.CIF" contains a single image, but that image is an animation composed of 6 frames. Again, we will start with the easiest and move onwards in complexity.
Magic Spell CIF FilesEdit
The Magic Spell CIF files are the easiest to parse. They are identical to the above Single-frame CIF Format, except all contained images are to be interpreted as animation frames of a single image. For example, the 6 images of FIRE00C6.CIF are to be considered a single image with 6 distinct frames of animation.
The following files are Magic Spell CIF Files:
- FIRE00C6.CIF
- FRST00C6.CIF
- MJIC00C6.CIF
- POIS00C6.CIF
- SHOK00C6.CIF
Weapon CIF FilesEdit
The various weapon CIF files enjoy a slightly expanded format to accommodate the animation frames defining the various images. The standard format (with exception noted below) consists of a single ImgFile (the "wielded" image), immediately followed by a contiguous list of one or more Animation structures (one for each different animation, such as the various "attack" animations). Each Animation structure begins with an AnimationHeader structure, immediately followed by the AnimationPixelData which contains the PixelData for each frame implied by the AnimationHeader.
The overall anatomy of a Weapon CIF File is straightforward.
ImgFile |
---|
+Animation |
AnimationEdit
An Animation structure begins with an AnimationHeader structure, immediately followed by the PixelData which compose the individual frames for the animation.
AnimationHeaderEdit
Offset | Type | Name | Description |
---|---|---|---|
0-1 | UInt16 | Width | Width of the animation. All frames (excepting the final frame) of the animation all have this value for their width. |
2-3 | UInt16 | Height | Height of the animation. |
4-5 | UInt16 | LastFrameWidth | This is the width of the last frame of the animation. This value is always equal to the ImgFile.ImgHeader.Width field for the root ("wielded") image. |
6-7 | Int16 | XOffset | Horizontal display offset for the animation. All frames are assumed to have 0 vertical offset (YOffset). |
8-9 | Int16 | LastFrameYOffset | This is the vertical display offset for the last frame of the animation. All other frames within the animation assume 0 value for YOffset. |
10-11 | Int16 | DataLength | This is the total length in bytes of the PixelData structures immediately following this header. The offsets of individual frames are indicated by the following FrameDataOffsetList field. |
12-73 | UInt16[ 31 ] | FrameDataOffsetList | This 31 element array of UInt16 elements contains the offsets to the individual frame data. Each value is relative to the start of the current AnimationHeader structure. An element of 0x0000 indicates no more frames follow. |
74-75 | UInt16 | TotalSize | This value indicates the total size of all data, including this header itself. |
Notably, there is no Compression field present. The pixel data for each frame is assumed to be compressed as per RleCompressed.
AnimationPixelDataEdit
This is a contiguous list of PixelData structures (each an array of UInt8). The length of each, except the last, is determined by comparing the elements of the AnimationHeader.FrameDataOffsetList. The length of the last frame's PixelData is simply the remainder; AnimationHeader.TotalSize - AnimationHeader.FrameDataOffsetList[ n ]
. Since only positive values within the FrameDataOffsetList are valid offsets, and since animations are not required to have all 31 frames, care must be taken to determine n. It should also be noted that while the frames are to be displayed in the order they are presented in the FrameDataOffsetList, they are not required to be stored to disk in that order; This is to say that FrameOffsetList[ 2 ] may have a smaller value than FrameOffsetList[ 0 ]. Editors should store the actual PixelData in frame-ascending order (store Frame1 before Frame2), but should be prepared to accept unsorted offsets in FrameDataOffsetList.
The following files are Weapon CIF Files:
- WEAPON00.CIF
- WEAPON01.CIF
- WEAPON02.CIF
- WEAPON03.CIF
- WEAPON04.CIF
- WEAPON05.CIF
- WEAPON06.CIF
- WEAPON07.CIF
- WEAPON08.CIF
- WEAPON10.CIF
- WEAPON11.CIF
- WEAPO101.CIF
- WEAPO102.CIF
- WEAPO104.CIF
- WEAPO105.CIF
- WEAPO106.CIF
- WEAPO107.CIF
- WEAPO108.CIF
WEAPON09.CIFEdit
WEAPON09.CIF requires special handling because this file contains the bow animations, which do not possess a "wielded" image. This means there is no root ImgFile structure at the start of the file; it is composed of merely a contiguous list of Animation structures.
+Animation |
---|