diff options
author | PeterN <peter@fuzzle.org> | 2019-03-09 02:53:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-09 02:53:43 +0000 |
commit | 42046af933ac57ab08c83d26bd94e60a253bab66 (patch) | |
tree | a67c5d29ac26dd69e6a846cffbd6932535349ecc /src/rail_cmd.cpp | |
parent | 7e7563f15f999cac5c140cb93e917905a9450df4 (diff) | |
download | openttd-42046af933ac57ab08c83d26bd94e60a253bab66.tar.xz |
Add: Add flag and railtype sprite type to draw pre-combined ground sprites. (#7231)
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r-- | src/rail_cmd.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 3230d9bf2..aa4e7ab55 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2107,12 +2107,25 @@ static void DrawTrackBitsOverlay(TileInfo *ti, TrackBits track, const RailtypeIn DrawGroundSprite(image, PAL_NONE); } + bool no_combine = ti->tileh == SLOPE_FLAT && HasBit(rti->flags, RTF_NO_SPRITE_COMBINE); SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY); - SpriteID ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND); + SpriteID ground = GetCustomRailSprite(rti, ti->tile, no_combine ? RTSG_GROUND_COMPLETE : RTSG_GROUND); TrackBits pbs = _settings_client.gui.show_track_reservation ? GetRailReservationTrackBits(ti->tile) : TRACK_BIT_NONE; if (track == TRACK_BIT_NONE) { /* Half-tile foundation, no track here? */ + } else if (no_combine) { + /* Use trackbits as direct index from ground sprite, subtract 1 + * because there is no sprite for no bits. */ + DrawGroundSprite(ground + track - 1, PAL_NONE); + + /* Draw reserved track bits */ + if (pbs & TRACK_BIT_X) DrawGroundSprite(overlay + RTO_X, PALETTE_CRASH); + if (pbs & TRACK_BIT_Y) DrawGroundSprite(overlay + RTO_Y, PALETTE_CRASH); + if (pbs & TRACK_BIT_UPPER) DrawTrackSprite(overlay + RTO_N, PALETTE_CRASH, ti, SLOPE_N); + if (pbs & TRACK_BIT_LOWER) DrawTrackSprite(overlay + RTO_S, PALETTE_CRASH, ti, SLOPE_S); + if (pbs & TRACK_BIT_RIGHT) DrawTrackSprite(overlay + RTO_E, PALETTE_CRASH, ti, SLOPE_E); + if (pbs & TRACK_BIT_LEFT) DrawTrackSprite(overlay + RTO_W, PALETTE_CRASH, ti, SLOPE_W); } else if (ti->tileh == SLOPE_NW && track == TRACK_BIT_Y) { DrawGroundSprite(ground + RTO_SLOPE_NW, PAL_NONE); if (pbs != TRACK_BIT_NONE) DrawGroundSprite(overlay + RTO_SLOPE_NW, PALETTE_CRASH); |