Difference between revisions of "Action3/Roadtypes"

From GRFSpecs
Jump to navigationJump to search
(initial creation)
 
m (corrected the feature byte)
Line 9: Line 9:
 
The format of the data is feature-dependent. For roadtypes it looks like
 
The format of the data is feature-dependent. For roadtypes it looks like
   
<pre> &lt;Sprite-number&gt; * &lt;Length&gt; 03 10 &lt;n-id&gt; &lt;ids...&gt; &lt;num-cid&gt; &lt;cargo-type&gt; &lt;set-ID&gt;... &lt;default set-ID&gt;</pre>
+
<pre> &lt;Sprite-number&gt; * &lt;Length&gt; 03 12 &lt;n-id&gt; &lt;ids...&gt; &lt;num-cid&gt; &lt;cargo-type&gt; &lt;set-ID&gt;... &lt;default set-ID&gt;</pre>
   
 
{| class="wikitable"
 
{| class="wikitable"

Revision as of 12:03, 28 December 2019

Introduction

Action 3 assigns graphics sets (referenced to by (chains of) action 2(s) to feature IDs.

Supported by OpenTTD 1.101.10 Not supported by TTDPatch Roadtypes are available only in OpenTTD > 1.10

Format

The format of the data is feature-dependent. For roadtypes it looks like

 <Sprite-number> * <Length> 03 12 <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
12 B The feature byte for roadtypes
<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

Roadtypes 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 12 4 road directions, autoroad, depot, tunnel and convert road. First all icons, then all cursors.
01 Track overlays[1] 19 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.
02 Underlay[1] 19 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.
04 Catenary front 29 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps
05 Catenary back 29 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps
06 Bridge surfaces[1] 6 2 bridge middle, 4 bridge ramps
08 Depots 6 Follows the original layout for depot sprites. If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn. If present, the depot sprites are expected to include track overlay graphics.
0A? Road stops 4 Overlays for drive-in road stops
  1. 1.0 1.1 1.2 Either all or none of these sprites should be provided.

GUI sprites (00)

Nrt gui.png

Road underlay (02)

Nrt underlay.png

Catenary front (04)

Nrt catenary front.png

Catenary back (05)

Nrt catenary back.png

Depot sprites (08)

Nrt depot.png

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.

Bridge surfaces (06)

Nrt bridge.png

Road stops (0A?)

Nrt drivein.png

default set-ID

The default set-ID would be used for roadtype callbacks. However, since there are currently no callbacks for roadtypes it should always result in a callback-failure.

Example