Skip to content

Animation

Rena Kunisaki edited this page Aug 9, 2020 · 7 revisions

Fox Animation IDs

  • 0x0000: standing
  • 0x0002: starting to run
  • 0x0003: running
  • 0x0016: walking
  • 0x001B: idle, looking at arm
  • 0x001C: idle, looking around
  • 0x001E: stopping walking
  • 0x002D: climb up ladder (alternates with 0x2E)
  • 0x002E: climb up ladder (alternates with 0x2D)
  • 0x0038: climb down ladder (alternates with 0x39)
  • 0x0039: climb down ladder (alternates with 0x38)
  • 0x0045: stopping running/shielding
  • 0x004C: swimming slowly
  • 0x004F: shielding
  • 0x005B: strafing (holding L)
  • 0x006E: climb down wall (alternates with 0xBE)
  • 0x006F: climb up wall (alternates with 0xBF)
  • 0x0070: hang on wall
  • 0x0071: climb up from wall
  • 0x0073: swimming
  • 0x0074: swimming
  • 0x00BE: climb down wall (alternates with 0x6E)
  • 0x00BF: climb up wall (alternates with 0x6F)
  • 0x00C0: hang on wall
  • 0x00E6: stopping running
  • 0x00E7: turning while running
  • 0x00E8: turning
  • 0x00F2: stopping running with staff
  • 0x00F8: riding bike
  • 0x0263: flying Arwing
  • 0x0337: tied up
  • 0x0348: tied up
  • 0x0351: tied up
  • 0x035A: get item
  • 0x0404: riding SnowHorn
  • 0x040D: crawling through hole
  • 0x040F: standing up after crawling
  • 0x0413: floating in water
  • 0x041D: stopping walking with staff
  • 0x0431: walking with staff
  • 0x043A: running with staff
  • 0x0469: attacking with staff
  • 0x047B: rolling
  • 0x047F: rolling with staff

Animation Lookup

Each model also has an animation ID map in MODANIM.BIN. The map's offset is found by looking up the model ID in MODANIM.TAB. The map's length is the next offset minus its own offset. (In many cases, the length is zero.)

AMAP.TAB/AMAP.BIN may be the same as MODANIM but for maps instead of models?

Each model has, in its model file, eight animation indices; eg:

Model Idx0 Idx1 Idx2 Idx3 Idx4 Idx5 Idx6 Idx7
Fox 0000 00FE 0113 0198 0219 029C 0000 0000
Krystal 0000 00FD 0112 0197 0218 029B 0000 0000

To look up an animation ID:

  1. The high byte of the ID is an index into this table.
  2. The low byte of the ID is added to the value from this table.
  3. The result is looked up in the model's animation map. (XXX what if not found?) This value is the "real" animation ID.
  4. This ID is looked up in PREANIM.TAB. If the upper 4 bits are 0, ANIM.TAB/ANIM.BIN are used instead; otherwise, the remaining bits are an offset into PREANIM.BIN.
  5. The data from PREANIM.BIN or ANIM.BIN is the compressed animation data.

Compression

Interpreted by function 0x800074ec

Header:

  • u32 (or 2x u16?) flags? (eg 0x001600EA)
  • u32 length of some sort? (eg 0x00002413)
  • u16 unknown (eg 0x4100)

Next is the animation data, then the time data, then the "patch" data.

XXX how do we know where each field begins?

Animation Data

Defines the rotation, scale, and translation of each bone.

Each entry is 16 bits, masked as such:

  • 0x000F: Time Length

  • 0x0010: Scale

  • 0x0020: Translation

  • 0xFFC0: Value

  • Time Length: If not zero, then read (and consume) that many bits from the time data. The resulting value is a time scale. Each rendered frame, this data is decompressed, and these time scales are used to interpolate from one animation frame to the next. (XXX more info)

  • If Time Length is zero, then this entry's value is used for the entire animation frame.

  • Scale/Translation: Whether these fields are present. If not, the value for these fields is zero. (These are added to the original value, so a scale of zero means "no change".)

  • Value: The actual value for this field.

Entries are in order:

  • X Rotation, bone 0
  • (Optional) X Scale, bone 0
  • (Optional) X Translation, bone 0
  • Y Rotation, bone 0
  • (Optional) Y Scale, bone 0
  • (Optional) Y Translation, bone 0
  • Z Rotation, bone 0
  • (Optional) Z Scale, bone 0
  • (Optional) Z Translation, bone 0
  • X Rotation, bone 1
  • ...

Presumably the number of entries is defined by the number of bones in the model.

Time Data

A series of bit-packed values indexed from the animation data.

Patch Data

A series of entries:

  • u16 offset
  • u16 unknown
  • s16 value
  • u16 unknown

Ends when offset = 0x1000. Otherwise, value is added to the value at offset within the decompressed animation data.

Decompressed Data

The output of function 0x800074ec is the raw rotation, scale, and translation data for each bone for the current animation frame, in the format:

  • s16 X rotation, s16 Y rotation, s16 Z rotation (head)
  • s16 X rotation, s16 Y rotation, s16 Z rotation (tail)
  • s16 X scale, s16 Y scale, s16 Z scale (head)
  • s16 X scale, s16 Y scale, s16 Z scale (tail)
  • s16 X translation, s16 Y translation, s16 Z translation (head)
  • s16 X translation, s16 Y translation, s16 Z translation (tail)
  • 28 bytes that seem to be unused (this function skips over them)

The "tail" values do not appear to actually affect anything. These values are absolute; the function interpolates the input values, the time data, and the bones' normal positions.

Vertex Animation?

Field 0xDC of the model file header points to a list of offsets to vertex adjustment data. Field 0xF9 is the number of entries in this list.

Each entry is a u16, where the top 3 bits tell whether X, Y, Z values are present. An entry with all three of these bits clear marks the end of the list. (In practice, the entry seems to always be 0x08AA.)

The remaining bits may be an offset or vertex number?

Following the entry is between one and three s16s, for the X, Y, and Z values.

It's not known what exactly this data is used for. It may be related to the fur effect.

Clone this wiki locally