Action3/Railtypes
Introduction
Action 3 assigns graphics sets (referenced to by (chains of) action 2(s) to feature IDs.
1.0 Railtypes are available only in OpenTTD > r19056
Format
The format of the data is feature-dependent. For railtypes it looks like
<Sprite-number> * <Length> 03 10 <n-id> <ids...> <num-cid> <cargo-type> <set-ID>... <default set-ID>
Element | Size | Description |
---|---|---|
<Sprite-number> | dec | A sequential sprite number |
<length> | dec | The total number of bytes used in this action |
03 | B | Defines action 03 |
10 | B | The feature byte for railtypes |
<n-id> | B | Number of IDs this action 3 associates graphics with |
<ids...> | B/B* | IDs of the current feature this action 3 associates graphics with. There must be as many IDs as <n-id> specifies |
<num-cid> | B | Number of different "cargo" types to support |
<cargo-type> | B | "Cargo" type for which to use the following set-ID |
<set-ID> | W | Set-ID (from action 2 or from a varaction2 chain) to use for this cargo type |
<default set-ID> | W | Default set-ID to use if none of the above matches |
Description
Sprite-number
This is just the number you are at.
Length
Count the number of bytes in this action.
n-id
How many items of the current feature this action 3 defines new graphics for. If this is more than one, all items listed will get the same graphics. If this value has bit 7 set (i.e. 80 added), it is a wagon override. See Action 3 - Livery Override for more info on this feature.
You can make a definition with n-id equal to zero (and thus no ids that follow). This creates a generic feature-specific definition not associated with any particular item. At the moment, this is used for generic callbacks, but might be extended to other functions eventually.
ids
Feature IDs to use this action 3 for. All IDs are counted from the first of their class, i.e. the first road vehicle has 00, as does the first plane, the first ship, and the first train vehicle.
num-cid
Number of "cargo" type definitions that follow.
cargo-type
Railtypes re-uses in its Action3 the 'cargo'-type definition in order to assign the type of graphics defined by the associated set-ID:
'Cargo' Type | Sprite Type | #Sprites | Useage |
---|---|---|---|
00 | Icons and cursors | 16 | 4 rail directions, autorail, depot, tunnel and convert rail. First all icons, then all cursors. |
01 | Track overlays for junctions and PBS[1] | 10 | 6 flat and 4 slope pieces. Sprites should contain only the track, with no landscape. |
02 | Underlay[1] | 16 | 6 flat and 4 slope, and 1 X crossing pieces with track, and 5 junction pieces without track. Sprites should contain the track and the 'ballast' below it. No landscape should be drawn. |
03 | Tunnel[1] | 4 | 1 sprite for each direction. Sprite is overlay for track in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a train and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE. |
04 | Catenary wire | 28 | Follows the same layout for wires of the first 28 sprites as Action5 type 5. |
05 | Catenary pylons | 8 | Follows the same layout for pylons of the 8 sprites after the wires as Action5 type 5. |
06 | Bridge surfaces[1] | 6 | 10 sprites if we ever include diagonal bridges. |
07 | Level crossing overlay[1] | 10 | 1 rail overlay and 4 light sprites for X and Y. |
08 | Depots[2] | 6 | 2 sprites for each southish, 1 sprite for each northish. Follows the original layout for depot sprites. |
09 | Fences | 8 | X, Y, Vertical, Horizontal, SW slope, SE slope, NE slope and NW slope. Follows the same layout as original original fence sprites at sprite 1301. |
GUI sprites (00)
Rail overlay (01)
Rail underlay (02)
Level crossing sprites (07)
You can define a special track piece which crosses the road and for each of two directions and each of the corners of the tile a separate sprite for a light, sign, or whatever should go there.
Sprite number for X | Sprite number for Y | Useage |
---|---|---|
0 | 1 | Rail overlay |
2 | 3 | North light |
4 | 5 | East light |
6 | 7 | West light |
8 | 9 | South light |
Depot sprites (08)
Sprite Number | Usage |
---|---|
0 | NE wall for SE-entry depot. |
1 | Depot building for SE-entry depot. |
2 | NW wall for SW-entry depot. |
3 | Depot building for SW-entry depot. |
4 | Depot building for NE-entry depot. |
5 | Depot building for NW-entry depot. |
Fences (09)
default set-ID
The default set-ID has no meaning for railtypes and is therefore ignored.