ScenarioFiles:MapData

From TTWiki
Jump to navigationJump to search

The map data consists of a long series of 8-byte elements. They are separated into 147456 tiles (384 x 384), which represent each tile on the map. The last element for each tile has the first bit of the second byte set. Each tile must have at least one element.

Element format

Element format
Byte Bits Description
0 0..1 Unknown
0 2..5 Element type. 0 = Surface, 4 = Building, 5 = Tree, 6 = Fence/Wall, 7 = Road, 8 = Industry
0 6..7 Orientation.
1 0..0 Set only if this is the last element of the tile.
1 1..1 For multi-tile elements; Set if this is the first tile of the element.
1 2..3 Unknown
1 4..7 The bits indicate which quadrants of the tile this element occupies.
2 0..7 The base height of this element.
3 0..7 The construction height of this element. This is not relative to the base height.
4-7 * Depends on the element type.

Surfaces

Element type 0

Element format
Byte Bits Description
4 0..2 Unknown.
4 3..7 Slope. See below for a description.
5 0..2 Unknown.
5 3..7 Water level. This value is multiplied by 4. It is not relative to the base height.
6 0..2 Dirtiness index. field_3[0] says how many there are.
6 3..7 Terrain index. Which loaded terrain object to use.
7 0..? Unknown.
7 ?..7 Rough index. field_A[17] says how many there are.

See the variable list for more information.

Slope

Valid states of the slope bits

The lower 4 bits specify which corners to raise by one unit. If the highest bit is set, three of the four lowest bits will be set. This will raise the corner opposite of the zero by two units. The image to the right visualizes the valid states.


Buildings

Element type 4

Element format
Byte Bits Description
4 0..7 Unknown
5 0..7 Unknown
6 0..7 Unknown
7 0..7 Unknown

Trees

Element type 5

Element format
Byte Bits Description
4 0..7 Unknown
5 0..7 Unknown
6 0..7 Unknown
7 0..7 Unknown

Fences/Walls

Element type 6

Element format
Byte Bits Description
4 0..7 Unknown
5 0..7 Unknown
6 0..7 Unknown
7 0..7 Unknown

Roads

Element type 7

Element format
Byte Bits Description
4 0..0 If this road uses a bridge.
4 1..2 Unknown.
4 3..7 Track code. See below for a description of the values.
5 0..3 Road type index.
5 4..7 Sequence number, for multi-tile elements.
6 0..2 Bridge type index.
6 3..7 Unknown
7 0..7 Unknown

 

Track codes
Value Description
0 Flat staight.
1 Tight turn left.
2 Tight turn right.
3 Large turn left.
4 large turn right
5 Gentle slope up.
6 Gentle slope down.
7 Steep slope up.
8 Steep slope down.

Industries

Element type 8

Element format
Byte Bits Description
4 0..7 Unknown
5 0..7 Unknown
6 0..7 Unknown
7 0..7 Unknown