Fix drawing of custom road stop ground sprites on map
This commit is contained in:
@@ -3415,6 +3415,8 @@ draw_default_foundation:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool draw_ground = false;
|
||||||
|
|
||||||
if (IsBuoy(ti->tile)) {
|
if (IsBuoy(ti->tile)) {
|
||||||
DrawWaterClassGround(ti);
|
DrawWaterClassGround(ti);
|
||||||
SpriteID sprite = GetCanalSprite(CF_BUOY, ti->tile);
|
SpriteID sprite = GetCanalSprite(CF_BUOY, ti->tile);
|
||||||
@@ -3459,6 +3461,10 @@ draw_default_foundation:
|
|||||||
ground_relocation += rti->fallback_railtype;
|
ground_relocation += rti->fallback_railtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
draw_ground = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (draw_ground && !IsAnyRoadStop(ti->tile)) {
|
||||||
SpriteID image = t->ground.sprite;
|
SpriteID image = t->ground.sprite;
|
||||||
PaletteID pal = t->ground.pal;
|
PaletteID pal = t->ground.pal;
|
||||||
RailTrackOffset overlay_offset;
|
RailTrackOffset overlay_offset;
|
||||||
@@ -3506,21 +3512,30 @@ draw_default_foundation:
|
|||||||
t = dts;
|
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 (IsDriveThroughStopTile(ti->tile)) {
|
||||||
if (stopspec == nullptr || (stopspec->draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) != 0) {
|
if (stopspec == nullptr || (stopspec->draw_mode & ROADSTOP_DRAW_MODE_OVERLAY) != 0) {
|
||||||
uint sprite_offset = axis == AXIS_X ? 1 : 0;
|
uint sprite_offset = axis == AXIS_X ? 1 : 0;
|
||||||
DrawRoadOverlays(ti, PAL_NONE, road_rti, tram_rti, sprite_offset, sprite_offset);
|
DrawRoadOverlays(ti, PAL_NONE, road_rti, tram_rti, sprite_offset, sprite_offset);
|
||||||
|
}
|
||||||
|
|
||||||
DisallowedRoadDirections drd = GetDriveThroughStopDisallowedRoadDirections(ti->tile);
|
DisallowedRoadDirections drd = GetDriveThroughStopDisallowedRoadDirections(ti->tile);
|
||||||
if (drd != DRD_NONE) {
|
if (drd != DRD_NONE) {
|
||||||
DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((axis == AXIS_X) ? 0 : 3), PAL_NONE, 8, 8, 0);
|
DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((axis == AXIS_X) ? 0 : 3), PAL_NONE, 8, 8, 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* Non-drivethrough road stops are only valid for roads. */
|
/* Non-drivethrough road stops are only valid for roads. */
|
||||||
assert_tile(road_rt != INVALID_ROADTYPE && tram_rt == INVALID_ROADTYPE, ti->tile);
|
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);
|
SpriteID ground = GetCustomRoadSprite(road_rti, ti->tile, ROTSG_ROADSTOP);
|
||||||
DrawGroundSprite(ground + dir, PAL_NONE);
|
DrawGroundSprite(ground + dir, PAL_NONE);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user