Ark of Time AN

From MultimediaWiki
Jump to navigation Jump to search

AN is an animation format used in Ark of Time game.

Container format (all numbers are little-endian):

 4 bytes - header size
   N bytes - flags for each frame (variable-length)
 0x1400 bytes - ignored
 frames in the following format:
   4 bytes - frame size
   N bytes - frame data

Flags are variable-length pieces of information:

 1 byte - initial flags
 2 bytes - frame delay
 if (initial_flags & 2)
   // no additional data, it signals that actual frame data is present
 if (initial_flags & 8)
   2 bytes - unknown
 if (initial_flags & 0x20) // something related to displaying subtitles
   2 bytes - unknown
   1 byte - unknown
   1 byte - unknown
   1 byte - unknown
 if (initial_flags & 0x40)
   1 byte - also something related to subtitles
 if (initial_flags & 0x80) // should not happen simultaneously with flag 0x40
   1 byte - also something related to subtitles
 if (initial_flags & 0x10)
   768 bytes - VGA palette

Frames are packed using very simple copy/skip method: read a byte, top bit of it is a copy/skip marker (if set - read data from stream, otherwise skip it), low 7 bits are copy/skip length (0 means that 16-bit actual length should be read); depending on it either read the requested amount of pixels from the stream or skip them.