======== Animation ========
[[sm64:behavior_commands#Set Word|Behavior command 0x27]] with address byte = 0x26 (addressA = 0x120) adjust animation pointers to segmented addresses.
===== Animation Header =====
''[RR RR] [?? ??] 00 00 00 00 [FF FF] [NN NN] [VV VV VV VV] [II II II II]''
^ Offset ^ ^ Description ^
| 00-01 | R | amount of repeats, 0 = infinite |
| 02-03 | ? | unknown |
| 04-07 | ? | empty? |
| 08-09 | F | frame count |
| 0A-0B | N | node count (every 0x13 command opens one node, nodes are attached to the previous node by 0x04 commands) |
| 0C-0F | V | segmented pointer to transformation values |
| 10-13 | I | segmented pointer to transformation index |
===== Transformation Index =====
First 0x0C bytes are for translation, though it acts weird.
All the other 0x0C byte groups are for limb rotation.
framecount = obj->0x40;
if (framecount>key) {
framecount = key;
}
value select*2+framecount*2+transformation values offset = translation or rotation to use
===== Model Translation Group =====
| 0-1 | (u16 number of key frames for X translation) |
| 2-3 | (u16 value select) |
| 4-5 | (u16 number of key frames for Y translation) |
| 6-7 | (u16 value select) |
| 8-9 | (u16 number of key frames for Z translation) |
| A-B | (u16 value select) |
===== Node Rotation Group =====
| 0-1 | (u16 number of key frames for X rotation) |
| 2-3 | (u16 value select) |
| 4-5 | (u16 number of key frames for Y rotation) |
| 6-7 | (u16 value select) |
| 8-9 | (u16 number of key frames for Z rotation) |
| A-B | (u16 value select) |
===== Example =====
Castle Flag Waving Behavior (0x13003C58)
21DA58 / 13003C58 [ 00 08 00 00 ]
21DA5C / 13003C5C [ 11 01 00 01 ]
21DA60 / 13003C60 [ 27 26 00 00 07 00 C9 5C ] // Set initial animation (0700C95C = ROM address 0xFD4163)
21DA68 / 13003C68 [ 28 00 00 00 ]
21DA6C / 13003C6C [ 0C 00 00 00 80 2F 08 4C ]
21DA74 / 13003C74 [ 08 00 00 00 ]
21DA78 / 13003C78 [ 09 00 00 00 ]
Animation header (0xFD414B)
00 00 // 0x0000 = Loop animation infinitely
00 00 00 00 00 00 // Unknown?
00 1D // Frame count
00 06 // Node count
07 00 C7 C8 // Segment pointer to transformation values
07 00 C8 F0 // Segment pointer to transformation index
Transformation index:
// Model translation group:
00 01 00 00 00 01 00 01 00 01 00 00
// Node rotation groups:
00 01 00 02 00 01 00 00 00 01 00 00
00 01 00 00 00 01 00 00 00 1D 00 77
00 01 00 00 00 01 00 00 00 1D 00 5A
00 01 00 00 00 01 00 00 00 1D 00 3D
00 01 00 00 00 01 00 00 00 1D 00 20
00 01 00 00 00 01 00 00 00 1D 00 03
===== See Also =====
[[sm64:behavior_commands]]
===== References =====
* https://sites.google.com/site/kazemario64/animations