NML:List of tile slopes

From GRFSpecs
Jump to: navigation, search

Tiles in TTD can have various slopes. The slope is a bitmask that may contain the following bits:

bit flag meaning
CORNER_W west corner is above the lowest corner.
CORNER_S south corner is above the lowest corner.
CORNER_E east corner is above the lowest corner.
CORNER_N north corner is above the lowest corner.
IS_STEEP_SLOPE this tile is a steep slope (the corner opposite to the lowest corner is 2 units higher).

The resulting, possible values of this bitmask are given in the following table. The image below that illustrates them graphically. See also the builtin function num_corners_raised(slope).

Sprites for slopes are always in the same order in TTD. For example, GROUND_SPRITE_NORMAL is the sprite number of a flat grass tile. It is followed by 18 other sprites, that display a flat grass tile for each possible slope. The order of these sprites is given in the last column of the table. The builtin function slope_to_sprite_offset(slope) can be used to determine the sprite offset of a given slope.

Sprite Named constant Equivalent bitmask Numerical value Sprite offset
Sprite3981.png SLOPE_FLAT bitmask() 0 0
Sprite3982.png SLOPE_W bitmask(CORNER_W) 1 1
Sprite3983.png SLOPE_S bitmask(CORNER_S) 2 2
Sprite3985.png SLOPE_E bitmask(CORNER_E) 4 4
Sprite3989.png SLOPE_N bitmask(CORNER_N) 8 8
Sprite3990.png SLOPE_NW bitmask(CORNER_N, CORNER_W) 9 9
Sprite3984.png SLOPE_SW bitmask(CORNER_S, CORNER_W) 3 3
Sprite3987.png SLOPE_SE bitmask(CORNER_S, CORNER_E) 6 6
Sprite3993.png SLOPE_NE bitmask(CORNER_N, CORNER_E) 12 12
Sprite3986.png SLOPE_EW bitmask(CORNER_E, CORNER_W) 5 5
Sprite3991.png SLOPE_NS bitmask(CORNER_N, CORNER_S) 10 10
Sprite3992.png SLOPE_NWS bitmask(CORNER_N, CORNER_W, CORNER_S) 11 11
Sprite3988.png SLOPE_WSE bitmask(CORNER_W, CORNER_S, CORNER_E) 7 7
Sprite3995.png SLOPE_SEN bitmask(CORNER_S, CORNER_E, CORNER_N) 14 14
Sprite3994.png SLOPE_ENW bitmask(CORNER_E, CORNER_N, CORNER_W) 13 13
Sprite3998.png SLOPE_STEEP_W bitmask(CORNER_N, CORNER_W, CORNER_S, IS_STEEP_SLOPE) 27 17
Sprite3997.png SLOPE_STEEP_S bitmask(CORNER_W, CORNER_S, CORNER_E, IS_STEEP_SLOPE) 23 16
Sprite3999.png SLOPE_STEEP_E bitmask(CORNER_S, CORNER_E, CORNER_N, IS_STEEP_SLOPE) 30 18
Sprite3996.png SLOPE_STEEP_N bitmask(CORNER_E, CORNER_N, CORNER_W, IS_STEEP_SLOPE) 29 15

tile slopes