Track Sections (Track File Format)
A track section describes the length and curvature of a part of the track. Track sections can be thought of as sections of a Scalextric track.
The track section attributes are 10 bytes long.
Each track section can have a number of related track commands defined. See below.
Field | Type | Description |
---|---|---|
Section Length | ushort | Length of section in units of 16 feet (approx 4.87m) |
Curvature | short | Angle value as a signed integer, see Corner Geometry |
Height | short | Height gradient along the section |
Flags | short | Various flags, see Track Section Flags below |
Right verge width | byte | Width of right verge at the end of the section (and start of the next section) |
Left verge width | byte | Width of left verge at the end of the section (and start of the next section) |
The list of Track section definitions ends with 0xFF FF.
Track Section Flags
Bit | Description | Comment | Hex |
---|---|---|---|
0 | Pitlane entrance | Used on all pit lane sections that have garages? | 0x1 |
1 | Pitlane exit | Used on all pit lane sections that have garages? | 0x2 |
2 | Kerb height selector | Set for low kerbs, not set for high kerbs | 0x4 |
3 | Road signs (300/200/100) | 0x8 | |
4 | Join the right-side fence from the starting point of the section with the starting point of the next non-bridged section. | 0x10 | |
5 | Join the left-side fence from the starting point of the section with the starting point of the next non-bridged section. | 0x20 | |
6 | Road sign (arrow) | 0x40 | |
7 | Road signs (arrow/100) | 0x80 | |
8 | Unknown 1 | Never used in default tracks | 0x100 |
9 | Unknown 2 | Never used in default tracks | 0x200 |
10 | Right Kerb | Section has kerb on the right side of the track | 0x400 |
11 | Left Kerb | Section has kerb on the left side of the track | 0x800 |
12 | Remove Right Wall | Hides the right wall, can still be hit | 0x1000 |
13 | Remove Left Wall | Hides the left wall, can still be hit | 0x2000 |
14 | Unknown 3 | 0x4000 | |
15 | Unknown 4 | Never used in default tracks | 0x8000 |
Road sign flags can be combined in various ways, e.g. by setting both bit 3 and 6, the signs will appear on track as 300/Arrow/100.
Track Section Commands
Commands are used to perform various modifications to the section it is related to, or to the entire track.
Each track section can have a number of related track commands defined. Note that commands are defined before the section that they belong to.
Each command can have between 1 and 6 arguments, though for some commands, the first argument has no purpose and is always zero. There is no value that indicates that the list of arguments has finished, you have to know how many arguments each command has.
The first argument is only a byte long, because it is “paired” in a short with the command type. The remaining arguments are short values.
As an example, the 0xAC track command, which defines the color of the grass or tarmac, may look like this:
0x00 0xAC 0x1A 0x00 0x20 0x00 0x20 0x00 0x1D 0x00
0xAC
is the command, and 0x00
is the first argument, which is not used in this command.
After that come the remaining four arguments. The first (0x1A 0x00) indicates whether we are changing the color
of the grass or the tarmac. 0x1A
means the tarmac, both for the track and the surrounding area, since
Phoenix is a street circuit without grass. The remaining three commands specify the RGB values (0 to 63).
In comparison, an instance of the 0x80 track command, which places an object along the track, may look like this:
0x13 0x80 0x20 0x01
Here, 0x80
is the command, and 0x13
is the first argument, which here indicates how far along the
track section the object should be placed. 0x20 0x01
is 288, which is a reference to the
object setting that is used.