(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
-Codechange: Wrap all transparency settings in accessors, hiding the implementation -Change: Clicking "transparent building" menu will toggle Houses And Trees only. The other options can be used in the transparency gui. Initial patch by Smatz (FS#1349), with some rework by BigBB and your humble servant.
This commit is contained in:
@@ -65,6 +65,7 @@
|
||||
#include "vehicle.h"
|
||||
#include "train.h"
|
||||
#include "gui.h"
|
||||
#include "transparency.h"
|
||||
|
||||
static inline TLG GetTLG(TileIndex t)
|
||||
{
|
||||
@@ -195,7 +196,7 @@ void DrawCatenaryOnTunnel(const TileInfo *ti)
|
||||
sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||
BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1,
|
||||
GetTileZ(ti->tile) + sss->z_offset,
|
||||
HASBIT(_transparent_opt, TO_BUILDINGS),
|
||||
IsTransparencySet(TO_BUILDINGS),
|
||||
BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset
|
||||
);
|
||||
}
|
||||
@@ -342,7 +343,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||
|
||||
AddSortableSpriteToDraw(pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE,
|
||||
GetPCPElevation(ti->tile, i),
|
||||
HASBIT(_transparent_opt, TO_BUILDINGS), -1, -1);
|
||||
IsTransparencySet(TO_BUILDINGS), -1, -1);
|
||||
break; /* We already have drawn a pylon, bail out */
|
||||
}
|
||||
}
|
||||
@@ -350,7 +351,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||
}
|
||||
|
||||
/* Don't draw a wire under a low bridge */
|
||||
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
||||
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_BUILDINGS)) {
|
||||
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
|
||||
|
||||
if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
|
||||
@@ -377,7 +378,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||
*/
|
||||
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||
sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset,
|
||||
HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||
IsTransparencySet(TO_BUILDINGS));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,7 +411,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
|
||||
|
||||
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||
sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset,
|
||||
HASBIT(_transparent_opt, TO_BUILDINGS)
|
||||
IsTransparencySet(TO_BUILDINGS)
|
||||
);
|
||||
|
||||
/* Finished with wires, draw pylons */
|
||||
@@ -421,7 +422,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
|
||||
if (HASBIT(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
|
||||
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
|
||||
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
|
||||
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, HASBIT(_transparent_opt, TO_BUILDINGS), -1, -1);
|
||||
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
|
||||
}
|
||||
|
||||
/* need a pylon on the southern end of the bridge */
|
||||
@@ -431,7 +432,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
|
||||
if (HASBIT(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
|
||||
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
|
||||
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
|
||||
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, HASBIT(_transparent_opt, TO_BUILDINGS), -1, -1);
|
||||
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +458,7 @@ void DrawCatenary(const TileInfo *ti)
|
||||
sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||
sss->x_size, sss->y_size, sss->z_size,
|
||||
GetTileMaxZ(ti->tile) + sss->z_offset,
|
||||
HASBIT(_transparent_opt, TO_BUILDINGS)
|
||||
IsTransparencySet(TO_BUILDINGS)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user