Add road stops flag to disable drawing catenary

pull/379/head
Jonathan G Rennison 2 years ago
parent 51ffc80cf6
commit ad0dc6dc87

@ -78,6 +78,8 @@
<span class="indent">Animation callback requires random bits in variable <span class="code">extra_callback_info1</span>.</span></p>
<p><b>RST_GENERAL_FLAG_NO_ONE_WAY_OVERLAY</b><br />
<span class="indent">Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using the <span class="code">one_way_info</span> variable.</span></p>
<p><b>RST_GENERAL_FLAG_NO_CATENARY</b><br />
<span class="indent">Do not show catenary graphics. (This only takes effect from <span class="code">road_stops</span> version 2).</span></p>
</td></tr>
<tr><td>minimum_bridge_height</td><td>Array of 6 items [0..255, ...]</td><td>Minimum clearances required for a bridge for each of the <a href="#roadstop_views">6 views/rotations</a> (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px).</td></tr>
<tr><td>disallowed_bridge_pillars</td><td>Array of 6 items [bitmask(RST_BRIDGE_PILLAR_FLAG_, ...), ...]</td><td>

@ -19,8 +19,9 @@
<p>A subset of the functionality listed below is also supported in a fork of NML, see the associated <a href="newgrf-roadstops-nml.html">NML road stops</a> and <a href="newgrf-additions-nml.html">NML additions</a> documents for more details.</p>
<p>NewGRFs which use this feature SHOULD use the <a href="newgrf-additions.html#feature-test">feature testing</a> mechanism to check whether the road stop feature and/or feature ID mapping is supported.</p>
<p>NewGRFs which use this feature MUST use the <a href="newgrf-additions.html#feature-id-mapping">feature ID mapping</a> mechanism to map the non-standard NewGRF road stop feature to a local feature ID.</p>
<p>This feature is indicated by the feature name: <font face="monospace">road_stops</font>, version 1.</br>
The feature name to use for feature ID mapping is <font face="monospace">road_stops</font>.</p>
<p>This feature is indicated by the feature name: <font face="monospace">road_stops</font>, version 1.<br />
The feature name to use for feature ID mapping is <font face="monospace">road_stops</font>.<br />
Features/properties/variables which require a higher version will indicate the required version. Unless indicated otherwise these will fall back to doing nothing on versions which do not support them.</p>
<p><b>Actions:</b>
@ -149,6 +150,7 @@
<tr><th>Bit</th><th>Value</th><th>Meaning</th></tr>
<tr><td>0</td><td>1</td><td>Callback 141 needs random bits in variable 10</td></tr>
<tr><td>1</td><td>2</td><td>Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using bits 0..1 of variable 50.</td></tr>
<tr><td>2</td><td>4</td><td>Do not catenary graphics.</br>This requires <font face="monospace">road_stops</font>, version 2.</td></tr>
</table>
The default value is 0 (no flags enabled).
</p>

@ -51,7 +51,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
GRFFeatureInfo("action0_object_edge_foundation_mode", 2),
GRFFeatureInfo("action0_object_flood_resistant", 1),
GRFFeatureInfo("action0_object_viewport_map_tile_type", 1),
GRFFeatureInfo("road_stops", 1),
GRFFeatureInfo("road_stops", 2),
GRFFeatureInfo(),
};

@ -66,6 +66,7 @@ DECLARE_ENUM_AS_BIT_SET(RoadStopDrawMode)
enum RoadStopSpecFlags {
RSF_CB141_RANDOM_BITS, ///< Callback 141 needs random bits.
RSF_NO_ONE_WAY_OVERLAY, ///< Do not show one-way road overlays.
RSF_NO_CATENARY, ///< Do not show catenary.
};
enum RoadStopSpecIntlFlags {

@ -2115,7 +2115,7 @@ static SpriteID GetRoadGroundSprite(const TileInfo *ti, Roadside roadside, const
* Draw ground sprite and road pieces
* @param ti TileInfo
*/
void DrawRoadBits(TileInfo *ti, RoadBits road, RoadBits tram, Roadside roadside, bool snow_or_desert)
void DrawRoadBits(TileInfo *ti, RoadBits road, RoadBits tram, Roadside roadside, bool snow_or_desert, bool draw_catenary)
{
const bool is_road_tile = IsTileType(ti->tile, MP_ROAD);
@ -2154,8 +2154,10 @@ void DrawRoadBits(TileInfo *ti, RoadBits road, RoadBits tram, Roadside roadside,
return;
}
/* Draw road, tram catenary */
DrawRoadCatenary(ti);
if (draw_catenary) {
/* Draw road, tram catenary */
DrawRoadCatenary(ti);
}
/* Return if full detail is disabled, or we are zoomed fully out. */
if (!HasBit(_display_opt, DO_FULL_DETAIL) || _cur_dpi->zoom > ZOOM_LVL_DETAIL) return;
@ -2184,12 +2186,12 @@ void DrawRoadBits(TileInfo *ti, RoadBits road, RoadBits tram, Roadside roadside,
void DrawRoadBitsRoad(TileInfo *ti)
{
DrawRoadBits(ti, GetRoadBits(ti->tile, RTT_ROAD), GetRoadBits(ti->tile, RTT_TRAM), GetRoadside(ti->tile), IsOnSnow(ti->tile));
DrawRoadBits(ti, GetRoadBits(ti->tile, RTT_ROAD), GetRoadBits(ti->tile, RTT_TRAM), GetRoadside(ti->tile), IsOnSnow(ti->tile), true);
}
void DrawRoadBitsTunnelBridge(TileInfo *ti)
{
DrawRoadBits(ti, GetCustomBridgeHeadRoadBits(ti->tile, RTT_ROAD), GetCustomBridgeHeadRoadBits(ti->tile, RTT_TRAM), ROADSIDE_PAVED, false);
DrawRoadBits(ti, GetCustomBridgeHeadRoadBits(ti->tile, RTT_ROAD), GetCustomBridgeHeadRoadBits(ti->tile, RTT_TRAM), ROADSIDE_PAVED, false, true);
}
/** Tile callback function for rendering a road tile to the screen */

@ -3450,10 +3450,10 @@ draw_default_foundation:
}
} else if (IsRoadWaypointTile(ti->tile)) {
RoadBits bits = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? ROAD_X : ROAD_Y;
extern void DrawRoadBits(TileInfo *ti, RoadBits road, RoadBits tram, Roadside roadside, bool snow_or_desert);
extern void DrawRoadBits(TileInfo *ti, RoadBits road, RoadBits tram, Roadside roadside, bool snow_or_desert, bool draw_catenary);
DrawRoadBits(ti, GetRoadTypeRoad(ti->tile) != INVALID_ROADTYPE ? bits : ROAD_NONE,
GetRoadTypeTram(ti->tile) != INVALID_ROADTYPE ? bits : ROAD_NONE,
GetRoadWaypointRoadside(ti->tile), IsRoadWaypointOnSnowOrDesert(ti->tile));
GetRoadWaypointRoadside(ti->tile), IsRoadWaypointOnSnowOrDesert(ti->tile), false);
} else {
if (layout != nullptr) {
/* Sprite layout which needs preprocessing */
@ -3559,8 +3559,10 @@ draw_default_foundation:
}
}
/* Draw road, tram catenary */
DrawRoadCatenary(ti);
if (stopspec == nullptr || !HasBit(stopspec->flags, RSF_NO_CATENARY)) {
/* Draw road, tram catenary */
DrawRoadCatenary(ti);
}
}
if (IsRailWaypoint(ti->tile)) {

Loading…
Cancel
Save