FB00791E
FB00791E | |
---|---|
Short name: | ANIM |
Long name: | Animation |
This is a type of Scenegraph block that controls animation in Objects and Sims.
Contents |
File Format
ANIM header
7BITSTR "cAnimResourceConst" ;Standard Scenegraph followed by custom Animation header. DWORD Block ID (0xFB00791E) DWORD version (6) ;-- insert cSGResource ;Custom Animation Header DWORD data length WORD Total Length of Animation (probably in Milliseconds or Frames) WORD count1 count to a list of object modifiers WORD count2 Count for part 7 BYTE [0] ""ObjectModifierLength"" (this is the count for the 2nd string below if is non null) BYTE [1] Version (Base game+EP1 version 6, EP2-SP2 version 7) BYTE [2] Animation Type(4 Object Overlay Animations, 5 Object Animation, 6 Body Overlay Animations, 7 Body Animation) BYTE [3] UNKNOWN BYTE [4] Locomotion type index (values 0 none, 1 pose, 6 turnAndGo, 7 turnAndStop, 8 turnInPlace, 9 step , 10 stepInPlace, 11-19 walktypes, 30-38 blends for the types in 11-19) BYTE [5] ""ObjectNameLength"" 16 BYTES - FILLER (from old version) (0X11BA05F0) FLOAT [0] Initial Direction(in radians) FlOAT [1] UNKNOWN(non-zero in locomotion animations where it seems to correlate with the magnitude of the step) FlOAT [2] UNKNOWN(non-zero in locomotion animations values vary with skeleton size and step) FlOAT [3] UNKNOWN(usually 0 or 0.5) FlOAT [4] UNKNOWN(non-zero in locomotion animations values usually in thousandths, correlate closely to next float) FlOAT [5] UNKNOWN(non-zero in locomotion animations values usually in thousandths, correlate closely to previous float) FlOAT [6] Final Direction(in radians) FlOAT [7] Skeleton Scale FLOAT [8] Height?(in standing animations, correlates very closely to height of the root_trans of the skeleton, otherwise 0 or -1) ZDSTR Object Name (first object name) ZDSTR Object Modifier string (looks like code to add to a output file always starts out "\nuser_data=") there can be between 0 and 3 bytes here (00 01 02) the logic used for this is explained below
Object
-Repetition count1 8 BYTES - FILLER (from old version) WORD WORD count WORD part5_count WORD length of blend`s name. 12 BYTES - FILLER (from old version) -repetition count1 ZDSTR seems to be a list of objects to blend with 1st object there can be between 0 and 3 bytes here (00 01 02) the logic used for this is explained below
Assignment
-repetition all the count's in part 1 added together 8 BYTES - FILLER (from old version) DWORD - CRC32 of the bone/joint/blend's name DWORD - FILLER (from old version) DWORD - Anim Flags (Highest 3 Bits (Bit 31-29) contain the Number of "Part 3" Items, Bits 23-16 describe the Transformation Type (0=Translation, C=Rotation).) Bits 0-15 of this are the time of the animation for this bone with the highest bit (15) set. DWORD - FILLER (from old version) -repetition all the count's in part 1 added together ZDSTR seems to be a list of transforms and rotations there can be between 0 and 3 bytes here (00 01 02) the logic used for this is explained below
Movements
-repetition (total repetitions are calculated by adding the top 3 bits of all Anim flags from part 2) WORD - number of frames WORD - type of bone (bits 0 and 1) plus how many shorts per part 4 block (bits 2 and 3) DWORD - FILLER (from old version)
Transforms
This Block represents the Transformation Data. Each "Part 4" Block contains all transformations for a specific Axis, ordered by TimeCode. So you can animate the diffrent Axis independently!!
The count for this section is derived with the following code. The code is used on each Unknown1 and 2 in part 3 it uses the 1st, 2nd and 5th bits of Unknown2 then multiplying by Unknown1.
int mult=0; switch(p3.Unk2&3) { case 0: mult=1; break; case 1: mult=3; break; case 2: mult=4; break; } if ((p3.Unk2&16)!=0) mult++; size=(p3.Unk1*mult);
-repetition See above code
WORD seems to be compressed floats. The Values here are stored in Blocks (Number of values per Block = mult). The offset index for a Block can be calculated by offset=mult*blocknr. Here is what we know so far about the Block Structure:
offset + 0 : TimeCode (when should the stored Transformation happen) offset + 1 : (optional) Transformation Value (like the translation amount, or the rotation angle) offset + 2 : (optional, likely InTangents) offset + 3 : (optional, likely OutTangents)
Part 5
-repetition (total repetitions are calculated by adding the lower 6( or less?) bits of all part5_count from part 1) 8 BYTES - FILLER (from old version) WORD Index to P5 item BYTE Count WORD CRC(IK target name) BYTE Unknown WORD CRC(IK target name) BYTE Unknown WORD CRC(Object from P2 Name) BYTE Unknown WORD CRC(Object from P2 Name) BYTE Unknown WORD CRC(Object from P2 Name) BYTE Unknown WORD CRC(Object from P2 Name) BYTE Unknown DWORD - FILLER (from old version)
Part 6
-repetition (for each count in Part 5) 8 BYTES - FILLER (from old version) 35 unknown
Events
This on the end of the file if count2 in the header is non zero.
-repetition count2 from begining of file DWORD - FILLER (from old version) WORD TimeCode WORD Type (ex. 8=Effect, 1014=Sound, 1005=Behavioural event) WORD Length of event assignment string DWORD - FILLER (from old version) -repetition count2 ZDS - Event Assignment String
After each of the first 3 sets of text above there is generally an array of up to 3 bytes. This array is probably to bring the section to a specific word cut off. Logic is as follows:
if the length of the strings from the first letter to the end of the section is even the length must be brought up to a even DWORD if the length is odd the length must be brought up to a even WORD that is not also a DWORD
Examples:
- If length =14 then an array of 2 bytes{0,1} must be added to bring it up to a even DWORD(total length divisible by 4).
- If length =15 then an array of 3 bytes{0,1,2} must be added to bring it up to a even WORD(total length divisible by 2).
- Also note that the odd value must not be divisible by 4 but only by 2.
- If length =16 then no array needs to be added as the total length is already divisible by 4.
- If length =17 then one byte{0} must be added to the file to bring it up to a even WORD(total length divisible by 2 but not 4).