Actor states are the frames of animation used to define the behavior of an actor in DECORATE.
The states are defined in the states block. Each state has the following syntax.
[StateLabel:] sprite frames duration [flags] [action function [ticker]] [control flow]
- A state label is name given to the state immediately following. These are used to define jump points in the animation. Some labels are used for various purposes within the engine. Multiple state labels may be assigned to a single state.
- Four character code that corresponds to the sprite to display for the state. TNT1 can be used if no sprite is desired.
- Frame letter to use for the state. As a shortcut, multiple frames can be specified. They will be expanded to consecutive states differing only in the frame letter.
- How many tics (1/35th of a second) the state should be held. Half durations are allowed since Wolfenstein has a 70hz tic rate. A duration of -1 is defined as infinite.
- Currently the only flag supported is BRIGHT which specifies that the frame should be rendered full bright.
- action function and ticker
- Code pointers to execute. The action function is executed at the start of the state (before it is displayed). The ticker function is executed at the end of every tic (will not be executed on states with a 0 duration). If only the ticker function is desired then NOP can be used in place of the action function.
By default each state continues on to the state immediately following. This can be changed to any of the following:
- goto StateLabel[+offset]
- Jumps to the specified state label with an optional offset. Note that this is resolved statically so if the label is redefined in a child actor, this will still goto the label in this actor (not the child). A_Jump can be used if dynamic resolution is desired.
- Jumps to the last defined state label.
- Repeats the previously defined state indefinitely. Used for functions like A_Raise where they are expected to jump after a certain period of time. Note that if multiple frames are given this will wait at the last frame.
- Removes the actor from the game.
The following state labels are automatically used for various purposes by the engine.
- The initial state for all actors entering the game.
- Used in place of the Spawn state when the actor is set to follow a path.
- Used when the actor should be chasing its target (usually the player).
- Defines a melee range attack.
- Defines a long range attack.
- Randomly used when an actor is attacked based on the PainChance.
- Jumped to when the actor reaches 0 health or when a projectile hits a wall.
- Jumped to when an actor reaches a significantly negative amount of health or when a projectile hits an actor.
- Actor states on the ZDoom wiki.