diff --git a/docs/newgrf-additions-nml.html b/docs/newgrf-additions-nml.html index 5236cfddfc..05a6b06436 100644 --- a/docs/newgrf-additions-nml.html +++ b/docs/newgrf-additions-nml.html @@ -9,6 +9,7 @@ td, th { border: 1px solid #CCCCCC; padding: 0px 5px; } table { border-collapse: collapse; empty-cells: show; } span.code { font-family: "Courier New", Courier, mono; color: darkgreen; } + pre.code { font-family: "Courier New", Courier, mono; color: blue; background-color: #f8f9fa; border: 1px solid #eaecf0; padding: 1em; } dt { font-weight: bold; } @@ -23,6 +24,15 @@

All of the non-standard features listed below will automatically emit suitable feature tests, conditionals, etc. such that NewGRFs which use these features will work correctly on OpenTTD versions which do not support these features, including standard trunk OpenTTD and older/other patchpack versions.

+

Builtin functions

+ +

+

extended_feature_test(feature_name[, min_version[, max_version]])

+ This returns true if the given extended feature is present and has a version within the specified minimum and maximum (inclusive).
+ This function should only be used after the grf{} block.
+ In most cases it is not necessary to use this function, as extended properties (listed below) which are not supported are simply skipped/ignored. +

+

Railtypes properties

@@ -40,6 +50,22 @@ This flag must only be set if a different sprite is returned when bit 24 of extra_callback_info2 is set. + + +
PropertyValue rangeComment
enable_signal_recolour0 or 1 + Enable recolouring of graphics in railtype signals.
+ When enabled, in addition to returning a sprite, register 0x100 may be set to the following using STORE_TEMP: + + + + +
BitsMeaning
0 - 23Recolour sprite to use. Set to 0 for no recolouring.
24 - 31Reserved, set to zero.
+
+ If recolouring is not optional, the feature name: action0_railtype_recolour should be checked using the + extended_feature_test function + and if necessary a suitable fallback used or error message shown.
+ If the OpenTTD version does not support this property/feature, then the property would ordinarily be ignored/skipped and no recolouring would be done. +
disable_realistic_braking0 or 1 When this property is set realistic braking is disabled for trains of this railtype even when realistic braking is otherwise in effect. @@ -90,5 +116,78 @@
+

Signal graphics using switches

+

+ This feature allows signal sprites to be specified using switches in a very similar manner to railtype signals in + item (FEAT_RAILTYPES) { graphics { signals: ... } } blocks.
+ However this applies to all signals, not only those of a particular rail type.
+ Railtype signal graphics have a higher priority than general signal graphics as set here.
+
+ Variables: extra_callback_info1, extra_callback_info2, and terrain_type + are the same as for railtype signals.
+
+ This feature is not supported by standard OpenTTD or by standard NML.
+ If the use of this feature is not optional, the feature name: action3_signals_custom_signal_sprites should be checked using the + extended_feature_test function + and if necessary a suitable fallback used or error message shown.
+
+ An item (FEAT_SIGNALS, custom_signals, 0) { } block should be used to define properties and graphics.
+ The graphics block should contain a single default switch. +

+ + + + + + + + + + + +
PropertyValue rangeComment
enable_programmable_pre_signals0 or 1 + Enable programmable pre-signal graphics.
+ Programmable pre-signals have a signal type (getbits(extra_callback_info2, 16, 8)) of 6. +
enable_restricted_signals0 or 1 + Enable restricted signal flag.
+ When enabled, bit 24 of variable extra_callback_info2 is set if the signal is restricted (has a routing restriction program attached).
+ When enabled, the "Show restricted electric signals using default graphics" client setting and signal post recolouring is not applied.
+ This flag must only be set if a different sprite is returned when bit 24 of extra_callback_info2 is set. +
enable_signal_recolour0 or 1 + Enable recolouring of graphics
+ When enabled, in addition to returning a sprite, register 0x100 may be set to the following using STORE_TEMP: + + + + +
BitsMeaning
0 - 23Recolour sprite to use. Set to 0 for no recolouring.
24 - 31Reserved, set to zero.
+
+

+ Custom signal sprites example: +

+grf {
+	...
+}
+
+if (!extended_feature_test("action3_signals_custom_signal_sprites")) {
+	error(FATAL, string(STR_UNSUPPORTED_VERSION));
+}
+
+switch (FEAT_SIGNALS, SELF, switch_signals, ...) {
+	...
+}
+
+
+item (FEAT_SIGNALS, custom_signals, 0) {
+	property {
+		enable_signal_recolour: 1;
+	}
+
+	graphics {
+		switch_signals;
+	}
+}
+		
+