-
Notifications
You must be signed in to change notification settings - Fork 9
ANM Animation
Format somewhat deciphered except for 1 unknown 4-byte value and 20 zero-bytes after the header.
The extension (.anm
) and file signature (ANM
) stands for "Animation Script" (as dictated by common sense).
Internally, Command Lines/Command Line Count are referred to as Timelines/Timeline Count (as shown from assembly log message: "kcAnmScript : タイムライン数が不正です").
(It's undetermined whether this is a difference in translation)
Data Type | Value | Description |
---|---|---|
char[4] |
"ANM" | File Signature |
uint32 |
Unknown | Second half of 8-byte file signature? |
uint32 |
TimelineCount | Number of Timelines in animation script |
byte[20] |
Unknown | Seems to always be zeros, initial values for Max, Blend, Disp, PosXY, etc.? |
Timeline[TimelineCount] | Timelines | Table of animation timeline commands |
These always immediately follow the previous Timeline.
Data Type | Value | Description |
---|---|---|
uint32 |
CommandType | Command performed by the line |
Parameter[8]
|
Parameters | Table of 8 parameters (only 3 are ever used) |
Data Type | Value | Description |
---|---|---|
uint32 |
ParameterType |
0 for literal, 1 for variable,2 for label (treated as literal, unused) |
uint32 |
Value | Value of parameter or index of Variable |
At the time of writing, every command type is known, as their names were ripped from the ac.exe
assembly and then tested via compiling.
The commands max
, blend
, disp
and pos
have not been tested, but can be guessed on their functionality. All commands have been compared to the decompiled assembly for the script execution.
x = command name
[x] = required parameter
(x) = optional parameter
Command | Val | Description |
---|---|---|
[ID] [min] (max) | 0 |
Display image Id for range of ticks |
set [var] [min] (max) | 1 |
Set variable from range of values |
loop [var] [label] | 2 |
Jump to label if variable > 0 else --variable |
jump [label] | 3 |
Jump to label |
if [var] [label] | 4 |
Jump to label if variable > 0 |
ife [var] [value] [label] | 5 |
Jump to label if variable == value |
ifn [var] [value] [label] | 6 |
Jump to label if variable != value |
ifg [var] [value] [label] | 7 |
Jump to label if variable > value |
ifs [var] [value] [label] | 8 |
Jump to label if variable < value |
ifge [var] [value] [label] | 9 |
Jump to label if variable >= value |
ifse [var] [value] [label] | 10 |
Jump to label if variable <= value |
max [var] | 11 |
Get "max" value and assign to variable |
blend [value] | 12 |
Set blend value |
disp [value] | 13 |
Set display value |
pos [x] [y] | 14 |
Set position of image |
wait [min] (max) | 15 |
Stay on image for range of ticks |
add [var] [value] | 16 |
Add variable += value |
sub [var] [value] | 17 |
Subtract variable -= value |
If a command has an optional parameter, this parameter will always be present whether or not it was specified. In the case of (max), it's value will be the same as [min].
Command parameters that ask for a variable do not set the ParameterType field in the parameter like expected. A variable will still be listed as a Literal, unless the user specifies a reference (@
) to a variable. In fact, it's possible to pass a variable in its place (with @) and the variable's value will be the index of the variable.
Labels in animation scripts get converted to the index of the first command after the label when compiled. A label at the beginning of the file will have a value of 0 in the parameter. The parameter type of a label is always changed to 0
(by ac.exe
), even though 2
exists and is treated identically in assembly.
All Timelines have 8 parameters no matter the number of parameters the command type requires, any parameters after the total count will be ignored.
Example | Val | Description |
---|---|---|
14 |
0 |
A literal number |
@5 |
1 |
A variable (pointer/reference between) (variables: 0-63, data type: int32) |
mylabel |
2 |
A label name (treated as literal) (changed to 0 on compile, but still supported) |
Each parameter type can be used for any parameter of any command. If a label is used for a parameter not asking for a label, then the result will be a parameter with its value set to the label index. (Which is what happens even with parameters asking for labels.)