Callback: Next animation frame

From GRFSpecs
Revision as of 13:28, 2 August 2024 by Peter1138 (talk | contribs) (→‎Next animation frame (1A/26/141/153/158))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Next animation frame (1A/26/141/153/158)

Called in every animation frame, this callback returns the number of the next frame to display. Additionally, it can return these special values:

Value Meaning
FF stop animation. The current frame stays on screen until the animation is restarted.
FE continue with next frame as usual. You can return this for stages where you don't want to do anything special.

Supported by OpenTTD Supported by TTDPatch 2.5 (beta 2)2.5 From TTDPatch 2.5 beta 2, you can ask for random bits in variable 10. To enable this, set bit 3 of property 19 for houses, bit 0 of property 12 for industry tiles, bit 2 of property 13 for stations, or bit 12 of property 10 for objects.

Like all animation callbacks, if the high byte of the result is nonzero, it will be interpreted as a sound effect number, and the corresponding sound effect will be played at the tile.

Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.