Difference between revisions of "IFP"
m (the headers looked huge, shrunk them by one) |
|||
Line 120: | Line 120: | ||
==External Link== | ==External Link== | ||
− | [http://public.sannybuilder.com/anim/ List of San Andreas' Animations] | + | *[http://public.sannybuilder.com/anim/ List of San Andreas' Animations] Seemann's website |
+ | *[http://www.pawfectfilms.com/mods/VCSA_AnimList.zip List of Vice CIty's and San Andreas' Animations] Ceedj's website |
Revision as of 19:17, 7 July 2008
IFP is the animation format of the Grand Theft Auto series since. With there came a new version of the file format, but it still supports animations with the old version. IFP files can contain several single animations which are split up to objects and linked to the animated object or actor in that way. Each object contains a certain number of frames including a time key. Two frames are interpolated by the game.
Contents
File Specification
Version 1
Version 1 packages are split up as usual into several data structures. The values of those structures are identified by 4 byte information markers. Those are 4 characters describing the following value(s). Offsets are always relative to the current file position. To convert a relative offset to an absolute one just add the number of read bytes.
Header
4b - FourCC - "ANPK" (Animation Package, Version identifier) 4b - Int32 - Offset to the end of the file 4b - FourCC - "INFO" 4b - Int32 - Offset to end of header 4b - Int32 - Number of animations Xb - Char[X] - Null-terminated string (internal file name used in the)
Animation
4b - FourCC - "NAME" 4b - Int32 - Length of the name of the animation (X) Xb - char[X] - Animation name (null-terminated string) 4b - FourCC - "DGAN" 4b - Int32 - Offset to the end of the animation (including it's content) 4b - FourCC - "INFO" 4b - Int32 - Offset to first object 4b - Int32 - Number of objects in the animation 4b - Int32 - NULL
Object
4b - FourCC - "CPAN" 4b - Int32 - Offset to end of object 4b - FourCC - "ANIM" 4b - Int32 - Offset to the end of frames 28b - Char[28] - Object name (null-terminated string) 4b - Int32 - Number of frames 4b - Int32 - NULL 4b - Int32 - Next sibling 4b - Int32 - Previous sibling
Frame Info
4b - FourCC - Type 4b - Int32 - End of frame data
Frametypes
Frametypes define the size and the content of a frame. Actually there are 3 known types. Each frametype identifier starts with K which corresponds to "Keyframe". The following 3 bytes define the order and the content of the data. They are ASCII encoded characters
R - Rotation T - Translation S - Scale 0 - None
Translation is a vector which points to an offset in the world. For cutscenes it is relative to an offset given in a special file. Usually just the root object contains translated frames.
Frame Data
Each type has a different structure. They can be combined and are read by the game in the order they are written in the type value.
// Rotation 4b - Float - Quarternion X 4b - Float - Quarternion Y 4b - Float - Quarternion Z 4b - Float - Quarternion W
// Translation 4b - Float - X 4b - Float - Y 4b - Float - Z
// Scale 4b - Float - X 4b - Float - Y 4b - Float - Z
Every frame got one last floating value at the end describing the time in seconds.
4b - Float - Time
Version 2
Version 2 archives got basically the same hierarchy as above, but the structures are a bit different. In version 2 all strings are Null-terminated, but they got a constant size of 24 bytes.
Header
4b - FourCC - 'ANP3' (Animation Package 3, Version identifier. However there is no pack with ANP2) 4b - Int32 - Offset to end of file 24b - Char[24] - internal file name used in the 4b - Int32 - Number of Animations
Animation
24b - Char[24] - Animation Name 4b - Int32 - Number of Objects 4b - Int32 - Size of frame data 4b - Int32 - Unknown, always 1
The size of data value is a number of bytes which corresponds to the exact size of the frame's usable data, including the compressed coordinates and rotation info.
Object
24b - Char[24] - Object Name 4b - Int32 - Frame type: Child = 3, Root = 4 4b - Int32 - Number of Frames 4b - Int32 - Bone ID
Frame
Root frames always follow the following structure:
2b - Int16 - Quaterion X 2b - Int16 - Quaterion Y 2b - Int16 - Quaterion Z 2b - Int16 - Quaterion W 2b - Int16 - Time (in seconds) 2b - Int16 - Translation X 2b - Int16 - Translation Y 2b - Int16 - Translation Z
Child sections have no translation values.
2b - Int16 - Quaterion X 2b - Int16 - Quaterion Y 2b - Int16 - Quaterion Z 2b - Int16 - Quaterion W 2b - Int16 - Time (in seconds)
To convert quaternion and translation values to floating values divide them by 4096.
External Link
- List of San Andreas' Animations Seemann's website
- List of Vice CIty's and San Andreas' Animations Ceedj's website