=================================================================
IFP file format for Grand Theft Auto III and Vice City animation
Written by Hollower (hollower@hotmail.com)
=================================================================
(updated Jan 2004)
This file is intended for programmers only.
First column is the number of bytes. V means that the length varies.
Second column is the suggested data type (C/C++).
Third column is a brief description of the data.
Strings are padded to 4-byte alignment.
This is how I broke up the file for reading in. The section markers
indicate the more "correct" way, but I used this simpler grouping
(ie. why worry about the parent section of "INFO" blocks when they
should always be in this order anyway), and I used the section markers
for error checking. Using my grouping also makes it easier to output
an IFP file that is valid for GTA3/GTA:VC. This may change in future
GTA games.
IFP FILE HEADER
----------------
4 (char[4]) "ANPK" --- section marker
4 (int) Offset to end of file
4 (char[4]) "INFO" --- section marker
4 (int) Offset to end of header
4 (int) Number of anims
V (char[V]) Internal file name (null terminated string)
ANIMATION INFO
----------------
4 (char[4]) "NAME" --- section marker
4 (int) Length of anim name string
V (char[V]) Anim name (null terminated string)
4 (char[4]) "DGAN" --- section marker
4 (int) Offset to end of animation
4 (char[4]) "INFO" --- section marker
4 (int) Offset to first object (usually 8)
4 (int) Number of objects
4 (int) NULL
OBJECT INFO
----------------
4 (char[4]) "CPAN" --- section marker
4 (int) Offset to end of object
4 (char[4]) "ANIM" --- section marker
4 (int) Offset to frame info (usually 48)
28 (char[28]) Object name (null terminated string, padded to 28 bytes)
4 (int) Number of frames
4 (int) NULL
4 (int) Index of last frame (Number of frames - 1)
4 (int) Index of next sibling (-1 if none)
4 (int) Index of previous sibling (-1 if none)
FRAME INFO
----------------
4 (char[4]) Frame type (see below)
4 (int) Length of frame data
FRAME DATA
----------------
Frame data is all floats. Structure depends on frame type.
Frame types:
"KRT0" Root quaternion rotation (float x,y,z,w),
vector translation (float x,y,z),
time (float seconds)
"KR00" Child rotation, time
"KRTS" Scaled rotation, translation, scale (float x,y,z), time
Root frames contain extra data for translating the model in the
world. Child frames are simply rotations, concatenated as they
go up the hierarchy.
You can probably guess, the letters here stand for
(K)eyframe, ®otation, (T)ranslation, (S)cale, (0)None
so presumably there could also be other combinations like "K0T0" but
the above are the only ones found in all of the files I studied.
Notes
----------------
Overall file structure looks like this:
Header
|
+-Animation
| |
| +-Object
| | |
| | +-Frame
| | +-Frame
| | +-Frame
| | +- ...
| |
| +-Object
| | |
| | +-Frame
| | +-Frame
| | +-Frame
| | +- ...
| |
| +- ...
|
+-Animation
| |
| +-Object
| | |
...and so on.
Object names are a reference to the DFF mesh or bone
which will be rotated with the frame data. The string
is not case sensitive.
An animation does not need to reference every part of a
model, only the ones that will move. They also do not
require an equal number of frames or matching time index.
There are sometimes anomalies like anims with 0 objects
or objects with 0 frames.
For reference, the base pose can be viewed by creating
animations with Rotation = {0.0f, 0.0f, 0.0f, 1.0f}.
I hope this file has been helpful. Now let's see some editors!
- Hollower
=================================================================
IFP file format for Grand Theft Auto III and Vice City animation
Written by Hollower (hollower@hotmail.com)
=================================================================
(updated Jan 2004)
This file is intended for programmers only.
First column is the number of bytes. V means that the length varies.
Second column is the suggested data type (C/C++).
Third column is a brief description of the data.
Strings are padded to 4-byte alignment.
This is how I broke up the file for reading in. The section markers
indicate the more "correct" way, but I used this simpler grouping
(ie. why worry about the parent section of "INFO" blocks when they
should always be in this order anyway), and I used the section markers
for error checking. Using my grouping also makes it easier to output
an IFP file that is valid for GTA3/GTA:VC. This may change in future
GTA games.
IFP FILE HEADER
----------------
4 (char[4]) "ANPK" --- section marker
4 (int) Offset to end of file
4 (char[4]) "INFO" --- section marker
4 (int) Offset to end of header
4 (int) Number of anims
V (char[V]) Internal file name (null terminated string)
ANIMATION INFO
----------------
4 (char[4]) "NAME" --- section marker
4 (int) Length of anim name string
V (char[V]) Anim name (null terminated string)
4 (char[4]) "DGAN" --- section marker
4 (int) Offset to end of animation
4 (char[4]) "INFO" --- section marker
4 (int) Offset to first object (usually 8)
4 (int) Number of objects
4 (int) NULL
OBJECT INFO
----------------
4 (char[4]) "CPAN" --- section marker
4 (int) Offset to end of object
4 (char[4]) "ANIM" --- section marker
4 (int) Offset to frame info (usually 48)
28 (char[28]) Object name (null terminated string, padded to 28 bytes)
4 (int) Number of frames
4 (int) NULL
4 (int) Index of last frame (Number of frames - 1)
4 (int) Index of next sibling (-1 if none)
4 (int) Index of previous sibling (-1 if none)
FRAME INFO
----------------
4 (char[4]) Frame type (see below)
4 (int) Length of frame data
FRAME DATA
----------------
Frame data is all floats. Structure depends on frame type.
Frame types:
"KRT0" Root quaternion rotation (float x,y,z,w),
vector translation (float x,y,z),
time (float seconds)
"KR00" Child rotation, time
"KRTS" Scaled rotation, translation, scale (float x,y,z), time
Root frames contain extra data for translating the model in the
world. Child frames are simply rotations, concatenated as they
go up the hierarchy.
You can probably guess, the letters here stand for
(K)eyframe, ®otation, (T)ranslation, (S)cale, (0)None
so presumably there could also be other combinations like "K0T0" but
the above are the only ones found in all of the files I studied.
Notes
----------------
Overall file structure looks like this:
Header
|
+-Animation
| |
| +-Object
| | |
| | +-Frame
| | +-Frame
| | +-Frame
| | +- ...
| |
| +-Object
| | |
| | +-Frame
| | +-Frame
| | +-Frame
| | +- ...
| |
| +- ...
|
+-Animation
| |
| +-Object
| | |
...and so on.
Object names are a reference to the DFF mesh or bone
which will be rotated with the frame data. The string
is not case sensitive.
An animation does not need to reference every part of a
model, only the ones that will move. They also do not
require an equal number of frames or matching time index.
There are sometimes anomalies like anims with 0 objects
or objects with 0 frames.
For reference, the base pose can be viewed by creating
animations with Rotation = {0.0f, 0.0f, 0.0f, 1.0f}.
I hope this file has been helpful. Now let's see some editors!
- Hollower
To copy to clipboard, switch view to plain text mode
qDebug() << stream;
QString str = QFileDialog::getOpenFileName(0, "Open IFP", "", "*.ifp");
QFile file(str);
if(file.open(QIODevice::ReadOnly)) {
QDataStream stream(&file);
qDebug() << stream;
To copy to clipboard, switch view to plain text mode
Bookmarks