mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-02 09:40:35 +00:00
(svn r9931) -Fix: some glitches with catenary and bridges.
This commit is contained in:
parent
932a968af2
commit
78be11be40
@ -249,7 +249,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||
Track bridgetrack = GetBridgeAxis(ti->tile) == AXIS_X ? TRACK_X : TRACK_Y;
|
||||
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
|
||||
|
||||
if ((height <= TilePixelHeight(ti->tile) + TILE_HEIGHT) &&
|
||||
if ((height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) &&
|
||||
(i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) {
|
||||
SETBIT(OverridePCP, i);
|
||||
}
|
||||
@ -289,7 +289,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
||||
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
|
||||
|
||||
if (height <= TilePixelHeight(ti->tile) + TILE_HEIGHT) return;
|
||||
if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
|
||||
}
|
||||
|
||||
/* Drawing of pylons is finished, now draw the wires */
|
||||
|
@ -830,7 +830,7 @@ void DrawTramCatenary(TileInfo *ti, RoadBits tram)
|
||||
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
||||
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
|
||||
|
||||
if (height <= TilePixelHeight(ti->tile) + TILE_HEIGHT) return;
|
||||
if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
|
||||
}
|
||||
|
||||
SpriteID front;
|
||||
@ -851,8 +851,8 @@ void DrawTramCatenary(TileInfo *ti, RoadBits tram)
|
||||
pal = PALETTE_TO_TRANSPARENT;
|
||||
}
|
||||
|
||||
AddSortableSpriteToDraw(back, pal, ti->x, ti->y, 16, 16, 0x20, ti->z);
|
||||
AddSortableSpriteToDraw(front, pal, ti->x, ti->y, 16, 16, 0x20, ti->z);
|
||||
AddSortableSpriteToDraw(back, pal, ti->x, ti->y, 16, 16, 0x1F, ti->z);
|
||||
AddSortableSpriteToDraw(front, pal, ti->x, ti->y, 16, 16, 0x1F, ti->z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -872,7 +872,10 @@ static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay)
|
||||
static const SpriteID back_offsets[6] = { 95, 95, 99, 102, 100, 101 };
|
||||
static const SpriteID front_offsets[6] = { 97, 98, 103, 106, 104, 105 };
|
||||
|
||||
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + tram_offsets[overlay][offset], PAL_NONE, x, y, 16, 16, offset >= 2 ? 1 : 0, z);
|
||||
static const uint size_x[6] = { 11, 16, 16, 16, 16, 16 };
|
||||
static const uint size_y[6] = { 16, 11, 16, 16, 16, 16 };
|
||||
|
||||
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + tram_offsets[overlay][offset], PAL_NONE, x, y, size_x[offset], size_y[offset], offset >= 2 ? 1 : 0, z);
|
||||
|
||||
SpriteID front = SPR_TRAMWAY_BASE + front_offsets[offset];
|
||||
SpriteID back = SPR_TRAMWAY_BASE + back_offsets[offset];
|
||||
@ -883,9 +886,9 @@ static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay)
|
||||
pal = PALETTE_TO_TRANSPARENT;
|
||||
}
|
||||
|
||||
AddSortableSpriteToDraw(back, pal, x, y, 16, 16, 0, z);
|
||||
AddSortableSpriteToDraw(back, pal, x, y, size_x[offset], size_y[offset], 0, z);
|
||||
/* For sloped sprites the bounding box needs to be higher, as the pylons stop on a higher point */
|
||||
AddSortableSpriteToDraw(front, pal, x, y, 16, 16, offset >= 2 ? 0x30 : 0x10, z);
|
||||
AddSortableSpriteToDraw(front, pal, x, y, size_x[offset], size_y[offset], offset >= 2 ? 0x30 : 0x10, z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user