Difference between revisions of "Action0/Road Stops"
(Add initial property table) |
(Fix table for property 0C (draw mode)) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 17: | Line 17: | ||
|09||B||{{ottdp|14}}||Road stop type |
|09||B||{{ottdp|14}}||Road stop type |
||
|- |
|- |
||
− | |0A||W||{{ottdp|14}}|| |
+ | |0A||W||{{ottdp|14}}||Road stop name text ID |
|- |
|- |
||
− | |0B||W||{{ottdp|14}}|| |
+ | |0B||W||{{ottdp|14}}||Class name text ID |
|- |
|- |
||
|0C||B||{{ottdp|14}}||Draw mode |
|0C||B||{{ottdp|14}}||Draw mode |
||
Line 39: | Line 39: | ||
== Descriptions == |
== 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||{{ottdp|15}} Road waypoints |
||
+ | |} |
||
+ | |||
+ | {{ottdp|15}} Road stop classes which start with the byte FF are considered road waypoint classes, and will appear in the road waypoint construction window instead of the road bus/truck stop construction windows. |
||
+ | |||
+ | 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 |
||
+ | |- |
||
+ | |2||4||{{ottdp|15}} 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 [[Callbacks#Animation control (1B/25/140/152/159)|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 [[Callbacks#Next animation frame (1A/26/141/153/158)|callback 141]] for that. |
||
+ | |||
+ | === Animation speed (0F) === |
||
+ | The meaning is the same as for [[Action0Houses#Animation Speed 1B|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 [[Callbacks#Animation control (1B/25/140/152/159)|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 [[VariationalAction2|VarAction2]] for callbacks. |
||
+ | |||
+ | === General Flags (12) === |
||
+ | |||
+ | {| |- |
||
+ | !Bit!!Value!!Meaning |
||
+ | |- |
||
+ | |0||1||[[Callbacks#Next animation frame (1A/26/141/153/158)|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||{{ottdp|15}} 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 == |
== Examples == |
Latest revision as of 23:43, 9 July 2024
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 | ![]() ![]() |
Class label, see below |
09 | B | ![]() ![]() |
Road stop type |
0A | W | ![]() ![]() |
Road stop name text ID |
0B | W | ![]() ![]() |
Class name text ID |
0C | B | ![]() ![]() |
Draw mode |
0D | D | ![]() ![]() |
Random trigger cargoes |
0E | W | ![]() ![]() |
Animation information |
0F | B | ![]() ![]() |
Animation speed |
10 | W | ![]() ![]() |
Animation triggers |
11 | B | ![]() ![]() |
Callback flags, see below |
12 | D | ![]() ![]() |
General flags, see below |
15 | W | ![]() ![]() |
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 | ![]() ![]() |
15
Road stop classes which start with the byte FF are considered road waypoint classes, and will appear in the road waypoint construction window instead of the road bus/truck stop construction windows.
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 |
2 | 4 | ![]() ![]() |
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 | ![]() ![]() |
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.