Difference between revisions of "IFP"

From GTAMods Wiki
Jump to navigation Jump to search
m (Animation)
m (the headers looked huge, shrunk them by one)
Line 1: Line 1:
 
IFP is the animation format of the Grand Theft Auto series since [[Category:GTA_3|GTA III]]. With [[Category:GTA_SA|GTA San Andreas]] 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.
 
IFP is the animation format of the Grand Theft Auto series since [[Category:GTA_3|GTA III]]. With [[Category:GTA_SA|GTA San Andreas]] 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.
  
=File Specification=
+
==File Specification==
  
==Version 1==
+
===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 descriping the following value(s). Offsets are allways relative to the current file position. To convert a relative offset to an absolute one just add the number of read bytes.
+
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===
+
====Header====
 
  4b  - FourCC  - "ANPK" (Animation Package, Version identifier)
 
  4b  - FourCC  - "ANPK" (Animation Package, Version identifier)
 
  4b  - Int32    - Offset to the end of the file
 
  4b  - Int32    - Offset to the end of the file
Line 14: Line 14:
 
  Xb  - Char[X]  - Null-terminated string (internal file name used in the [[Category:Mission_Script|Script]])
 
  Xb  - Char[X]  - Null-terminated string (internal file name used in the [[Category:Mission_Script|Script]])
  
===Animation===
+
====Animation====
 
  4b  - FourCC  - "NAME"
 
  4b  - FourCC  - "NAME"
 
  4b  - Int32    - Length of the name of the animation (X)
 
  4b  - Int32    - Length of the name of the animation (X)
Line 25: Line 25:
 
  4b  - Int32    - NULL
 
  4b  - Int32    - NULL
  
===Object===
+
====Object====
 
  4b  - FourCC  - "CPAN"
 
  4b  - FourCC  - "CPAN"
 
  4b  - Int32    - Offset to end of object
 
  4b  - Int32    - Offset to end of object
Line 36: Line 36:
 
  4b  - Int32    - Previous sibling
 
  4b  - Int32    - Previous sibling
  
===Frame Info===
+
====Frame Info====
 
  4b  - FourCC  - Type
 
  4b  - FourCC  - Type
 
  4b  - Int32    - End of frame data
 
  4b  - Int32    - End of frame data
  
====Frametypes====
+
=====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
 
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
  
Line 48: Line 48:
 
  0 - None
 
  0 - None
  
Translation is a vector which points to an offset in the world. For [[Cutscene|cutscenes]] it is relative to an offset given in a special file. Usualy just the root object contains translated frames.
+
Translation is a vector which points to an offset in the world. For [[Cutscene|cutscenes]] it is relative to an offset given in a special file. Usually just the root object contains translated frames.
  
===Frame Data===
+
====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.
 
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.
Line 70: Line 70:
 
  4b  - Float    - Z
 
  4b  - Float    - Z
  
Every frame got one last floating value at the end descriping the time in seconds.
+
Every frame got one last floating value at the end describing the time in seconds.
  
 
  4b  - Float    - Time
 
  4b  - Float    - Time
  
==Version 2==
+
===Version 2===
Version 2 archives got basicly 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.
+
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===
+
====Header====
 
  4b  - FourCC  - 'ANP3' (Animation Package 3, Version identifier. However there is no pack with ANP2)
 
  4b  - FourCC  - 'ANP3' (Animation Package 3, Version identifier. However there is no pack with ANP2)
 
  4b  - Int32    - Offset to end of file
 
  4b  - Int32    - Offset to end of file
Line 83: Line 83:
 
  4b  - Int32    - Number of Animations
 
  4b  - Int32    - Number of Animations
  
===Animation===
+
====Animation====
 
  24b  - Char[24] - Animation Name
 
  24b  - Char[24] - Animation Name
 
  4b  - Int32    - Number of Objects
 
  4b  - Int32    - Number of Objects
 
  4b  - Int32    - Size of frame data
 
  4b  - Int32    - Size of frame data
  4b  - Int32    - Unknown, allways 1
+
  4b  - Int32    - Unknown, always 1
  
The size of data value is a number of bytes which corrensponds to the exact size of the frame's usable data, including the compressed coordinates and rotation info.
+
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===
+
====Object====
 
  24b  - Char[24] - Object Name
 
  24b  - Char[24] - Object Name
 
  4b  - Int32    - Frame type: Child = 3, Root = 4
 
  4b  - Int32    - Frame type: Child = 3, Root = 4
Line 97: Line 97:
 
  4b  - Int32    - Bone ID
 
  4b  - Int32    - Bone ID
  
===Frame===
+
====Frame====
Root frames allways follow the following structure:
+
Root frames always follow the following structure:
  
 
  2b  - Int16    - Quaterion X
 
  2b  - Int16    - Quaterion X
Line 118: Line 118:
  
 
To convert quaternion and translation values to floating values divide them by 4096.
 
To convert quaternion and translation values to floating values divide them by 4096.
 +
 +
==External Link==
 +
[http://public.sannybuilder.com/anim/ List of San Andreas' Animations]

Revision as of 01:34, 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.

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