ReadingPatchVariables

From GRFSpecs
Revision as of 20:14, 8 November 2011 by Frosch (talk | contribs) (column for version tags)
Jump to navigationJump to search

Introduction

Since TTDPatch 2.0.1 alpha 48, it has been possible to use action D to read various special Patch variables. These are usually switch values, but there are also a few other useful values.

Syntax

<Sprite-number> * <Length> 0D <target> <operation> <variable> FE FF FF 00 00
Element Size Description
0D B Defines action 0D
<target> B Target parameter
<operation> B As for ActionD, but only assignment is valid.
<variable> B Patch variable number to read. See below.
FE B Defines a special variable access
FF FF 00 00 D Indicates that a patch variable is being read

variable

The following patch variables are defined:

variable Switch Version Value
00 miscmods/-Yo Supported by OpenTTD Supported by TTDPatch Bit switch
01 experimentalfeatures/-XF Supported by OpenTTD Supported by TTDPatch Bit switch
02 morevehicles/-x Supported by OpenTTD Supported by TTDPatch Vehicle array multiplier
03 mountains and curves/-mc Supported by OpenTTD Supported by TTDPatch Two bytes with four sets of two bits
04 planecrashcontrol/-Xc Supported by OpenTTD Supported by TTDPatch Bit switch
05 autorenew/-Xa Supported by OpenTTD Supported by TTDPatch Signed value
06 multihead/-M Supported by OpenTTD Supported by TTDPatch Speed increase, in percent
07 disasters/-XD Supported by OpenTTD Supported by TTDPatch Bit switch
08 unifiedmaglev/-XM Supported by OpenTTD Supported by TTDPatch Unified maglev mode
09 bridgespeedlimits/-XX Supported by OpenTTD Supported by TTDPatch Speed fraction, in percent
0A --- Supported by OpenTTD Supported by TTDPatch TTD Language, see the "new scheme" for action 4
0B startyear/-XY Supported by OpenTTD Supported by TTDPatch Year-1920
0C morebuildoptions/-YB Supported by OpenTTD Supported by TTDPatch Bit switch
0D moresteam/-YM Supported by OpenTTD Supported by TTDPatch value=LF (two hex digits), L=length, F=frequency
0E freighttrains/-Yf Supported by OpenTTD Supported by TTDPatch weight factor
0F wagonspeedlimits/-YL Supported by OpenTTD Supported by TTDPatch Speed increase for empty wagons
10 planespeed/-YP Supported by OpenTTD Supported by TTDPatch speed factor
11 dual company colors Supported by OpenTTD Supported by TTDPatch 2CC colormap base sprite (since r1404)
12 miscmods2/-Zm Supported by OpenTTD Supported by TTDPatch Bit switch (since r1738)
13 map size information Supported by OpenTTD Supported by TTDPatch Format = -MABXYSS (since r11961 and r1817)
M the type of map
  • bit 0 set: squared map. Clear : rectangular map
  • bit 1 set: Y is the bigger edge(bit 0 is clear).Clear : X is the bigger edge.
A minimum edge(log2) of the map
B maximum edge(log2) of the map
XY edges(log2) of each side of the map.
SS combination of both X and Y, thus giving the size(log2) of the map

All map sizes will be substracted by 6, as to keep the size 64 the smallest one, thus zero based

14 maximum height level Supported by OpenTTD Supported by TTDPatch Maximal possible height level of a tile. Currently fixed at 15.

If experimentalfeatures, miscmods, or miscmods2 are off, the corresponding value will be zero. For all other switches, the value is unspecified if the switch is off, so action 7 variable 85 should be checked first.