mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-19 15:25:39 +00:00
(svn r3902) When drawing a bridge middle part get the bridge axis only once instead of again and again
This commit is contained in:
parent
385326943d
commit
13ed895336
@ -999,6 +999,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||||||
AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 7, ti->z);
|
AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 7, ti->z);
|
||||||
} else {
|
} else {
|
||||||
// bridge middle part.
|
// bridge middle part.
|
||||||
|
Axis axis = GetBridgeAxis(ti->tile);
|
||||||
uint z;
|
uint z;
|
||||||
int x,y;
|
int x,y;
|
||||||
|
|
||||||
@ -1007,21 +1008,27 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||||||
|
|
||||||
// draw foundation?
|
// draw foundation?
|
||||||
if (ti->tileh) {
|
if (ti->tileh) {
|
||||||
int f = _bridge_foundations[ti->map5&1][ti->tileh];
|
int f = _bridge_foundations[axis][ti->tileh];
|
||||||
if (f) DrawFoundation(ti, f);
|
if (f) DrawFoundation(ti, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetTransportTypeUnderBridge(ti->tile) == TRANSPORT_RAIL) {
|
if (GetTransportTypeUnderBridge(ti->tile) == TRANSPORT_RAIL) {
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(GB(_m[ti->tile].m3, 0, 4));
|
const RailtypeInfo *rti = GetRailTypeInfo(GB(_m[ti->tile].m3, 0, 4));
|
||||||
|
|
||||||
image = SPR_RAIL_TRACK_Y + (ti->map5 & 1);
|
if (ti->tileh == 0) {
|
||||||
if (ti->tileh != 0) image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1];
|
image = (axis == AXIS_X ? SPR_RAIL_TRACK_Y : SPR_RAIL_TRACK_X);
|
||||||
|
} else {
|
||||||
|
image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1];
|
||||||
|
}
|
||||||
image += rti->total_offset;
|
image += rti->total_offset;
|
||||||
if (ice) image += rti->snow_offset;
|
if (ice) image += rti->snow_offset;
|
||||||
} else {
|
} else {
|
||||||
// road
|
// road
|
||||||
image = SPR_ROAD_Y + (ti->map5 & 1);
|
if (ti->tileh == 0) {
|
||||||
if (ti->tileh != 0) image = _road_sloped_sprites[ti->tileh - 1] + 0x53F;
|
image = _road_sloped_sprites[ti->tileh - 1] + 0x53F;
|
||||||
|
} else {
|
||||||
|
image = (axis == AXIS_X ? SPR_ROAD_Y : SPR_ROAD_X);
|
||||||
|
}
|
||||||
if (ice) image += 19;
|
if (ice) image += 19;
|
||||||
}
|
}
|
||||||
DrawGroundSprite(image);
|
DrawGroundSprite(image);
|
||||||
@ -1039,8 +1046,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cope for the direction of the bridge */
|
if (axis != AXIS_X) base_offset += 4;
|
||||||
if (HASBIT(ti->map5, 0)) base_offset += 4;
|
|
||||||
|
|
||||||
/* base_offset needs to be 0 due to the structure of the sprite table see table/bridge_land.h */
|
/* base_offset needs to be 0 due to the structure of the sprite table see table/bridge_land.h */
|
||||||
assert( (base_offset & 0x03) == 0x00);
|
assert( (base_offset & 0x03) == 0x00);
|
||||||
@ -1052,7 +1058,12 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||||||
// draw rail or road component
|
// draw rail or road component
|
||||||
image = b[0];
|
image = b[0];
|
||||||
if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
|
if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
|
||||||
AddSortableSpriteToDraw(image, ti->x, ti->y, (ti->map5&1)?11:16, (ti->map5&1)?16:11, 1, z);
|
AddSortableSpriteToDraw(
|
||||||
|
image, ti->x, ti->y,
|
||||||
|
axis == AXIS_X ? 16 : 11,
|
||||||
|
axis == AXIS_X ? 11 : 16,
|
||||||
|
1, z
|
||||||
|
);
|
||||||
|
|
||||||
x = ti->x;
|
x = ti->x;
|
||||||
y = ti->y;
|
y = ti->y;
|
||||||
@ -1060,12 +1071,12 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||||||
if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
|
if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
|
||||||
|
|
||||||
// draw roof, the component of the bridge which is logically between the vehicle and the camera
|
// draw roof, the component of the bridge which is logically between the vehicle and the camera
|
||||||
if (ti->map5 & 1) {
|
if (axis == AXIS_X) {
|
||||||
x += 12;
|
|
||||||
if (image & SPRITE_MASK) AddSortableSpriteToDraw(image, x,y, 1, 16, 0x28, z);
|
|
||||||
} else {
|
|
||||||
y += 12;
|
y += 12;
|
||||||
if (image & SPRITE_MASK) AddSortableSpriteToDraw(image, x,y, 16, 1, 0x28, z);
|
if (image & SPRITE_MASK) AddSortableSpriteToDraw(image, x, y, 16, 1, 0x28, z);
|
||||||
|
} else {
|
||||||
|
x += 12;
|
||||||
|
if (image & SPRITE_MASK) AddSortableSpriteToDraw(image, x, y, 1, 16, 0x28, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ti->z + 5 == z) {
|
if (ti->z + 5 == z) {
|
||||||
|
Loading…
Reference in New Issue
Block a user