diff --git a/docs/newgrf-roadstops-nml.html b/docs/newgrf-roadstops-nml.html
index 02b5392d7c..a6468aa15d 100644
--- a/docs/newgrf-roadstops-nml.html
+++ b/docs/newgrf-roadstops-nml.html
@@ -93,6 +93,8 @@
Only show in the tram build menu (not road). (This only takes effect from road_stops version 4).
RST_GENERAL_FLAG_BUILD_MENU_DRAW_DISABLED_VIEWS
Use custom graphics for disabled road stop views. (This only takes effect from road_stops version 8).
+ RST_GENERAL_FLAG_DRAW_MODE_REGISTER
+ Read the road stop draw mode from variable 0x100 (set using STORE_TEMP), this overrides the draw_mode property. (This only takes effect from road_stops version 9).
minimum_bridge_height | Array of 6 items [0..255, ...] | Minimum clearances required for a bridge for each of the 6 views/rotations (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px). |
disallowed_bridge_pillars | Array of 6 items [bitmask(RST_BRIDGE_PILLAR_FLAG_, ...), ...] |
diff --git a/docs/newgrf-roadstops.html b/docs/newgrf-roadstops.html
index 8b2b148325..416df63d43 100644
--- a/docs/newgrf-roadstops.html
+++ b/docs/newgrf-roadstops.html
@@ -159,6 +159,7 @@
|
5 | 20 | Only show in the road build menu (not tram).This requires road_stops, version 4. |
6 | 40 | Only show in the tram build menu (not road).This requires road_stops, version 4. |
7 | 80 | Use custom graphics for disabled road stop views.This requires road_stops, version 8. |
+ 8 | 100 | Read the road stop draw mode from variable 0x100, this overrides the roadstop_draw_mode property.This requires road_stops, version 9. |
The default value is 0 (no flags enabled).
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index ffd06b55d0..a1d94fd907 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -5183,7 +5183,7 @@ static ChangeInfoResult RoadStopChangeInfo(uint id, int numinfo, int prop, const
if (MappedPropertyLengthMismatch(buf, 4, mapping_entry)) break;
FALLTHROUGH;
case 0x12: // General flags
- rs->flags = (uint8)buf->ReadDWord(); // Future-proofing, size this as 4 bytes, but we only need one byte's worth of flags at present
+ rs->flags = (uint16)buf->ReadDWord(); // Future-proofing, size this as 4 bytes, but we only need two bytes' worth of flags at present
break;
case A0RPI_ROADSTOP_MIN_BRIDGE_HEIGHT:
diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp
index 1b2b4dc8eb..d80abe4c51 100644
--- a/src/newgrf_roadstop.cpp
+++ b/src/newgrf_roadstop.cpp
@@ -330,9 +330,16 @@ void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec,
SpriteID image = dts->ground.sprite;
PaletteID pal = dts->ground.pal;
+ RoadStopDrawMode draw_mode;
+ if (HasBit(spec->flags, RSF_DRAW_MODE_REGISTER)) {
+ draw_mode = (RoadStopDrawMode)GetRegister(0x100);
+ } else {
+ draw_mode = spec->draw_mode;
+ }
+
if (type == STATION_ROADWAYPOINT) {
DrawSprite(SPR_ROAD_PAVED_STRAIGHT_X, PAL_NONE, x, y);
- if ((spec->draw_mode & ROADSTOP_DRAW_MODE_WAYP_GROUND) && GB(image, 0, SPRITE_WIDTH) != 0) {
+ if ((draw_mode & ROADSTOP_DRAW_MODE_WAYP_GROUND) && GB(image, 0, SPRITE_WIDTH) != 0) {
DrawSprite(image, GroundSpritePaletteTransform(image, pal, palette), x, y);
}
} else if (GB(image, 0, SPRITE_WIDTH) != 0) {
@@ -344,7 +351,7 @@ void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec,
uint sprite_offset = 5 - view;
/* Road underlay takes precedence over tram */
- if (type == STATION_ROADWAYPOINT || spec->draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) {
+ if (type == STATION_ROADWAYPOINT || draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) {
if (rti->UsesOverlay()) {
SpriteID ground = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_GROUND);
DrawSprite(ground + sprite_offset, PAL_NONE, x, y);
@@ -357,7 +364,7 @@ void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec,
}
} else {
/* Drive-in stop */
- if ((spec->draw_mode & ROADSTOP_DRAW_MODE_ROAD) && rti->UsesOverlay()) {
+ if ((draw_mode & ROADSTOP_DRAW_MODE_ROAD) && rti->UsesOverlay()) {
SpriteID ground = GetCustomRoadSprite(rti, INVALID_TILE, ROTSG_ROADSTOP);
DrawSprite(ground + view, PAL_NONE, x, y);
}
diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h
index aab86a5cdb..6e848be737 100644
--- a/src/newgrf_roadstop.h
+++ b/src/newgrf_roadstop.h
@@ -72,6 +72,7 @@ enum RoadStopSpecFlags {
RSF_BUILD_MENU_ROAD_ONLY, ///< Only show in the road build menu (not tram).
RSF_BUILD_MENU_TRAM_ONLY, ///< Only show in the tram build menu (not road).
RSF_BUILD_MENU_DRAW_DISABLED_VIEWS, ///< Use custom road stop graphics for disabled views
+ RSF_DRAW_MODE_REGISTER, ///< Use custom road stop graphics for disabled views
};
enum RoadStopSpecIntlFlags {
@@ -145,7 +146,7 @@ struct RoadStopSpec {
RoadStopAvailabilityType stop_type = ROADSTOPTYPE_ALL;
RoadStopDrawMode draw_mode = ROADSTOP_DRAW_MODE_ROAD | ROADSTOP_DRAW_MODE_OVERLAY;
uint8 callback_mask = 0;
- uint8 flags = 0;
+ uint16 flags = 0;
uint8 internal_flags = 0; ///< Bitmask of internal spec flags (RoadStopSpecIntlFlags)
CargoTypes cargo_triggers = 0; ///< Bitmask of cargo types which cause trigger re-randomizing
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 654a3dd1da..d6a837cfe2 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3551,7 +3551,9 @@ draw_default_foundation:
StationType type = GetStationType(ti->tile);
const RoadStopSpec *stopspec = GetRoadStopSpec(ti->tile);
+ RoadStopDrawMode stop_draw_mode = (RoadStopDrawMode)0;
if (stopspec != nullptr) {
+ stop_draw_mode = stopspec->draw_mode;
int view = dir;
if (IsDriveThroughStopTile(ti->tile)) view += 4;
st = BaseStation::GetByTile(ti->tile);
@@ -3559,6 +3561,9 @@ draw_default_foundation:
const SpriteGroup *group = object.Resolve();
if (group != nullptr && group->type == SGT_TILELAYOUT) {
const DrawTileSprites *dts = ((const TileLayoutSpriteGroup *)group)->ProcessRegisters(nullptr);
+ if (HasBit(stopspec->flags, RSF_DRAW_MODE_REGISTER)) {
+ stop_draw_mode = (RoadStopDrawMode)GetRegister(0x100);
+ }
t = dts;
if (type == STATION_ROADWAYPOINT && (stopspec->draw_mode & ROADSTOP_DRAW_MODE_WAYP_GROUND)) {
draw_ground = true;
@@ -3576,7 +3581,7 @@ draw_default_foundation:
}
if (IsDriveThroughStopTile(ti->tile)) {
- if (type != STATION_ROADWAYPOINT && (stopspec == nullptr || (stopspec->draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) != 0)) {
+ if (type != STATION_ROADWAYPOINT && (stopspec == nullptr || (stop_draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) != 0)) {
uint sprite_offset = axis == AXIS_X ? 1 : 0;
DrawRoadOverlays(ti, PAL_NONE, road_rti, tram_rti, sprite_offset, sprite_offset);
}
@@ -3589,7 +3594,7 @@ draw_default_foundation:
/* Non-drivethrough road stops are only valid for roads. */
assert_tile(road_rt != INVALID_ROADTYPE && tram_rt == INVALID_ROADTYPE, ti->tile);
- if ((stopspec == nullptr || (stopspec->draw_mode & ROADSTOP_DRAW_MODE_ROAD) != 0) && road_rti->UsesOverlay()) {
+ if ((stopspec == nullptr || (stop_draw_mode & ROADSTOP_DRAW_MODE_ROAD) != 0) && road_rti->UsesOverlay()) {
SpriteID ground = GetCustomRoadSprite(road_rti, ti->tile, ROTSG_ROADSTOP);
DrawGroundSprite(ground + dir, PAL_NONE);
}