|
@@ -897,64 +897,64 @@ static void DrawBridgePillars(PalSpriteI
|
|
|
|
|
|
uint GetBridgeFoundation(Slope tileh, Axis axis)
|
|
|
{
|
|
|
uint i;
|
|
|
|
|
|
if (HASBIT(BRIDGE_FULL_LEVELED_FOUNDATION, tileh)) return tileh;
|
|
|
|
|
|
// inclined sloped building
|
|
|
switch (tileh) {
|
|
|
case SLOPE_W:
|
|
|
case SLOPE_STEEP_W: i = 0; break;
|
|
|
case SLOPE_S:
|
|
|
case SLOPE_STEEP_S: i = 2; break;
|
|
|
case SLOPE_E:
|
|
|
case SLOPE_STEEP_E: i = 4; break;
|
|
|
case SLOPE_N:
|
|
|
case SLOPE_STEEP_N: i = 6; break;
|
|
|
default: return 0;
|
|
|
}
|
|
|
if (axis != AXIS_X) ++i;
|
|
|
return i + 15;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Draws a tunnel of bridge tile.
|
|
|
* For tunnels, this is rather simple, as you only needa draw the entrance.
|
|
|
* Bridges are a bit more complex. base_offset is where the sprite selection comes into play
|
|
|
* and it works a bit like a bitmask.<p> For bridge heads:
|
|
|
* <ul><li>Bit 0: direction</li>
|
|
|
* <li>Bit 1: northern or southern heads</li>
|
|
|
* <li>Bit 2: Set if the bridge head is sloped</li>
|
|
|
* <li>Bit 3 and more: Railtype Specific subset</li>
|
|
|
* </ul>
|
|
|
* For middle parts:
|
|
|
* <ul><li>Bits 0-1: need to be 0</li>
|
|
|
* <li>Bit 2: direction</li>
|
|
|
* <li>Bit 3 and above: Railtype Specific subset</li>
|
|
|
* </ul>
|
|
|
* Please note that in this code, "roads" are treated as railtype 1, whilst the real railtypes are 0, 2 and 3
|
|
|
*/
|
|
|
* Draws a tunnel of bridge tile.
|
|
|
* For tunnels, this is rather simple, as you only needa draw the entrance.
|
|
|
* Bridges are a bit more complex. base_offset is where the sprite selection comes into play
|
|
|
* and it works a bit like a bitmask.<p> For bridge heads:
|
|
|
* <ul><li>Bit 0: direction</li>
|
|
|
* <li>Bit 1: northern or southern heads</li>
|
|
|
* <li>Bit 2: Set if the bridge head is sloped</li>
|
|
|
* <li>Bit 3 and more: Railtype Specific subset</li>
|
|
|
* </ul>
|
|
|
* For middle parts:
|
|
|
* <ul><li>Bits 0-1: need to be 0</li>
|
|
|
* <li>Bit 2: direction</li>
|
|
|
* <li>Bit 3 and above: Railtype Specific subset</li>
|
|
|
* </ul>
|
|
|
* Please note that in this code, "roads" are treated as railtype 1, whilst the real railtypes are 0, 2 and 3
|
|
|
*/
|
|
|
static void DrawTile_TunnelBridge(TileInfo *ti)
|
|
|
{
|
|
|
uint32 image;
|
|
|
const PalSpriteID *b;
|
|
|
bool ice = _m[ti->tile].m4 & 0x80;
|
|
|
|
|
|
if (IsTunnel(ti->tile)) {
|
|
|
if (GetTunnelTransportType(ti->tile) == TRANSPORT_RAIL) {
|
|
|
image = GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.tunnel;
|
|
|
} else {
|
|
|
image = SPR_TUNNEL_ENTRY_REAR_ROAD;
|
|
|
}
|
|
|
|
|
|
if (ice) image += 32;
|
|
|
|
|
|
image += GetTunnelDirection(ti->tile) * 2;
|
|
|
DrawGroundSprite(image);
|
|
|
if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
|
|
|
|
|
|
AddSortableSpriteToDraw(image+1, ti->x + TILE_SIZE - 1, ti->y + TILE_SIZE - 1, 1, 1, 8, (byte)ti->z);
|
|
|
} else if (IsBridge(ti->tile)) { // XXX is this necessary?
|
|
|
int base_offset;
|
|
|
|
|
|
if (GetBridgeTransportType(ti->tile) == TRANSPORT_RAIL) {
|