From GRFSpecs
Jump to: navigation, search


This is available from TTDPatch 2.6 alpha 0 r1247 onwards.

This type of VarAction2 requires the use of advanced calculations: VarAction2Advanced



Variable 10

Bit Meaning
0 Green
1-3 Front facing: 0=SW, 1=NE, 2=NW, 3=SE, 4=E, 5=W, 6=S, 7=N
4-5 Presignals: 0=norm, 1=entrance, 2=exit, 3=combo
6 Semaphore
8 Restricted
9 Programmed
10 Through
11 Inverted

Note: that these are the same bits as would be used to order action5 block type 4.

Variable 18

Bit Meaning
0-7 L5 of signal tile

  0: track in X

  1: track in Y

  2: track in N

  3: track in S

  4: track in W

  5: track in E

8-15 Low half of L3 of tile, bits 4-7 bitmask of which signals present as shown below, bits 0-3: track type
16-23 Which signal is currently being drawn, bit index of L3 signal mask:

  * For track in the X direction:

      6:  signal in the SW direction

      7:  signal in the NE direction

  * For track in the Y direction:

      6:  signal in the NW direction

      7:  signal in the SE direction

  * For tracks in the W-E direction:

      4:  signal in the W direction on the track in the S corner

      5:  signal in the E direction on the track in the S corner

      6:  signal in the W direction on the track in the N corner

      7:  signal in the E direction on the track in the N corner

  * For tracks in the N-S direction:

      4:  signal in the S direction on the track in the E corner

      5:  signal in the N direction on the track in the E corner

      6:  signal in the S direction on the track in the W corner

      7:  signal in the N direction on the track in the W corner

24-27 Land/Fence type
28-31 Terrain type: 0=normal, 1=desert, 2=rainforest, 4=snow

Parameterised var 60

Parameter is two signed nybble offsets to add to coordinates of tile.

The low nybble is added to the X coordinate (top-right to bottom-left).

The high nybble is added to the Y coordinate (top-left to bottom-right).

The information is retrieved from the tile after the coordinates have been adjusted, starting from the tile which is currently being drawn.

Bit Meaning
0-7 L5
8-15 L3 low
16-20 Altitude of tile<<3
21-25 Slope map of tile
26 Tile has same owner
27 Semaphores
28 Tile has same track bits
29 Tile has same slope and altitude
30 Tile has signals
31 Tile is a track tile

Return value cached in varaction2var 10


Callback return value

Bit Meaning
0 Use new sprites
1-4 Num sprites, varaction2vars 0x20-2F
5 Use recolour sprite specified in varaction2var 0x30
6 Use ordinary signal sprite number: varaction2var 0x20, (this overrides all other bits)

Varaction2var 20-2F value

Bit Meaning
0-12 Sprite offset into action5 block 0E.
13 Add sprite yrel to Y correction for next sprite (sub from 3D Z), (yrel must fit in a signed byte)
14-18 Sprite Y (-3D Z) correction for next sprite, (signed), (added to total)
Overall change to 3D Z, (-Y correction), must be positive, else risk of TTD crashing
19-23 Sprite Y (-3D Z) correction for this sprite only, (signed), (not added to total)
24-27 Sprite X correction for next sprite << 1, (signed), (added to total)
28-31 Sprite X correction for this sprite only << 1, (signed), (not added to total)


A generic action 3 feature 0E should be used to reference the action 2.

Callback 0x146 will call this action 3 when a signal is drawn.

Should the GRF not support the type of signal indicated in variable 10, an invalid callback result should be returned. Returning 0 will prevent further new signal GRF files from being queried and will cause the default signal graphics to be used. Returning 0 should only be done to explicitly prevent lower priority new signals GRFs from possibly drawing the signal.

The result to the callback should be returned as a calculation result.

Bits 1-4 of the callback result indicate how many varaction2vars starting from 0x20 will be used to specify sprites, to be drawn. Operator 0E should be used to store the appropriate values in vars 0x20-2F and 30 as appropriate.

Recolour sprites, specifed in varaction2var 0x30 and bit 5 of the callback result are applied for all of the sprites to be drawn.


GRF with NFO, PCX components.