Difference between revisions of "GlobalVariables"
Planetmaker (talk | contribs) (Copy from Action7 and ActionD) |
Planetmaker (talk | contribs) (Add information on in which actions the variables may be used) |
||
Line 1: | Line 1: | ||
{| |
{| |
||
− | !'''Variable'''!![[GRFActionsDetailed|'''Size''']]!!'''Description''' |
+ | !'''Variable'''!![[GRFActionsDetailed|'''Size''']]!!'''Actions'''!!'''Description''' |
|- |
|- |
||
− | |81||B||current year (count from 1920, max. 2175 even with eternalgame) |
+ | |81||B||2,7,9||current year (count from 1920, max. 2175 even with eternalgame) |
|- |
|- |
||
− | |83||B||Current climate: 00 = temp, 01 = arctic, 02 = trop, 03 = toyland |
+ | |83||B||2,7,9||Current climate: 00 = temp, 01 = arctic, 02 = trop, 03 = toyland |
|- |
|- |
||
− | |84||D||[[GrfLoadingStages|GRF loading stage]], see below |
+ | |84||D||7,9||[[GrfLoadingStages|GRF loading stage]], see below |
|- |
|- |
||
− | |85||B||[[TTDPatchFlags|TTDPatch flags]]: only for bit tests |
+ | |85||B||2,7,9||[[TTDPatchFlags|TTDPatch flags]]: only for bit tests |
|- |
|- |
||
− | |86||B||Road traffic side: bit 4 clear=left, set=right |
+ | |86||B||2,7,9||Road traffic side: bit 4 clear=left, set=right |
|- |
|- |
||
− | |88||4*B||Checks specified GRFID (see condition-types below) |
+ | |88||4*B||7,9||Checks specified GRFID (see condition-types below) |
|- |
|- |
||
− | |8B||D||TTDPatch version, see below |
+ | |8B||D||2,7,9||TTDPatch version, see below |
|- |
|- |
||
− | |8D||B||TTD version, 0=DOS, 1=Windows |
+ | |8D||B||2,7,9||TTD version, 0=DOS, 1=Windows |
|- |
|- |
||
− | |8E||B||Y-Offset for train sprites |
+ | |8E||B||2,7,9||Y-Offset for train sprites |
|- |
|- |
||
− | |8F||4*B||Rail track type cost factors |
+ | |8F||4*B||2,7,9||Rail track type cost factors |
|- |
|- |
||
− | |92||B||Game mode, 0 in title screen, 1 in game and 2 in editor |
+ | |92||B||2,7,9||Game mode, 0 in title screen, 1 in game and 2 in editor |
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
⚫ | |||
|- |
|- |
||
⚫ | |||
− | |93||W||Tile refresh offset to left |
||
|- |
|- |
||
− | | |
+ | |99||D||D||Global ID offset |
|- |
|- |
||
⚫ | |||
− | |95||W||Tile refresh offset upwards |
||
|- |
|- |
||
+ | | || || ||'''Writeable only by ActionD''' |
||
− | |96||W||Tile refresh offset downwards |
||
|- |
|- |
||
⚫ | |||
⚫ | |||
− | |- |
||
− | |99||D||Global ID offset |
||
− | |- |
||
⚫ | |||
− | |- |
||
⚫ | |||
|} |
|} |
||
Revision as of 20:07, 22 July 2011
Variable | Size | Actions | Description |
---|---|---|---|
81 | B | 2,7,9 | current year (count from 1920, max. 2175 even with eternalgame) |
83 | B | 2,7,9 | Current climate: 00 = temp, 01 = arctic, 02 = trop, 03 = toyland |
84 | D | 7,9 | GRF loading stage, see below |
85 | B | 2,7,9 | TTDPatch flags: only for bit tests |
86 | B | 2,7,9 | Road traffic side: bit 4 clear=left, set=right |
88 | 4*B | 7,9 | Checks specified GRFID (see condition-types below) |
8B | D | 2,7,9 | TTDPatch version, see below |
8D | B | 2,7,9 | TTD version, 0=DOS, 1=Windows |
8E | B | 2,7,9 | Y-Offset for train sprites |
8F | 4*B | 2,7,9 | Rail track type cost factors |
92 | B | 2,7,9 | Game mode, 0 in title screen, 1 in game and 2 in editor |
9A | D | 2,7,9 | Has always all bits set; you can use this to make unconditional jumps |
9D | D | 2,7,9 | TTD Platform, 0=TTDPatch, 1=OpenTTD |
A1 | D | 2,7,9 | OpenTTD version, see below. |
A2 | D | 2,7,9 | Difficulty level: 00= easy, 01=medium, 02=hard, 03=custom, since r12449 for OpenTTD and r1857 for TTDPatch |
A3 | D | 2,7,9 | Current date(4); long format, since r13376 in OpenTTD and r2048 in TTDPatch |
A4 | D | 2,7,9 | Current year(4); long format, year zero based since r13376 in OpenTTD and r2048 in TTDPatch |
Read- and writable by ActionD | |||
8E | B | D | Y-Offset for train sprites |
8F | 3*B | 2,D | Rail track type cost factors |
93 | W | 7,9,D | Tile refresh offset to left |
94 | W | 7,9,D | Tile refresh offset to right |
95 | W | 7,9,D | Tile refresh offset upwards |
96 | W | 7,9,D | Tile refresh offset downwards |
97 | B | 2,D | Snow line height |
99 | D | D | Global ID offset |
9E | D | 2,D | Misc. GRF Features |
Writeable only by ActionD | |||
9F | D | D | Locale-dependent settings |
Note 1: All other parameter values greater than 80 (hexadecimal) are reserved and must not be used in action 7 or 9.
Note 2: The value of variable 88 can only be tested with the GRFID tests.
Note 3: The tile refresh offsets are available from TTDPatch 2.0.1 alpha 39. See Action D for more details on their use.
Note 4: OpenTTD doesn't report the current date and year but the date and year the game was loaded. The reason lies in the fact that it was seen that use of this variable leads to desyncs in network games.
Variable 84 is a BYTE variable up to TTDPatch 2.5r1220. Its lower byte (bits 0..7) are 0 for the post-load and GRF initialization stages and 01 for all other stages. The remaining bits are a bitmask, and including the lower byte have the following meaning:
Bit | Meaning |
---|---|
0 | Set after the "Initialization" stage completes |
1..7 | Always clear |
8 | Set during the "Reserve" stage only |
9 | Set during the "Activate" stage only |
10 | Set during the "Test" stage only |
Variable 8B has the following format: MMmrbbbb (though encoded in little endian as bb bb mr MM)
Element | Meaning | Value |
---|---|---|
MM | major | First number of the TTDPatch version |
m | minor | Second number of the TTDPatch version |
r | revision | Third number of the TTDPatch version* |
bbbb | build | Alpha/beta version number times ten (up to an including TTDPatch 2.5 beta 5), SVN revision (from TTDPatch 2.5 beta 5 r418 on) |
Examples
Version | Variable 8B | Elements |
---|---|---|
1.9.1 alpha 50 | 019101F4 | MM=01, m=9, r=1, bbbb=50*10=01F4 |
2.0 beta 4 | 02040028 | MM=02, m=0, r=4*, bbbb=4*10=0028 |
2.0 final | 02070046 | MM=02, m=0, r=7*, bbbb=70=0046 |
2.0 rev 1 | 02070050 | MM=02, m=0, r=7*, bbbb=80=0050 |
2.0.1 alpha 3 | 020A001E | MM=02, m=0, r=10*, bbbb=3*10=001E |
2.5 beta 2 | 02500014 | MM=02, m=5, r=0, bbbb=2*10=0014 |
2.5 rev631 | 02500631 | MM=02, m=5, r=0, bbbb=631=0631 |
(*) For TTDPatch 2.0, r=7 and for TTDPatch 2.0.1 series, r=10 due to an oversight which used r=1..4 for TTDPatch 2.0 beta 1..4.
To detect versions from TTDPatch 2.5 rev419 and up correctly, check that var. 8B is 02500419 or higher, or replace 0419 with the actual required revision (using the revision number as hex digits). Because SVN revisions are shared with other patch branches, it is important to check the actual patch version as well as the SVN revision.
Variable A1 has the following format: Mmrbbbbb (though encoded in little endian as bb bb rb Mm). This variable has only a usefull meaning when variable 9D is 1 (OpenTTD). This variable can be used since OpenTTD r11330.
Element | Meaning | Value |
---|---|---|
M | major | First number of the OpenTTD version |
m | minor | Second number of the OpenTTD version |
r | revision | Third number of the OpenTTD version |
bbbbb | build | Subversion revision of a build leading towards a release. When a final release is done 80000h is set. |
The presence of 80000h (bit 19 set) means that a release always has a higher version number than any builds leading to that release.