OTTD code, might be different in TTDP.
The layout format is as follows:
Code: Select all
09 // this is property 09
<numLayouts> // the number of layouts, should be even and at least two (one for each orientation)
// layout 1
<groundsprite> // sprite used for ground, will be shown in transparent mode
<overlaysprite> // sprite drawn over ground (and maybe other overlay sprites)
[<overlaysprite>] // optional extra overlay sprite(s). Only define if needed.
80 // end layout definition
// layout 2
<groundsprite>
<overlaysprite>
[<overlaysprite>]
80 // end layout definition
The game will automatically change the ground sprite depending on which rail type is being used in order to draw the correct rail sprite for each rail type. However, this happens for any sprite, that is any sprite in the base set or any Action 1 sprite. The rail sprite is number 1012 (decimal) in the / orientation (odd layouts) and 1011 in the \ orientation (even layouts). If this number is used for the ground sprite and a normal or electrified station is built, the game will draw sprite 1012/1011. However, if a monorail or maglev station is built, the game draws sprite 1094/1093 or 1174/1175 respectively. However, if you want the flat grass tile to be drawn, you will get a brown tile for monorail and a coast tile for maglev. This is useful if you actually want the correct rail sprite for all rail types, but not useful if you want something else. For that reason I recommend drawing the base set rail sprite for all layouts and drawing an Action 1 "ground sprite" as an overlay sprite if you want a separate sprite to look like it is the ground sprite. Of course, it will only look right if the overlay sprite covers the whole tile.
To work out which base set sprite will be drawn for monorail, add 82 to it. For maglev, add 164. Action 1 sprites do something similar. Not sure if the numbers are the same.
The overlay sprite works in a similar way, however the game does not change sprites depending on rail type if an Action 1 sprite is drawn. It still does for a base set sprite. Note that the spritenumber does not need bit 31 set if it is an Action 1 sprite, but it must still start at 0x42D. Base set sprites can be used by setting bit 31 and using the sprite number from the base set. Setting bit 15 allows company colour 1 to be used. No 2CC yet. If you really want to use a base set sprite, such as the flat grass one, and want it to be the same for all rail types, you can use more layouts and callbacks. Which is fun.
An overlay sprite is made up of either of the following:
Code: Select all
// sprite with its own bounding box
<xofs> <yofs> <zofs> // x,y,z offsets from northern corner
<xextent> <yextent> <zextent> // x,y,z sizes
<spritenumber> // sprite to draw, see above
OR
// sprite sharing bounding box of previous sprite
<xofs> <yofs> 80 // x,y offsets from northern corner
00 00 00 // ignored
<spritenumber> // sprite to draw, see above
Some real code (uses escapes). First draw a rail ground sprite, then an Action 1 sprite (some tiles) with the same bounding box as the ground sprite, then another Action 1 sprite (flowerbed) with its own bounding box.
Code: Select all
729 * 57 00 04 01 01 65
09 \b2
\dx000003F4
00 00 80 00 00 00 \dx0000042D
00 00 00 0F 0F 11 \dx0000042E 80
\dx000003F3
00 00 80 00 00 00 \dx0000042D
00 00 00 0F 0F 11 \dx0000042E 80
-D