Add a waypoint ground draw flag to NewGRF road stops
Adjust overlay draw conditions
This commit is contained in:
@@ -91,6 +91,7 @@
|
||||
<tr><th>Bit</th><th>Value</th><th>Meaning</th></tr>
|
||||
<tr><td>0</td><td>1</td><td>Bay stops: Draw road type ground sprite</td></tr>
|
||||
<tr><td>1</td><td>2</td><td>Drive through stops: Draw road/tram type overlays</td></tr>
|
||||
<tr><td>4</td><td>4</td><td>Road waypoints: Draw sprite layout ground sprite on top of the underlying road (by default the sprite layout ground sprite is not used)</td></tr>
|
||||
</table>
|
||||
The default value is 3 (bits 0 and 1 both set).
|
||||
</p>
|
||||
|
@@ -275,6 +275,9 @@ void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec,
|
||||
|
||||
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) {
|
||||
DrawSprite(image, GroundSpritePaletteTransform(image, pal, palette), x, y);
|
||||
}
|
||||
} else if (GB(image, 0, SPRITE_WIDTH) != 0) {
|
||||
DrawSprite(image, GroundSpritePaletteTransform(image, pal, palette), x, y);
|
||||
}
|
||||
@@ -284,7 +287,7 @@ void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec,
|
||||
uint sprite_offset = 5 - view;
|
||||
|
||||
/* Road underlay takes precedence over tram */
|
||||
if (spec->draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) {
|
||||
if (type == STATION_ROADWAYPOINT || spec->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);
|
||||
|
@@ -57,8 +57,9 @@ enum RoadStopAvailabilityType : byte {
|
||||
*/
|
||||
enum RoadStopDrawMode : byte {
|
||||
ROADSTOP_DRAW_MODE_NONE = 0,
|
||||
ROADSTOP_DRAW_MODE_ROAD = 1 << 0, ///< 0b01, Draw the road itself
|
||||
ROADSTOP_DRAW_MODE_OVERLAY = 1 << 1, ///< 0b10, Draw the road overlay for roadstops, e.g. pavement
|
||||
ROADSTOP_DRAW_MODE_ROAD = 1 << 0, ///< Bay stops: Draw the road itself
|
||||
ROADSTOP_DRAW_MODE_OVERLAY = 1 << 1, ///< Drive-through stops: Draw the road overlay, e.g. pavement
|
||||
ROADSTOP_DRAW_MODE_WAYP_GROUND = 1 << 2, ///< Waypoints: Draw the sprite layout ground tile (on top of the road)
|
||||
};
|
||||
DECLARE_ENUM_AS_BIT_SET(RoadStopDrawMode)
|
||||
|
||||
|
@@ -3503,16 +3503,20 @@ draw_default_foundation:
|
||||
|
||||
Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y;
|
||||
DiagDirection dir = GetRoadStopDir(ti->tile);
|
||||
StationType type = GetStationType(ti->tile);
|
||||
|
||||
const RoadStopSpec *stopspec = GetRoadStopSpec(ti->tile);
|
||||
if (stopspec != nullptr) {
|
||||
int view = dir;
|
||||
if (IsDriveThroughStopTile(ti->tile)) view += 4;
|
||||
st = BaseStation::GetByTile(ti->tile);
|
||||
RoadStopResolverObject object(stopspec, st, ti->tile, INVALID_ROADTYPE, GetStationType(ti->tile), view);
|
||||
RoadStopResolverObject object(stopspec, st, ti->tile, INVALID_ROADTYPE, type, view);
|
||||
const SpriteGroup *group = object.Resolve();
|
||||
const DrawTileSprites *dts = ((const TileLayoutSpriteGroup *)group)->ProcessRegisters(nullptr);
|
||||
t = dts;
|
||||
if (type == STATION_ROADWAYPOINT && (stopspec->draw_mode & ROADSTOP_DRAW_MODE_WAYP_GROUND)) {
|
||||
draw_ground = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw ground sprite */
|
||||
@@ -3525,7 +3529,7 @@ draw_default_foundation:
|
||||
}
|
||||
|
||||
if (IsDriveThroughStopTile(ti->tile)) {
|
||||
if (stopspec == nullptr || (stopspec->draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) != 0) {
|
||||
if (type != STATION_ROADWAYPOINT && (stopspec == nullptr || (stopspec->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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user