FF9/File/0x03
Animation header
Animation block begins with 2 empty bytes. Here there is main place to calculate animation pointers.
Next there is 2 bytes that represents Frames count of animation.
Next there is 6 bytes, which can be either direct coordinates X, Y, X or pointers to animation position. Type represents next possible values:
Value | Description | Bit mask |
---|---|---|
0 | X, Y, Z – pointers | 00000000 |
1 | X-Value, Y,Z-pointers | 00000001 |
2 | Y-Value X,Z-pointers | 00000010 |
3 | X,Y – Values Z-pointer | 00000011 |
4 | Z- Value X,Y– pointers | 00000100 |
5 | X,Z– Values Y– pointer | 00000101 |
6 | X,Y– Values X-pointer | 00000110 |
7 | X, Y, Z - Values | 00000111 |
It was made for animation shortage. In other words, value, that doesn't change is represented by 1 value and doesn't changed during all animation, and another, which represented by pointer, points to sequence, consisted of 2*frames_count bytes, which points to coordinate values in current animation frame. For representing position used 2-byte numbers.
After this 8 bytes there is 2 pointers, every is 4-byte, which points to angle table and offset table.(????). Calculated from beginning of animation block.
Angle table
Next there is bone animation table. Bones animated is achieved by changing angle. Used very popular and easy to understand Euler angles. For every bone in selected table there is either direct values of angles or pointers to animation. As we saw earlier, there is flag, that represents, what we have (angle or pointer to animation). Record count in table equal to count of bones.
Record structure:
Pitch | Yaw | Roll | Flag |
---|---|---|---|
2 bytes | 2 bytes | 2 bytes | 2 bytes |
Flag meaning is the same, as we saw earleir. If in table there is angle value, that we need to take only 1 byte (unsure, second byte is very often not 0), if there is an pointer, it calculated from beginning of animation block, used 2 bytes, and where it points angles is represented by 1 byte (sequence for selected angle contains 1*frames_count bytes)
!!!! This angles needs to be shifted to 4 bits to the left, as from second table it'll be extracted lower bits. Full 360 angles is 4096.!!!!
Low angle part table
Next there is table, identical to table of bone angles, it's table of lower bits of angles. After this table there is same animation block, to which points pointers from this table. For every frame there is half-byte (0x0f possible values), this values or-ing with high parts.
In the end we have full angles from 0 to 4095.