Difference between revisions of "Callback: Animation control"

From GRFSpecs
Jump to navigationJump to search
m (→‎Animation control (1B/25/140/152/159): make notes an item list)
(simplify the description for stuff that applies to almost all callbacks. esp. some descriptions were too restrictive to specific callbacks before)
Line 1: Line 1:
 
== Animation control (1B/25/140/152/159) ==
 
== Animation control (1B/25/140/152/159) ==
   
Called periodically, in a time interval specified in property 16 (houses) or when an animation trigger happens (industry tiles and stations). Returns the number of the frame the animation should jump to, or one of the following special values:
+
Called periodically, in a time interval specified in property 16 (houses) or when an animation trigger happens (industry tiles, stations, airport tiles and objects). Returns the number of the frame the animation should jump to, or one of the following special values:
   
 
{| |-
 
{| |-
Line 13: Line 13:
 
|}
 
|}
   
* For multi-tile town buildings, [[Action0Houses#Extra Flags 19|property 19/bit 2]] modifies this callback slightly, see details there.
+
* For multi-tile town buildings, [[Action0/Houses#Extra_Flags_.2819.29|property 19/bit 2]] modifies this callback slightly, see details there.
   
* For industry tiles and stations, the low byte of variable 18 contains the reason for the call, i.e. the bit number of the event from [[Action0IndustryTiles#Triggers for callback 25 11|property 11]] or [[Action0Stations#Animation triggers 18|property 18]], accordingly.
+
* Except for CB 1B (houses), the low byte of variable 18 contains the reason (animation trigger) for the call. The other bits may contain additional information specific for the trigger/reason.
  +
:{| |-
  +
! Feature !! Callback !! Animation triggers
  +
|-
  +
| Houses || 1B || none
  +
|-
  +
| Industry tiles || 25 || [[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|Property 11]]
  +
|-
  +
| Stations || 140 || [[Action0/Stations#Animation_triggers_.2818.29|Property 18]]
  +
|-
  +
| Airport tiles || 152 || [[Action0/Airport_Tiles#Animation_triggers_via_callback_153_.2811.29|Property 11]]
  +
|-
  +
| Objects || 159 || [[Action0/Objects#Animation_triggers_.2813.29|Property 13]]
  +
|}
   
* Unlike callback 1B, callbacks 25, 140 and 159 are always used when defined, no bit in the action 0 property needs to be set to activate them.
+
* Except for CB 1B (houses), the callbacks are always used when defined, no bit in the action 0 property needs to be set to activate them.
   
* {{ottdp| |2.5|ttdprev=beta 2}} Since TTDPatch 2.5 beta 2, this callback gets random bits in variable 10, to allow randomizing changes.
+
* {{ottdp| |2.5|ttdprev=beta 2}} Since TTDPatch 2.5 beta 2, these callbacks get random bits in variable 10, to allow randomizing changes.
   
* For callback 1B, the exact randomness depends on bit 2 of property 19 (synchronized callback 1B). If the callback is synchronized, the high 16 bits will be the same for all tiles and the low 16 bits will be different for each tile. Otherwise, all 32 bits will be independent for each tile.
+
* For callback 1B (houses), the exact randomness depends on bit 2 of [[Action0/Houses#Extra_Flags_.2819.29|property 19]] (synchronized callback 1B). If the callback is synchronized, the high 16 bits will be the same for all tiles and the low 16 bits will be different for each tile. Otherwise, all 32 bits will be independent for each tile.
   
* For [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]], the randomness depends on the type of the event. For triggers that happen for the whole industry (triggers 2, 3 and 4), the high 16 bits will be the same for all tiles, while the low 16 bits will be different. For other triggers, all 32 bits are independent.
+
* For CB 25 (industry tiles), the randomness depends on the type of the event. For triggers that happen for the whole industry (triggers 2, 3 and 4), the high 16 bits will be the same for all tiles, while the low 16 bits will be different. For other triggers, all 32 bits are independent.
   
* For [[Callbacks#Animation control (1B/25/140/152/159) |callback 140]], the high 16 bits are the same for all tiles triggered, while the low 16 bits are different for each tile.
+
* For CB 140 (stations), the high 16 bits are the same for all tiles triggered, while the low 16 bits are different for each 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.
 
* 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.

Revision as of 11:28, 18 March 2012

Animation control (1B/25/140/152/159)

Called periodically, in a time interval specified in property 16 (houses) or when an animation trigger happens (industry tiles, stations, airport tiles and objects). Returns the number of the frame the animation should jump to, or one of the following special values:

Value Meaning
FF stop animation in its current frame
FE start animation with its current frame
FD leave the animation in its current state (do nothing)
  • For multi-tile town buildings, property 19/bit 2 modifies this callback slightly, see details there.
  • Except for CB 1B (houses), the low byte of variable 18 contains the reason (animation trigger) for the call. The other bits may contain additional information specific for the trigger/reason.
Feature Callback Animation triggers
Houses 1B none
Industry tiles 25 Property 11
Stations 140 Property 18
Airport tiles 152 Property 11
Objects 159 Property 13
  • Except for CB 1B (houses), the callbacks are always used when defined, no bit in the action 0 property needs to be set to activate them.
  • Supported by OpenTTD Supported by TTDPatch 2.5 (beta 2)2.5 Since TTDPatch 2.5 beta 2, these callbacks get random bits in variable 10, to allow randomizing changes.
  • For callback 1B (houses), the exact randomness depends on bit 2 of property 19 (synchronized callback 1B). If the callback is synchronized, the high 16 bits will be the same for all tiles and the low 16 bits will be different for each tile. Otherwise, all 32 bits will be independent for each tile.
  • For CB 25 (industry tiles), the randomness depends on the type of the event. For triggers that happen for the whole industry (triggers 2, 3 and 4), the high 16 bits will be the same for all tiles, while the low 16 bits will be different. For other triggers, all 32 bits are independent.
  • For CB 140 (stations), the high 16 bits are the same for all tiles triggered, while the low 16 bits are different for each 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.