Difference between revisions of "Action0/Bridges"
m (13 revisions) |
Planetmaker (talk | contribs) (fix tables and stuff lost in conversion) |
||
Line 1: | Line 1: | ||
+ | ==Introduction== |
||
− | |||
− | '''''Defining properties of bridges''''' |
||
− | |||
− | =Action 0 - Properties for bridges= |
||
Defining properties of bridges |
Defining properties of bridges |
||
+ | ==Properties== |
||
− | -=ID Allocation=- |
||
− | |||
− | ''Since TTDPatch 2.6 alpha 0 rUnknown it's possible to use more than the default TTD bridges. All ids starting with 0x0D are id allocated and property 0x00 has to be set, otherwise the bridge will be ignored. As these bridges have no old type, all properties have to be set.'' Not yet available; it is currently not possible to use ids 0x0D and up. |
||
− | |||
− | -=Properties=- |
||
− | |||
− | ||Number|Version|Size|Description |
||
− | |||
− | 00|(d)|B|Failback Type, a default TTD Bridge ID |
||
− | |||
− | 01|(d)|-|-reserved- |
||
− | |||
− | 08*|(a)|B|Year of availability, counted from 1920 (set to 1920 for first bridge if newstartyear<1930) |
||
− | |||
− | 09|(a)|B|Minimum length, not counting ramps |
||
− | |||
− | 0A|(a)|B|Maximum length, not counting ramps |
||
− | |||
− | 0B|(a)|B|Cost factor |
||
− | |||
− | 0C|(a)|W|Max. speed |
||
− | |||
− | 0D|(a)|V|Sprite layout, see below |
||
− | |||
− | 0E|(a)|B|Various flags, bitcoded |
||
− | |||
− | 0F|(b)|D|Long format year of availability, counted from year 0 |
||
− | |||
− | 10|(c)|W|Purchase text |
||
− | |||
− | 11|(c)|W|Description of a rail bridge |
||
− | |||
− | 12|(c)|W|Description of a road bridge| |
||
+ | {| |- |
||
− | 13|(d)|W|cost factor word access|| |
||
+ | !Number!!Version!!Size!!Description |
||
+ | |- |
||
+ | |00||(d)||B||Failback Type, a default TTD Bridge ID |
||
+ | |- |
||
+ | |01||(d)||-||-reserved- |
||
+ | |- |
||
+ | |08*||(a)||B||Year of availability, counted from 1920 (set to 1920 for first bridge if newstartyear<1930) |
||
+ | |- |
||
+ | |09||(a)||B||Minimum length, not counting ramps |
||
+ | |- |
||
+ | |0A||(a)||B||Maximum length, not counting ramps |
||
+ | |- |
||
+ | |0B||(a)||B||Cost factor |
||
+ | |- |
||
+ | |0C||(a)||W||Max. speed |
||
+ | |- |
||
+ | |0D||(a)||V||Sprite layout, see below |
||
+ | |- |
||
+ | |0E||(a)||B||Various flags, bitcoded |
||
+ | |- |
||
+ | |0F||(b)||D||Long format year of availability, counted from year 0 |
||
+ | |- |
||
+ | |10||(c)||W||Purchase text |
||
+ | |- |
||
+ | |11||(c)||W||Description of a rail bridge |
||
+ | |- |
||
+ | |12||(c)||W||Description of a road bridge |
||
+ | |} |
||
− | + | <nowiki>*</nowiki> The meaning of prop. 08 has changed in alpha 34, it used to be what is now prop. 0D. |
|
(a) Available since TTDPatch 2.0.1 alpha 34 |
(a) Available since TTDPatch 2.0.1 alpha 34 |
||
Line 50: | Line 43: | ||
(c) 2.5 r1824, OpenTTD r10269 |
(c) 2.5 r1824, OpenTTD r10269 |
||
+ | ==Descriptions== |
||
− | (d) rUnknown, OpenTTD rUnknown, planned feature for id allocation |
||
+ | ===Sprite layout (0D)=== |
||
− | -=Comments=- |
||
+ | Property 0D sets the sprite layout for bridges. Each part of a bridge has eight sprites for each of the four types (rail, road, monorail, maglev), making 32 sprites in total. Each bridge has 7 parts, though not all of them have different graphics. |
||
− | ==Sprite layout (0D)== |
||
− | |||
− | Property 0D sets the sprite layout for bridges. Each part of a bridge has eight sprites for each of the four types (rail, road, monorail, maglev), making 32 sprites in total. Each bridge has 7 parts, though not all of them have different graphics. |
||
The data for property 0D is variable sized, with the format being |
The data for property 0D is variable sized, with the format being |
||
+ | {| |- |
||
− | ||Size|Field|Description |
||
+ | !Size!!Field!!Description |
||
− | |||
+ | |- |
||
− | B|tableid|First table to define sprites for |
||
+ | |B||tableid||First table to define sprites for |
||
− | |||
+ | |- |
||
− | B|numtables|Number of tables to define sprites for |
||
+ | |B||numtables||Number of tables to define sprites for |
||
− | |||
+ | |- |
||
− | V|spritedata|spritedata, numtables*32 DWORDs with sprite numbers|| |
||
+ | |V||spritedata||spritedata, numtables*32 DWORDs with sprite numbers |
||
+ | |} |
||
− | The tableid is the number of the first table to change. |
+ | The tableid is the number of the first table to change. There are seven tables for each bridge, with the first six (0-5) being various middle parts and the last one (6) being the end pieces. |
In each of the six middle part tables, there are four entries each for the following: |
In each of the six middle part tables, there are four entries each for the following: |
||
Line 76: | Line 69: | ||
The four entries are |
The four entries are |
||
− | * Back& |
+ | * Back & Floor, Front, Pillars, 0 |
− | Front and Pillars can be 0, meaning no sprite to draw. |
+ | Front and Pillars can be 0, meaning no sprite to draw. The fourth entry is always ignored. |
− | In the end part table, there are again four entries each, but now for |
+ | In the end part table, there are again four entries each, but now for Rail flat, Rail ramp, Road flat, Road ramp, Monorail flat, Monorail ramp and Maglev flat, Maglev ramp. |
The four entries in this case are |
The four entries in this case are |
||
Line 87: | Line 80: | ||
The sprite numbers can be any of TTD's sprite numbers. |
The sprite numbers can be any of TTD's sprite numbers. |
||
− | To summarize, there are 7 tables for each of the 11 bridges. |
+ | To summarize, there are 7 tables for each of the 11 bridges. Each table contains 4*8 entries, making it 128 (80h) bytes large. The first six tables, number 0 to 5, are middle pieces, the last table, number 6, is the end pieces. |
− | ===Colour Translations=== |
+ | ====Colour Translations==== |
− | In order to recolour a bridge, you can add one of the values from the table below to the sprite number of the sprite you wish to recolour. The colour translations from the table will use the default colour translation tables from |
+ | In order to recolour a bridge, you can add one of the values from the table below to the sprite number of the sprite you wish to recolour. The colour translations from the table will use the default colour translation tables from the base sets. These translation tables will translate the 'brownish red' as used in the default bridges to the colour you specify. |
+ | {| |- |
||
− | ||'''Added value'''|'''Little Endian'''|'''Colour''' |
||
+ | !'''Added value'''!!'''Little Endian'''!!'''Colour''' |
||
+ | |- |
||
+ | |031B8000h||00 80 1B 03||Blue |
||
+ | |- |
||
+ | |031C8000h||00 80 1C 03||Brown |
||
+ | |- |
||
+ | |031D8000h||00 80 1D 03||Pure white |
||
+ | |- |
||
+ | |031E8000h||00 80 1E 03||Red |
||
+ | |- |
||
+ | |031F8000h||00 80 1F 03||Green |
||
+ | |- |
||
+ | |03208000h||00 80 20 03||Blueish white (concrete) |
||
+ | |- |
||
+ | |03218000h||00 80 21 03||Yellow (golden steel) |
||
+ | |- |
||
+ | |03238000h||00 80 23 03||Grey |
||
+ | |} |
||
− | 031B8000h|00 80 1B 03|Blue |
||
− | |||
− | 031C8000h|00 80 1C 03|Brown |
||
− | |||
− | 031D8000h|00 80 1D 03|Pure white |
||
− | |||
− | 031E8000h|00 80 1E 03|Red |
||
− | |||
− | 031F8000h|00 80 1F 03|Green |
||
− | |||
− | 03208000h|00 80 20 03|Blueish white (concrete) |
||
− | |||
− | 03218000h|00 80 21 03|Yellow (golden steel) |
||
− | |||
− | 03238000h|00 80 23 03|Grey|| |
||
− | |||
− | '''''Example''': Translate sprite 4366 to grey:'' |
||
4366 translates to 0E 11 in little endian value and as such to 0E 11 00 00 in a dword. In order to convert to grey you'll have to add 00 80 23 03 to the dword value. This yields 0E 91 23 03. Use the latter in your bridge table to colour one of the monorail bridgeheads grey. |
4366 translates to 0E 11 in little endian value and as such to 0E 11 00 00 in a dword. In order to convert to grey you'll have to add 00 80 23 03 to the dword value. This yields 0E 91 23 03. Use the latter in your bridge table to colour one of the monorail bridgeheads grey. |
||
− | '''''Advanced Technique''' You can also use the company colour blue to draw your bridges and use the default colour translation tables to recolour your bridge in any of the player colours. See the Action2HousesIndustryTiles page for information on the location of the colour translation tables.'' |
||
− | ===Bridge Layouts=== |
+ | ====Bridge Layouts==== |
There are five possible bridge layouts in TTD. The numbers in the table below reflect the bridge table numbers in the NFO code. |
There are five possible bridge layouts in TTD. The numbers in the table below reflect the bridge table numbers in the NFO code. |
||
+ | {| |- |
||
− | ||'''Layout'''|'''Description''' |
||
+ | !'''Layout'''!!'''Description''' |
||
− | |||
+ | |- |
||
− | --|Bridge without middle part |
||
+ | |--||Bridge without middle part |
||
− | |||
+ | |- |
||
− | -0-|Bridge of length 3 |
||
+ | |-0-||Bridge of length 3 |
||
− | |||
+ | |- |
||
− | -0(23)1-|Bridge of even length |
||
+ | |-0(23)1-||Bridge of even length |
||
− | |||
+ | |- |
||
− | -0(23)4(23)1-|Bridge of (uneven) lengths 5, 9, 13, 17 etc. |
||
+ | |-0(23)4(23)1-||Bridge of (uneven) lengths 5, 9, 13, 17 etc. |
||
− | |||
+ | |- |
||
− | -0(23)253(23)1-|Bridge of (uneven) lengths 7, 11, 15, 19 etc.|| |
||
+ | |-0(23)253(23)1-||Bridge of (uneven) lengths 7, 11, 15, 19 etc. |
||
+ | |} |
||
- is used as a symbol to indicate bridgeheads (as defined in table 6). |
- is used as a symbol to indicate bridgeheads (as defined in table 6). |
||
Line 139: | Line 134: | ||
Parts (23) are repeated ''n'' times as necessary, where ''n'' is any number equal or greater than 0. |
Parts (23) are repeated ''n'' times as necessary, where ''n'' is any number equal or greater than 0. |
||
− | ==Flags (0E)== |
+ | ===Flags (0E)=== |
The following flags can be set here: |
The following flags can be set here: |
||
+ | {| |- |
||
− | ||'''Bit'''|'''Value'''|'''Meaning''' |
||
+ | !'''Bit'''!!'''Value'''!!'''Meaning''' |
||
+ | |- |
||
+ | |0||1||Do not draw the far pillars for higher bridges |
||
+ | |} |
||
+ | ===Long format year of availability (0F)=== |
||
− | 0|1|Do not draw the far pillars for higher bridges|| |
||
− | |||
− | ==Long format year of availability (0F)== |
||
Set the year of availability of the bridge in years since 0. The date range is from 0 to 5000000. This property must be set after property 08 to take effect. In TTDPatch, bridge introduction dates outside the range 1920..2175 will be limited to this range. |
Set the year of availability of the bridge in years since 0. The date range is from 0 to 5000000. This property must be set after property 08 to take effect. In TTDPatch, bridge introduction dates outside the range 1920..2175 will be limited to this range. |
||
− | ==Purchase text (10)== |
+ | ===Purchase text (10)=== |
Set the text appearing in the purchase window, describing what this bridge is made of, or what kind of bridge it is. |
Set the text appearing in the purchase window, describing what this bridge is made of, or what kind of bridge it is. |
||
− | ==Description of a rail(11) or road(12) bridge== |
+ | ===Description of a rail(11) or road(12) bridge=== |
− | Set the text used as a description by the query tool. |
+ | Set the text used as a description by the query tool. When the bridge is used for carrying a rail, it will use property 11, and will use property 12 when it will be for road. |
*Note that, as for property 10, the textID can be either a TTD ID or a TextID in the DCxx range. |
*Note that, as for property 10, the textID can be either a TTD ID or a TextID in the DCxx range. |
||
− | ==Bridge IDs== |
+ | ===Bridge IDs=== |
+ | {| |- |
||
− | ||'''ID (dec)'''|'''ID (hex)'''|'''Description''' |
||
+ | !'''ID (dec)'''!!'''ID (hex)'''!!'''Description''' |
||
+ | |- |
||
+ | |0||00||Wooden Bridge |
||
+ | |- |
||
+ | |1||01||Concrete Bridge |
||
+ | |- |
||
+ | |2||02||Girder, Steel Bridge |
||
+ | |- |
||
+ | |3||03||Suspension, Concrete Bridge |
||
+ | |- |
||
+ | |4||04||Suspension, Steel (Bronze) Bridge |
||
+ | |- |
||
+ | |5||05||Suspension, Steel (Golden) Bridge |
||
+ | |- |
||
+ | |6||06||Cantilever, Steel (Bronze) Bridge |
||
+ | |- |
||
+ | |7||07||Cantilever, Steel (Brown) Bridge |
||
+ | |- |
||
+ | |8||08||Cantilever, Steel (Red) Bridg |
||
+ | |- |
||
+ | |9||09||Girder, Steel Bridge |
||
+ | |- |
||
+ | |10||0A||Tubular, Steel (Bronze) Bridge |
||
+ | |- |
||
+ | |11||0B||'''(OpenTTD Only)''' Tubular, Steel (Golden) Bridge |
||
+ | |- |
||
+ | |12||0C||'''(OpenTTD Only)''' Tubular, Silicon Bridge |
||
+ | |} |
||
+ | ==Example== |
||
− | 0|00|Wooden Bridge |
||
+ | Below is an example code which rebuilds the bronze steel suspension bridge (ID 04). The code fragment by itself has no use (no visual difference in game), but might be useful in order to understand the bridge code. Sprite numbers refer to the numbers in the base grf. The code might also be useful to re-enstate the default bridge if you only want to replace only one certain tracktype. |
||
− | 1|01|Concrete Bridge |
||
+ | The complete recode of all default bridges including colour translations is available at TT-Forums: http://www.tt-forums.net/viewtopic.php?p=715362#p715362 |
||
− | 2|02|Girder, Steel Bridge |
||
− | |||
− | 3|03|Suspension, Concrete Bridge |
||
− | |||
− | 4|04|Suspension, Steel (Bronze) Bridge |
||
− | |||
− | 5|05|Suspension, Steel (Golden) Bridge |
||
− | |||
− | 6|06|Cantilever, Steel (Bronze) Bridge |
||
− | |||
− | 7|07|Cantilever, Steel (Brown) Bridge |
||
− | |||
− | 8|08|Cantilever, Steel (Red) Bridg |
||
− | |||
− | 9|09|Girder, Steel Bridge |
||
− | |||
− | 10|0A|Tubular, Steel (Bronze) Bridge |
||
− | |||
− | 11|0B|'''(OpenTTD Only)''' Tubular, Steel (Golden) Bridge |
||
− | |||
− | 12|0C|'''(OpenTTD Only)''' Tubular, Silicon Bridge|| |
||
− | |||
− | -=Example=- |
||
− | |||
− | Below is an example code which rebuilds the bronze steel suspension bridge (ID 04). The code fragment by itself has no use (no visual difference in game), but might be useful in order to understand the bridge code. Sprite numbers refer to the numbers in trg1(r).grf. The code might also be useful to re-enstate the default bridge if you only want to replace only one certain tracktype. |
||
− | |||
− | The complete recode of all default bridges including colour translations is available at TT-Forums: <nowiki>http://www.tt-forums.net/viewtopic.php?p=715362#p715362 |
||
− | |||
− | </nowiki> |
||
<pre>//SUSPENSION, STEEL (BRONZE) bridge (04) |
<pre>//SUSPENSION, STEEL (BRONZE) bridge (04) |
||
− | -1 * 0 00 06 01 01 04 0D 00 |
+ | -1 * 0 00 06 01 01 04 0D 00 02 //action 00 bridges, 01 property, 01 ID, ID, prop 0D, tableID 00, 07 tables |
//table 00 |
//table 00 |
||
− | A9 09 00 00 |
+ | A9 09 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 |
+ | A5 09 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 9D 09 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 |
|
+ | 95 09 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | F2 10 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
|
+ | EE 10 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 1A 11 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
|
+ | 16 11 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | F2 10 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | EE 10 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 1A 11 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 16 11 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
//table 01 |
//table 01 |
||
+ | AA 09 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | A6 09 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 |
|
+ | 9E 09 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 96 09 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 |
|
+ | F3 10 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | EF 10 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
|
+ | 1B 11 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 17 11 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
|
− | |||
− | F3 10 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | EF 10 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 1B 11 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 17 11 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
//table 02 |
//table 02 |
||
+ | AC 09 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | A8 09 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 |
|
+ | A2 09 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 9A 09 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 |
|
+ | F5 10 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | F1 10 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
|
+ | 1D 11 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 19 11 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
|
− | |||
− | F5 10 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | F1 10 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 1D 11 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 19 11 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
//table 03 |
//table 03 |
||
+ | AB 09 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | A7 09 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 |
|
+ | A1 09 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 99 09 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 |
|
+ | F4 10 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | F0 10 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
|
+ | 1C 11 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 18 11 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
|
− | |||
− | F4 10 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | F0 10 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 1C 11 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 18 11 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
//table 04 |
//table 04 |
||
+ | B6 09 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | B5 09 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 |
|
+ | B8 09 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | B7 09 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 |
|
+ | F7 10 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | F6 10 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
|
+ | 1F 11 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 1E 11 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
|
− | |||
− | F7 10 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | F6 10 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 1F 11 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 1E 11 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
//table 05 |
//table 05 |
||
+ | BD 09 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | BE 09 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 |
|
+ | BF 09 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | C0 09 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 |
|
+ | F8 10 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | F9 10 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
|
+ | 20 11 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | + | 21 11 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
|
− | |||
− | F8 10 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | F9 10 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 20 11 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 |
||
− | |||
− | 21 11 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 |
||
− | |||
//table 06 |
//table 06 |
||
+ | 86 09 00 00 88 09 00 00 85 09 00 00 87 09 00 00 //rail flat: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | + | 8A 09 00 00 8C 09 00 00 89 09 00 00 8B 09 00 00 //rail ramp: northern end X, northern end Y, southern end X, southern end Y |
|
+ | 8E 09 00 00 90 09 00 00 8D 09 00 00 8F 09 00 00 //road flat: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | + | 92 09 00 00 94 09 00 00 91 09 00 00 93 09 00 00 //road ramp: northern end X, northern end Y, southern end X, southern end Y |
|
+ | E7 10 00 00 E9 10 00 00 E6 10 00 00 E8 10 00 00 //mono flat: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | + | EB 10 00 00 ED 10 00 00 EA 10 00 00 EC 10 00 00 //mono ramp: northern end X, northern end Y, southern end X, southern end Y |
|
+ | 0F 11 00 00 11 11 00 00 0E 11 00 00 10 11 00 00 //mlev flat: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | 92 09 00 00 94 09 00 00 91 09 00 00 93 09 00 00 //road ramp: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | E7 10 00 00 E9 10 00 00 E6 10 00 00 E8 10 00 00 //mono flat: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | EB 10 00 00 ED 10 00 00 EA 10 00 00 EC 10 00 00 //mono ramp: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | 0F 11 00 00 11 11 00 00 0E 11 00 00 10 11 00 00 //mlev flat: northern end X, northern end Y, southern end X, southern end Y |
||
− | |||
− | 13 11 00 00 15 11 00 00 12 11 00 00 14 11 00 00 //mlev ramp: northern end X, northern end Y, southern end X, southern end Y</pre> |
Revision as of 21:47, 13 June 2011
Introduction
Defining properties of bridges
Properties
Number | Version | Size | Description |
---|---|---|---|
00 | (d) | B | Failback Type, a default TTD Bridge ID |
01 | (d) | - | -reserved- |
08* | (a) | B | Year of availability, counted from 1920 (set to 1920 for first bridge if newstartyear<1930) |
09 | (a) | B | Minimum length, not counting ramps |
0A | (a) | B | Maximum length, not counting ramps |
0B | (a) | B | Cost factor |
0C | (a) | W | Max. speed |
0D | (a) | V | Sprite layout, see below |
0E | (a) | B | Various flags, bitcoded |
0F | (b) | D | Long format year of availability, counted from year 0 |
10 | (c) | W | Purchase text |
11 | (c) | W | Description of a rail bridge |
12 | (c) | W | Description of a road bridge |
* The meaning of prop. 08 has changed in alpha 34, it used to be what is now prop. 0D.
(a) Available since TTDPatch 2.0.1 alpha 34
(b) 2.5 r1702, OpenTTD r7191
(c) 2.5 r1824, OpenTTD r10269
Descriptions
Sprite layout (0D)
Property 0D sets the sprite layout for bridges. Each part of a bridge has eight sprites for each of the four types (rail, road, monorail, maglev), making 32 sprites in total. Each bridge has 7 parts, though not all of them have different graphics.
The data for property 0D is variable sized, with the format being
Size | Field | Description |
---|---|---|
B | tableid | First table to define sprites for |
B | numtables | Number of tables to define sprites for |
V | spritedata | spritedata, numtables*32 DWORDs with sprite numbers |
The tableid is the number of the first table to change. There are seven tables for each bridge, with the first six (0-5) being various middle parts and the last one (6) being the end pieces.
In each of the six middle part tables, there are four entries each for the following:
- Rail X, Rail Y, Road X, Road Y, Monorail X, Monorail Y, Maglev X, Maglev Y
Where X is a bridge in /-direction and Y a bridge in \-direction.
The four entries are
- Back & Floor, Front, Pillars, 0
Front and Pillars can be 0, meaning no sprite to draw. The fourth entry is always ignored.
In the end part table, there are again four entries each, but now for Rail flat, Rail ramp, Road flat, Road ramp, Monorail flat, Monorail ramp and Maglev flat, Maglev ramp.
The four entries in this case are
- northern end X, northern end Y, southern end X, southern end Y
The sprite numbers can be any of TTD's sprite numbers.
To summarize, there are 7 tables for each of the 11 bridges. Each table contains 4*8 entries, making it 128 (80h) bytes large. The first six tables, number 0 to 5, are middle pieces, the last table, number 6, is the end pieces.
Colour Translations
In order to recolour a bridge, you can add one of the values from the table below to the sprite number of the sprite you wish to recolour. The colour translations from the table will use the default colour translation tables from the base sets. These translation tables will translate the 'brownish red' as used in the default bridges to the colour you specify.
Added value | Little Endian | Colour |
---|---|---|
031B8000h | 00 80 1B 03 | Blue |
031C8000h | 00 80 1C 03 | Brown |
031D8000h | 00 80 1D 03 | Pure white |
031E8000h | 00 80 1E 03 | Red |
031F8000h | 00 80 1F 03 | Green |
03208000h | 00 80 20 03 | Blueish white (concrete) |
03218000h | 00 80 21 03 | Yellow (golden steel) |
03238000h | 00 80 23 03 | Grey |
4366 translates to 0E 11 in little endian value and as such to 0E 11 00 00 in a dword. In order to convert to grey you'll have to add 00 80 23 03 to the dword value. This yields 0E 91 23 03. Use the latter in your bridge table to colour one of the monorail bridgeheads grey.
Bridge Layouts
There are five possible bridge layouts in TTD. The numbers in the table below reflect the bridge table numbers in the NFO code.
Layout | Description |
---|
- is used as a symbol to indicate bridgeheads (as defined in table 6).
Part 0 is always at the farthest end from the viewer.
Parts (23) are repeated n times as necessary, where n is any number equal or greater than 0.
Flags (0E)
The following flags can be set here:
Bit | Value | Meaning |
---|---|---|
0 | 1 | Do not draw the far pillars for higher bridges |
Long format year of availability (0F)
Set the year of availability of the bridge in years since 0. The date range is from 0 to 5000000. This property must be set after property 08 to take effect. In TTDPatch, bridge introduction dates outside the range 1920..2175 will be limited to this range.
Purchase text (10)
Set the text appearing in the purchase window, describing what this bridge is made of, or what kind of bridge it is.
Description of a rail(11) or road(12) bridge
Set the text used as a description by the query tool. When the bridge is used for carrying a rail, it will use property 11, and will use property 12 when it will be for road.
- Note that, as for property 10, the textID can be either a TTD ID or a TextID in the DCxx range.
Bridge IDs
ID (dec) | ID (hex) | Description |
---|---|---|
0 | 00 | Wooden Bridge |
1 | 01 | Concrete Bridge |
2 | 02 | Girder, Steel Bridge |
3 | 03 | Suspension, Concrete Bridge |
4 | 04 | Suspension, Steel (Bronze) Bridge |
5 | 05 | Suspension, Steel (Golden) Bridge |
6 | 06 | Cantilever, Steel (Bronze) Bridge |
7 | 07 | Cantilever, Steel (Brown) Bridge |
8 | 08 | Cantilever, Steel (Red) Bridg |
9 | 09 | Girder, Steel Bridge |
10 | 0A | Tubular, Steel (Bronze) Bridge |
11 | 0B | (OpenTTD Only) Tubular, Steel (Golden) Bridge |
12 | 0C | (OpenTTD Only) Tubular, Silicon Bridge |
Example
Below is an example code which rebuilds the bronze steel suspension bridge (ID 04). The code fragment by itself has no use (no visual difference in game), but might be useful in order to understand the bridge code. Sprite numbers refer to the numbers in the base grf. The code might also be useful to re-enstate the default bridge if you only want to replace only one certain tracktype.
The complete recode of all default bridges including colour translations is available at TT-Forums: http://www.tt-forums.net/viewtopic.php?p=715362#p715362
//SUSPENSION, STEEL (BRONZE) bridge (04) -1 * 0 00 06 01 01 04 0D 00 02 //action 00 bridges, 01 property, 01 ID, ID, prop 0D, tableID 00, 07 tables //table 00 A9 09 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 A5 09 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 9D 09 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 95 09 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 F2 10 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 EE 10 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 1A 11 00 00 9F 09 00 00 B1 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 16 11 00 00 97 09 00 00 AD 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 //table 01 AA 09 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 A6 09 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 9E 09 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 96 09 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 F3 10 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 EF 10 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 1B 11 00 00 A0 09 00 00 B2 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 17 11 00 00 98 09 00 00 AE 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 //table 02 AC 09 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 A8 09 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 A2 09 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 9A 09 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 F5 10 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 F1 10 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 1D 11 00 00 A4 09 00 00 B4 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 19 11 00 00 9C 09 00 00 B0 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 //table 03 AB 09 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 A7 09 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 A1 09 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 99 09 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 F4 10 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 F0 10 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 1C 11 00 00 A3 09 00 00 B3 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 18 11 00 00 9B 09 00 00 AF 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 //table 04 B6 09 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 B5 09 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 B8 09 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 B7 09 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 F7 10 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 F6 10 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 1F 11 00 00 BA 09 00 00 BC 09 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 1E 11 00 00 B9 09 00 00 BB 09 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 //table 05 BD 09 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //rail X: Back&Floor;, Front, Pillars, 0 BE 09 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //rail Y: Back&Floor;, Front, Pillars, 0 BF 09 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Road X: Back&Floor;, Front, Pillars, 0 C0 09 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Road Y: Back&Floor;, Front, Pillars, 0 F8 10 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Mono X: Back&Floor;, Front, Pillars, 0 F9 10 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Mono Y: Back&Floor;, Front, Pillars, 0 20 11 00 00 C1 09 00 00 00 00 00 00 00 00 00 00 //Mlev X: Back&Floor;, Front, Pillars, 0 21 11 00 00 C2 09 00 00 00 00 00 00 00 00 00 00 //Mlev Y: Back&Floor;, Front, Pillars, 0 //table 06 86 09 00 00 88 09 00 00 85 09 00 00 87 09 00 00 //rail flat: northern end X, northern end Y, southern end X, southern end Y 8A 09 00 00 8C 09 00 00 89 09 00 00 8B 09 00 00 //rail ramp: northern end X, northern end Y, southern end X, southern end Y 8E 09 00 00 90 09 00 00 8D 09 00 00 8F 09 00 00 //road flat: northern end X, northern end Y, southern end X, southern end Y 92 09 00 00 94 09 00 00 91 09 00 00 93 09 00 00 //road ramp: northern end X, northern end Y, southern end X, southern end Y E7 10 00 00 E9 10 00 00 E6 10 00 00 E8 10 00 00 //mono flat: northern end X, northern end Y, southern end X, southern end Y EB 10 00 00 ED 10 00 00 EA 10 00 00 EC 10 00 00 //mono ramp: northern end X, northern end Y, southern end X, southern end Y 0F 11 00 00 11 11 00 00 0E 11 00 00 10 11 00 00 //mlev flat: northern end X, northern end Y, southern end X, southern end Y