VariationalAction2/Signals

From GRFSpecs

Jump to: navigation, search

Contents

Introduction

This is available from TTDPatch 2.6 alpha 0 r1247 onwards.

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

Variables

Description

Variable 10

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

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

Variable 18

BitMeaning
0-7L5 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-15Low half of L3 of tile, bits 4-7 bitmask of which signals present as shown below, bits 0-3: track type
16-23Which 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-27Land/Fence type
28-31Terrain 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.

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

Return value cached in varaction2var 10

Output

Callback return value

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

Varaction2var 20-2F value

BitMeaning
0-12Sprite offset into action5 block 0E.
13Add sprite yrel to Y correction for next sprite (sub from 3D Z), (yrel must fit in a signed byte)
14-18Sprite 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-23Sprite Y (-3D Z) correction for this sprite only, (signed), (not added to total)
24-27Sprite X correction for next sprite << 1, (signed), (added to total)
28-31Sprite 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.

Example

GRF with NFO, PCX components.

Personal tools
advertisement