Difference between revisions of "Callback: Next animation frame"
m (Create a separate page for each callback)  | 
				 (roadstops)  | 
				||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 11: | Line 11: | ||
|}  | 
  |}  | 
||
| − | 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,  | 
  + | {{ottdp| |2.5|ttdprev=beta 2}} 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, bit 0 of property 12 for roadstops, 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.  | 
  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.  | 
||
[[Category:Callbacks]]  | 
  [[Category:Callbacks]]  | 
||
| + | |||
| + | 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.  | 
||
Latest revision as of 11:42, 15 April 2025
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. | 
 
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, bit 0 of property 12 for roadstops, 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.