Action0/Road Stops

From GRFSpecs
< Action0
Revision as of 18:57, 24 April 2024 by Jgr (talk | contribs) (Road waypoint updates)
Jump to navigationJump to search

Introduction

Defining properties of road stops.

Road stop IDs may be freely chosen. In action 0, you need only specify IDs relative to the set, i.e. the ID of the first road stop type is 00, the second road type is 01 and so on.


OpenTTD supports 64000 road stops per game, and 64000 road stop IDs per GRF file.

The property you must set for each road stop ID is 08 (in addition to defining an action 3 for it). Also, all road stop IDs must get their classes in the right order, starting from ID 00 onwards.

Properties

Number Size Version Description
08 D Supported by OpenTTD 1414 Not supported by TTDPatch Class label, see below
09 B Supported by OpenTTD 1414 Not supported by TTDPatch Road stop type
0A W Supported by OpenTTD 1414 Not supported by TTDPatch Road stop name text ID
0B W Supported by OpenTTD 1414 Not supported by TTDPatch Class name text ID
0C B Supported by OpenTTD 1414 Not supported by TTDPatch Draw mode
0D D Supported by OpenTTD 1414 Not supported by TTDPatch Random trigger cargoes
0E W Supported by OpenTTD 1414 Not supported by TTDPatch Animation information
0F B Supported by OpenTTD 1414 Not supported by TTDPatch Animation speed
10 W Supported by OpenTTD 1414 Not supported by TTDPatch Animation triggers
11 B Supported by OpenTTD 1414 Not supported by TTDPatch Callback flags, see below
12 D Supported by OpenTTD 1414 Not supported by TTDPatch General flags, see below
15 W Supported by OpenTTD 1414 Not supported by TTDPatch Cost multipiers, see below

Descriptions

Road stop class (08)

New road stops are grouped graphics into classes.

Only two classes are pre-defined:

Name Class ID Intended use for road stops
DFLT 44 46 4C 54 Default road stops
WAYP 57 41 59 50 Supported by OpenTTD 1515 Not supported by TTDPatchRoad waypoints

It is recommended that the class identifier used is unique to your GRF(s).

Road stop type (09)

Value Meaning
0 Passenger/bus stop
1 Freight/lorry stop
2 Both passenger/bus and freight/lorry stops

The default value is 2: Both passenger/bus and freight/lorry stops

Road stop name text ID (0A)

The text ID for this road stop (word value). This textid should be either a TTD textid or a D4xx textid (set via D0xx in action4).

Class name text ID (0B)

The text ID for the road stop class.

When specifying a road stop, you don't need to set a class name again if you already did for another one with the same class.

Draw mode (0C)

Bit Value Meaning
0 1 Bay stops: Draw road type ground sprite
1 2 Drive through stops: Draw road/tram type overlays
1 2 Supported by OpenTTD 1515 Not supported by TTDPatch Road waypoints: Draw the sprite layout ground tile (on top of the road)

The default value is 3 (bits 0 and 1 both set).

The remaining bits are reserved for future use.

Cargo types for random triggers (0D)

This sets which cargo types should trigger re-randomizing. The cargo types are given as a bitmask of the bits from column 3 (type B) in CargoTypes.  If nothing is set (the default), the no random triggers will happen, to conserve CPU time.

With GRF version 7 and above, the interpretation of bits changes. Instead of climate-dependent cargo slot numbers (type B), you have to set the bits of climate-independent cargo ID (type A).

Animation information (0E)

The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this station (this is the default value). Since you can't have properties for individual station tiles, this property applies for every tile of the station. If you don't want to animate some tiles, you should check the current position during callback 140 and return FD if the current tile doesn't need to be animated. If you also need animations of different length per tile, you'll have to use callback 141 for that.

Animation speed (0F)

The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.

Animation triggers (10)

This is a bit mask of events that should trigger callback 140, allowing to change the animation state

Callback flags (11)

For road stops, the following callbacks can be defined by setting the corresponding bit in property 0B:

Bit Value Variable 0C value Callback
0 1 13 Whether to make the road stop available in construction window (non-zero callback return) or not (callback returns zero)
1 2 141 Decide next animation frame
2 4 142 Decide animation speed

Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the VarAction2 for callbacks.

General Flags (12)

Bit Value Meaning
0 1 callback 141 needs random bits in var. 10
2 4 Do not show catenary graphics
3 8 Only allow drive-through stops (not bay stops)
4 10 Do not automatically build connecting road pieces
5 20 Only show in the road build menu (not tram)
6 40 Only show in the tram build menu (not road)
8 100 Supported by OpenTTD 1515 Not supported by TTDPatch Read the draw mode from register 0x100, overriding the default value in property 0C

The default value is 0 (no bits set).

The remaining bits are reserved for future use.

Cost multipiers (15)

The first byte is the build cost multiplier.

The second byte is the removal cost multiplier.

The total property length is 2 bytes.

A value of 16 produces a build or removal cost the same as non-NewGRF road stops.

Examples