Fix drawing of custom road stop ground sprites on map

pull/374/head
Jonathan G Rennison 2 years ago
parent c503bd32c0
commit 1dee6d2796

@ -3415,6 +3415,8 @@ draw_default_foundation:
}
}
bool draw_ground = false;
if (IsBuoy(ti->tile)) {
DrawWaterClassGround(ti);
SpriteID sprite = GetCanalSprite(CF_BUOY, ti->tile);
@ -3459,6 +3461,10 @@ draw_default_foundation:
ground_relocation += rti->fallback_railtype;
}
draw_ground = true;
}
if (draw_ground && !IsAnyRoadStop(ti->tile)) {
SpriteID image = t->ground.sprite;
PaletteID pal = t->ground.pal;
RailTrackOffset overlay_offset;
@ -3506,21 +3512,30 @@ draw_default_foundation:
t = dts;
}
/* Draw ground sprite */
if (draw_ground) {
SpriteID image = t->ground.sprite;
PaletteID pal = t->ground.pal;
image += HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? ground_relocation : total_offset;
if (HasBit(pal, SPRITE_MODIFIER_CUSTOM_SPRITE)) pal += ground_relocation;
DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette));
}
if (IsDriveThroughStopTile(ti->tile)) {
if (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);
}
DisallowedRoadDirections drd = GetDriveThroughStopDisallowedRoadDirections(ti->tile);
if (drd != DRD_NONE) {
DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((axis == AXIS_X) ? 0 : 3), PAL_NONE, 8, 8, 0);
}
DisallowedRoadDirections drd = GetDriveThroughStopDisallowedRoadDirections(ti->tile);
if (drd != DRD_NONE) {
DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((axis == AXIS_X) ? 0 : 3), PAL_NONE, 8, 8, 0);
}
} else {
/* 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 || (stopspec->draw_mode & ROADSTOP_DRAW_MODE_ROAD) != 0) && road_rti->UsesOverlay()) {
SpriteID ground = GetCustomRoadSprite(road_rti, ti->tile, ROTSG_ROADSTOP);
DrawGroundSprite(ground + dir, PAL_NONE);
}

Loading…
Cancel
Save