ANM (Animation Information)
Sprite animation data of the sprite editor.
| Extension | .ANM |
|---|---|
| ID | 0x21 |
| Version | 0x03 |
Overview
The ANM format contains the information that specifies the animation of image data. An ANM file is typically used together with a TIM file, which contains the actual image. The file has a header at the top and is divided into four blocks: HEADER, SEQUENCE, SPRITEGp and CLUTGp.1
HEADER
The file header is two words:12
| Word | Bits | Field | Contents |
|---|---|---|---|
| 0 | 0..7 | ID | 0x21 |
| 0 | 8..15 | VERSION | 0x03 |
| 0 | 16..31 | FLAG | CLT and TPF |
| 1 | 0..15 | NSPRITEGp | Number of sprite groups |
| 1 | 16..31 | NSEQUENCE | Number of sequences |
The CLT field of FLAG gives the number of CLUTs for color animation. From version 2 on, FLAG also holds TPF, the pixel depth of the texture pattern, which is 00 for 4-bit and 01 for 8-bit.2
SEQUENCE
Sequence data gives the hot spot coordinates of each frame together with its display time and its sprite group number. Each entry is two words. Versions before 3 have no ATTR field.2
| Word | Bits | Field | Contents |
|---|---|---|---|
| 0 | 0..15 | SprGpNo | Number of the sprite group to be displayed |
| 0 | 16..23 | TIME | Display time (number of repetitions) |
| 0 | 24..31 | ATTR | Attribute (user defined) |
| 1 | 0..15 | X | X coordinate of the hot spot |
| 1 | 16..31 | Y | Y coordinate of the hot spot |
SPRITEGp
Sprite group data is a set of sprite groups that describe where each sprite is displayed in a frame. Each group opens with NSprite, which is the number of sprites in the frame. Five words follow for each sprite:34
| Word | Fields |
|---|---|
| 0 | u, v (offset from the base address of the texture page), Ofs X, Ofs Y (offset from the hot spot) |
| 1 | CBA, FLAG |
| 2 | W, H (size of a texture of optional size) |
| 3 | ROT (angle of rotation), FLAG2 |
| 4 | X, Y (scaling factor as a fixed-point number) |
The figure labels W as the height and H as the width of the texture. The other sprite editor formats use the reverse.3
The FLAG of a sprite has the following fields:4
| Field | Contents |
|---|---|
| THW | Size of the rectangular area of the sprite divided by 8. If the size cannot be divided by 8, THW is 0 and H and W give the size. |
| ROT | 0 not rotated, 1 rotated |
| RSZ | 0 not scaled, 1 scaled |
| TPF | Pixel depth of the texture pattern: 00 4-bit CLUT, 01 8-bit CLUT, 10 16-bit |
| ABR | Semi-transparency rate: 00 0.50xF+0.50xB, 01 1.00xF+1.00xB, 10 -1.00xF+1.00xB, 11 0.25xF+1.00xB |
| TPN | Texture page number (0 to 31) |
CBA holds CLY and CLX, which are the 9-bit Y coordinate and the 6-bit X coordinate of the start of the CLUT. From version 3 on it also holds ABE, which turns semi-transparency processing on. From version 2 on, FLAG2 holds BNO and CSN, which are the TIM bank number and the color set number of the sprite editor.45
Version 0 and version 1 files have no bank number, so the bank is found another way:5
| Bank | Version 0 | Version 1 |
|---|---|---|
| 0 | TPN 12 | CBA_x < 255, CBA_y <= 495 |
| 1 | TPN 28 | CBA_x < 255, CBA_y > 495 |
| 2 | TPN 8 | CBA_x >= 255, CBA_y <= 495 |
| 3 | TPN 24 | CBA_x >= 255, CBA_y > 495 |
CLUTGp
CLUTGp is the group of CLUTs used for color animation. The number of CLUTs is given by the CLT field of FLAG in the HEADER block. Each CLUT has the same layout as a TIM CLUT block, with bnum, DX, DY, W and H followed by 16-bit entries.6
References
-
^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-16, Figures 171 and 172.
-
^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-17, Figures 173 and 174.
-
^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-18, Figure 175.
-
^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-19, Figures 176 and 177.
-
^ a b Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-20, Figure 178.
-
^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 3-21, Figure 179.