Animation file

From Boktai Hacking Wiki

TODO: This page needs verification.

Animation files store animation for actor sprites. Each actor in the actor sprites file may contain multiple sprites, and animaitons determine when the actor should show which sprite (and optionally, if the sprite should be flipped).

File format

struct AnimationFile {
  /* offset 0x00 */ u16 animationCount;
  /* offset 0x02 */ u16 frameCount;

  /* offset 0x04 */ Animation animations[animationCount];

  AnimationFrame frames[frameCount];
};

struct Animation {
  /* offset 0x00 */ u8 variantCount;
  /* offset 0x01 */ u8 frameCount;

  // Byte offset from start of the file to the 1st frame of the 1st variant
  // for this animation.
  // There are variantCount*frameCount frames in this animation.
  /* offset 0x02 */ u16 frameOffset;
};

struct AnimationFrame {
  // Bits 0-3: Delay in frames until the next frame
  // Bit 4: Flip sprite horizontally
  // Bit 5: Flip sprite vertically
  // Bits 6-15: Sprite index within the ActorSpritesActor (see "Actor sprites file" page)
  u16 data;
};

Variants

Each animation can have multiple variants, unsure how this is used. The variant is manually selected by the game engine.