VarAction2: Add support for more varaction2 types
Add CB failure and deterministic relative types
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
<h3 id="sections">Sections</h3>
|
||||
<ul>
|
||||
<li><a href="#builtin-functions">Builtin functions</a></li>
|
||||
<li><a href="#switch-types">Additional switch types</a></li>
|
||||
<li><a href="#railtype-properties">Railtype properties</a></li>
|
||||
<li><a href="#railtype-variables">Railtype variables</a></li>
|
||||
<li><a href="#roadtype-properties">Roadtype properties</a></li>
|
||||
@@ -58,6 +59,21 @@
|
||||
In most cases it is not necessary to use this function, as extended properties (listed below) which are not supported are simply skipped/ignored.
|
||||
</p>
|
||||
|
||||
<h3 id="switch-types"><a href="https://newgrf-specs.tt-wiki.net/wiki/NML:Switch">Additional switch types</a></h3>
|
||||
<p>
|
||||
In addition to SELF and PARENT, switches for vehicle features may use one of the following types below.<br />
|
||||
(These are mostly the same as in <a href="https://newgrf-specs.tt-wiki.net/wiki/NML:Random_switch">random_switch</a>).<br />
|
||||
The 'x' parameter (count x vehicles in given direction) is currently required to be a compile-time constant between 0 and 255.
|
||||
<table>
|
||||
<tr><th>Type</th><th>Meaning</th></tr>
|
||||
<tr><td>BACKWARD_SELF(x)</td><td>Count x vehicles backward (away from the engine), starting at the vehicle itself</td></tr>
|
||||
<tr><td>FORWARD_SELF(x)</td><td>Count x vehicles forward (towards the engine), starting at the vehicle itself</td></tr>
|
||||
<tr><td>BACKWARD_ENGINE(x)</td><td>Count x vehicles backward, starting at the leading engine</td></tr>
|
||||
<tr><td>BACKWARD_SAMEID(x)</td><td>Count x vehicles backward, starting at the first vehicle in the chain with the same ID</td></tr>
|
||||
</table>
|
||||
<p>These require the <span class="code">more_varaction2_types</span> feature. If this feature is not present, switches of these types will produce a CB_FAILED result.</p>
|
||||
</p>
|
||||
|
||||
<h3 id="railtype-properties"><a href="https://newgrf-specs.tt-wiki.net/wiki/NML:Railtypes#Railtype_properties">Railtype properties</a></h3>
|
||||
<table>
|
||||
<tr><th>Property</th><th>Value range</th><th>Comment</th></tr>
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<li><a href="#a0signals">Action 0 - Signals (Feature 0E)</a></li>
|
||||
<li><a href="#a0objects">Action 0 - Objects</a></li>
|
||||
<li><a href="#variable-mapping">Action 14 - Variable Mapping for Variational Action 2</a></li>
|
||||
<li><a href="#varaction2_additional_types">Variational Action 2 - Additional Types</a></li>
|
||||
<li><a href="#varaction2_station">Variational Action 2 - Stations</a></li>
|
||||
<li><a href="#varaction2_railtypes">Variational Action 2 - Railtypes</a></li>
|
||||
<li><a href="#varaction2_object">Variational Action 2 - Objects</a></li>
|
||||
@@ -724,6 +725,59 @@
|
||||
01 00 // default: link to action2ID 01
|
||||
</pre>
|
||||
<br />
|
||||
<h3 id="varaction2_additional_types">Variational Action 2 - Additional Types</h3>
|
||||
<p>Additional variational action 2 types are indicated by the feature name: <font face="monospace">more_varaction2_types</font>, this document describes version 1.<br />
|
||||
This feature name must be tested for to enable this feature.</p>
|
||||
<p>See the <a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2#Type">Variational Action 2 Specification (types)</a> for background information.</p>
|
||||
<p>This feature adds the type value 87, for additional variation action 2 modes/scopes. (This is used instead of the standard values: 81, 82, 85, 86, 89 or 8A).<br />
|
||||
An additional byte follows to specify which sub-type.</p>
|
||||
<p>
|
||||
<pre><Sprite-number> * <Length> 02 <feature> <set-id> 87 <sub-type> ...</pre>
|
||||
The following sub-types are defined:
|
||||
<table>
|
||||
<tr><th>Sub-type</th><th>Meaning</th></tr>
|
||||
<tr><td>00</td><td>Callback failure group</td></tr>
|
||||
<tr><td>01</td><td>Relative scope for vehicles (same syntax as <a href="https://newgrf-specs.tt-wiki.net/wiki/RandomAction2#80.2F83.2F84">random action 2 type 84</a>)</td></tr>
|
||||
<tr><td>02</td><td>Relative scope for vehicles (longer syntax)</td></tr>
|
||||
</table>
|
||||
<p>If an unknown sub-type is used, or if subsequent sub-type bytes are invalid, a callback failure group is created, the same as sub-type 00.</p>
|
||||
<h4 id="varaction2_additional_type_00">Sub-type 00: Callback failure</h4>
|
||||
<pre><Sprite-number> * <Length> 02 <feature> <set-id> <b>87 00</b></pre>
|
||||
This produces a callback failed result in all cases (appropriate whether or not variable 0C is currently 0).<br />
|
||||
This can be used to avoiding needing to branch on variable 0C or create empty (feature-dependant) real sprite/sprite layout/industry production groups.
|
||||
</p>
|
||||
<h4 id="varaction2_additional_type_01">Sub-type 01: Relative scope for vehicles (random action 2 type 84 syntax)</h4>
|
||||
<pre><Sprite-number> * <Length> 02 <feature> <set-id> <b>87 01 <count></b> <variable> <varadjust> [<operator> <variable> <varadjust>]... <nvar> (<set-id> <low-range> <high-range>){n} <default></pre>
|
||||
<p>This sub-type is only valid for vehicles.</p>
|
||||
<p>The vehicle which is accessed can be any in the vehicle consist. The <font face="monospace">count</font> byte selects which, this has the same syntax and functionality
|
||||
as the <a href="https://newgrf-specs.tt-wiki.net/wiki/RandomAction2#count"><font face="monospace">count</font> byte in random action 2 type 84</a>.</p>
|
||||
<p>Note: The count byte mode where temporary variable 0x100 is used should be used with caution.</p>
|
||||
<h4 id="varaction2_additional_type_02">Sub-type 02: Relative scope for vehicles (longer syntax)</h4>
|
||||
<pre><Sprite-number> * <Length> 02 <feature> <set-id> <b>87 02 <mode> <offset></b> <variable> <varadjust> [<operator> <variable> <varadjust>]... <nvar> (<set-id> <low-range> <high-range>){n} <default></pre>
|
||||
<p>This sub-type is only valid for vehicles.</p>
|
||||
<p>The vehicle which is accessed can be any in the vehicle consist. The <font face="monospace">mode</font> and <font face="monospace">offset</font> bytes select which.</p>
|
||||
<p>The <font face="monospace">mode</font> byte has the following syntax:
|
||||
<table>
|
||||
<tr><th>Bits</th><th>Meaning</th></tr>
|
||||
<tr><td>0 - 1</td><td>
|
||||
Selection mode:<br/>
|
||||
These values are the same as bits 6 - 7 of the <a href="https://newgrf-specs.tt-wiki.net/wiki/RandomAction2#count"><font face="monospace">count</font> byte in random action 2 type 84</a>.
|
||||
<table>
|
||||
<tr><th>Value</th><th>Meaning</th></tr>
|
||||
<tr><td>0</td><td>Count back (away from the engine), starting at this vehicle</td></tr>
|
||||
<tr><td>1</td><td>Count forward (toward the engine), starting at this vehicle</td></tr>
|
||||
<tr><td>2</td><td>Count back, starting at the engine</td></tr>
|
||||
<tr><td>3</td><td>Count back, starting at the first vehicle in this chain of vehicles with the same ID, as for vehicle variable 41</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td>7</td><td>If set, use variable 0x100 for the offset. The offset byte must be 0.</td></tr>
|
||||
</table>
|
||||
The remaining bits are reserved for future used and must be set to 0.
|
||||
</p>
|
||||
<p>The <font face="monospace">offset</font> byte specifies how far to count from the starting vehicle. A value of 0 is not special.<br />
|
||||
Bit 7 of the <font face="monospace">mode</font> byte must be set to use temporary variable 0x100 instead.</p>
|
||||
<p>Note: Using temporary variable 0x100 as the offset should be used with caution.</p>
|
||||
<br />
|
||||
<h3 id="varaction2_station"><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Stations">Variational Action 2 - Stations</a></h3>
|
||||
<h4 id="varaction2_station_var42">Track type in purchase list (42)</h4>
|
||||
<p>This is indicated by the feature name: <font face="monospace">varaction2_station_var42</font>, version 1</p>
|
||||
|
||||
Reference in New Issue
Block a user