summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-10 15:53:26 +0000
committersmatz <smatz@openttd.org>2008-02-10 15:53:26 +0000
commit8a768652c89b068c405c436ffe093d7b08d6c9b9 (patch)
treeda866684e6ccec2fb5f2ba272492546d9e3590b4 /src
parent4e839aacf650f65cd8aeeece91fa038b3c68ffdb (diff)
downloadopenttd-8a768652c89b068c405c436ffe093d7b08d6c9b9.tar.xz
(svn r12103) -Feature(tte): separate catenary transparency settings from building transparency settings
Diffstat (limited to 'src')
-rw-r--r--src/elrail.cpp16
-rw-r--r--src/lang/english.txt3
-rw-r--r--src/road_cmd.cpp6
-rw-r--r--src/settings.cpp4
-rw-r--r--src/transparency.h3
-rw-r--r--src/transparency_gui.cpp12
-rw-r--r--src/tunnelbridge_cmd.cpp6
7 files changed, 27 insertions, 23 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index fcd8a3df6..b93448020 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -189,7 +189,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,
- IsTransparencySet(TO_BUILDINGS),
+ IsTransparencySet(TO_CATENARY),
BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset
);
}
@@ -336,7 +336,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),
- IsTransparencySet(TO_BUILDINGS), -1, -1);
+ IsTransparencySet(TO_CATENARY), -1, -1);
break; /* We already have drawn a pylon, bail out */
}
}
@@ -344,7 +344,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
}
/* Don't draw a wire under a low bridge */
- if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_BUILDINGS)) {
+ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) {
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
@@ -371,7 +371,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,
- IsTransparencySet(TO_BUILDINGS));
+ IsTransparencySet(TO_CATENARY));
}
}
}
@@ -404,7 +404,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,
- IsTransparencySet(TO_BUILDINGS)
+ IsTransparencySet(TO_CATENARY)
);
/* Finished with wires, draw pylons */
@@ -415,7 +415,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, IsTransparencySet(TO_BUILDINGS), -1, -1);
+ AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
}
/* need a pylon on the southern end of the bridge */
@@ -425,7 +425,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, IsTransparencySet(TO_BUILDINGS), -1, -1);
+ AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1);
}
}
@@ -451,7 +451,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,
- IsTransparencySet(TO_BUILDINGS)
+ IsTransparencySet(TO_CATENARY)
);
return;
}
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 1000fbbc9..2785e2067 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -3341,10 +3341,11 @@ STR_TRANSPARENT_SIGNS_DESC :{BLACK}Toggle t
STR_TRANSPARENT_TREES_DESC :{BLACK}Toggle transparency for trees. CTRL+click to lock.
STR_TRANSPARENT_HOUSES_DESC :{BLACK}Toggle transparency for houses. CTRL+click to lock.
STR_TRANSPARENT_INDUSTRIES_DESC :{BLACK}Toggle transparency for industries. CTRL+click to lock.
-STR_TRANSPARENT_BUILDINGS_DESC :{BLACK}Toggle transparency for buildables like stations, depots, waypoints and catenary. CTRL+click to lock.
+STR_TRANSPARENT_BUILDINGS_DESC :{BLACK}Toggle transparency for buildables like stations, depots and waypoints. CTRL+click to lock.
STR_TRANSPARENT_BRIDGES_DESC :{BLACK}Toggle transparency for bridges. CTRL+click to lock.
STR_TRANSPARENT_STRUCTURES_DESC :{BLACK}Toggle transparency for structures like lighthouses and antennas. CTRL+click to lock.
STR_TRANSPARENT_LOADING_DESC :{BLACK}Toggle transparency for loading indicators. CTRL+click to lock.
+STR_TRANSPARENT_CATENARY_DESC :{BLACK}Toggle transparency for catenary. CTRL+click to lock.
STR_PERCENT_UP_SMALL :{TINYFONT}{WHITE}{NUM}%{UPARROW}
STR_PERCENT_UP :{WHITE}{NUM}%{UPARROW}
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index f0957acb0..e2480025b 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -945,7 +945,7 @@ static bool AlwaysDrawUnpavedRoads(TileIndex tile, Roadside roadside)
void DrawTramCatenary(TileInfo *ti, RoadBits tram)
{
/* Don't draw the catenary under a low bridge */
- if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_BUILDINGS)) {
+ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) {
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
@@ -962,8 +962,8 @@ void DrawTramCatenary(TileInfo *ti, RoadBits tram)
front = SPR_TRAMWAY_BASE + _road_frontwire_sprites_1[tram];
}
- AddSortableSpriteToDraw(back, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_BUILDINGS));
- AddSortableSpriteToDraw(front, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_BUILDINGS));
+ AddSortableSpriteToDraw(back, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_CATENARY));
+ AddSortableSpriteToDraw(front, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparencySet(TO_CATENARY));
}
/**
diff --git a/src/settings.cpp b/src/settings.cpp
index 8e88c5e8c..6e4aba91a 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1282,8 +1282,8 @@ static const SettingDescGlobVarList _misc_settings[] = {
#endif
SDTG_VAR("sprite_cache_size",SLE_UINT, S, 0, _sprite_cache_size, 4, 1, 64, 0, STR_NULL, NULL),
SDTG_VAR("player_face", SLE_UINT32, S, 0, _player_face, 0,0,0xFFFFFFFF,0, STR_NULL, NULL),
- SDTG_VAR("transparency_options", SLE_UINT8, S, 0, _transparency_opt, 0, 0,0xFF,0, STR_NULL, NULL),
- SDTG_VAR("transparency_locks", SLE_UINT8, S, 0, _transparency_lock, 0, 0,0xFF,0, STR_NULL, NULL),
+ SDTG_VAR("transparency_options", SLE_UINT, S, 0, _transparency_opt, 0, 0,0xFF,0, STR_NULL, NULL),
+ SDTG_VAR("transparency_locks", SLE_UINT, S, 0, _transparency_lock, 0, 0,0xFF,0, STR_NULL, NULL),
SDTG_END()
};
diff --git a/src/transparency.h b/src/transparency.h
index 8f4dbbeeb..c0de807ce 100644
--- a/src/transparency.h
+++ b/src/transparency.h
@@ -22,11 +22,12 @@ enum TransparencyOption {
TO_BUILDINGS, ///< player buildings - depots, stations, HQ, ...
TO_BRIDGES, ///< bridges
TO_STRUCTURES, ///< unmovable structures
+ TO_CATENARY, ///< catenary
TO_LOADING, ///< loading indicators
TO_END,
};
-typedef byte TransparencyOptionBits; ///< transparency option bits
+typedef uint TransparencyOptionBits; ///< transparency option bits
extern TransparencyOptionBits _transparency_opt;
extern TransparencyOptionBits _transparency_lock;
diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp
index b33003f9e..da73b021e 100644
--- a/src/transparency_gui.cpp
+++ b/src/transparency_gui.cpp
@@ -22,6 +22,7 @@ enum TransparencyToolbarWidgets{
TTW_WIDGET_BUILDINGS, ///< Make player buildings and structures transparent
TTW_WIDGET_BRIDGES, ///< Make bridges transparent
TTW_WIDGET_STRUCTURES, ///< Make unmovable structures transparent
+ TTW_WIDGET_CATENARY, ///< Make catenary transparent
TTW_WIDGET_LOADING, ///< Make loading indicators transperent
TTW_WIDGET_END, ///< End of toggle buttons
};
@@ -43,7 +44,7 @@ static void TransparencyToolbWndProc(Window *w, WindowEvent *e)
break;
case WE_CLICK:
- if (e->we.click.widget >= TTW_WIDGET_SIGNS) {
+ if (e->we.click.widget >= TTW_WIDGET_SIGNS && e->we.click.widget < TTW_WIDGET_END) {
if (_ctrl_pressed) {
/* toggle the bit of the transparencies lock variable */
ToggleTransparencyLock((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS));
@@ -61,8 +62,8 @@ static void TransparencyToolbWndProc(Window *w, WindowEvent *e)
static const Widget _transparency_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, RESIZE_NONE, 7, 11, 184, 0, 13, STR_TRANSPARENCY_TOOLB, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{WWT_STICKYBOX, RESIZE_NONE, 7, 185, 196, 0, 13, STR_NULL, STR_STICKY_BUTTON},
+{ WWT_CAPTION, RESIZE_NONE, 7, 11, 206, 0, 13, STR_TRANSPARENCY_TOOLB, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{WWT_STICKYBOX, RESIZE_NONE, 7, 207, 218, 0, 13, STR_NULL, STR_STICKY_BUTTON},
/* transparency widgets:
* transparent signs, trees, houses, industries, player's buildings, bridges, unmovable structures and loading indicators */
@@ -73,13 +74,14 @@ static const Widget _transparency_widgets[] = {
{ WWT_IMGBTN, RESIZE_NONE, 7, 88, 109, 14, 35, SPR_IMG_COMPANY_LIST, STR_TRANSPARENT_BUILDINGS_DESC},
{ WWT_IMGBTN, RESIZE_NONE, 7, 110, 152, 14, 35, SPR_IMG_BRIDGE, STR_TRANSPARENT_BRIDGES_DESC},
{ WWT_IMGBTN, RESIZE_NONE, 7, 153, 174, 14, 35, SPR_IMG_TRANSMITTER, STR_TRANSPARENT_STRUCTURES_DESC},
-{ WWT_IMGBTN, RESIZE_NONE, 7, 175, 196, 14, 35, SPR_IMG_TRAINLIST, STR_TRANSPARENT_LOADING_DESC},
+{ WWT_IMGBTN, RESIZE_NONE, 7, 175, 196, 14, 35, SPR_BUILD_X_ELRAIL, STR_TRANSPARENT_CATENARY_DESC},
+{ WWT_IMGBTN, RESIZE_NONE, 7, 197, 218, 14, 35, SPR_IMG_TRAINLIST, STR_TRANSPARENT_LOADING_DESC},
{ WIDGETS_END},
};
static const WindowDesc _transparency_desc = {
- WDP_ALIGN_TBR, 58+36, 197, 36, 197, 36,
+ WDP_ALIGN_TBR, 58+36, 219, 36, 219, 36,
WC_TRANSPARENCY_TOOLBAR, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_transparency_widgets,
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 56eca808a..058f0c2a4 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -762,14 +762,14 @@ static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay)
* The bounding boxes here are the same as for bridge front/roof */
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + tram_offsets[overlay][offset], PAL_NONE, x, y, size_x[offset], size_y[offset], 0x28, z, IsTransparencySet(TO_BRIDGES));
- AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + back_offsets[offset], PAL_NONE, x, y, size_x[offset], size_y[offset], 0x28, z, IsTransparencySet(TO_BUILDINGS));
+ AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + back_offsets[offset], PAL_NONE, x, y, size_x[offset], size_y[offset], 0x28, z, IsTransparencySet(TO_CATENARY));
/* Start a new SpriteCombine for the front part */
EndSpriteCombine();
StartSpriteCombine();
/* For sloped sprites the bounding box needs to be higher, as the pylons stop on a higher point */
- AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + front_offsets[offset], PAL_NONE, x, y, size_x[offset] + front_bb_offset_x[offset], size_y[offset] + front_bb_offset_y[offset], 0x28, z, IsTransparencySet(TO_BUILDINGS), front_bb_offset_x[offset], front_bb_offset_y[offset]);
+ AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + front_offsets[offset], PAL_NONE, x, y, size_x[offset] + front_bb_offset_x[offset], size_y[offset] + front_bb_offset_y[offset], 0x28, z, IsTransparencySet(TO_CATENARY), front_bb_offset_x[offset], front_bb_offset_y[offset]);
}
/**
@@ -832,7 +832,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
catenary = true;
StartSpriteCombine();
- AddSortableSpriteToDraw(SPR_TRAMWAY_TUNNEL_WIRES + dir, PAL_NONE, ti->x, ti->y, BB_data[10], BB_data[11], TILE_HEIGHT, ti->z, IsTransparencySet(TO_BUILDINGS), BB_data[8], BB_data[9], BB_Z_SEPARATOR);
+ AddSortableSpriteToDraw(SPR_TRAMWAY_TUNNEL_WIRES + dir, PAL_NONE, ti->x, ti->y, BB_data[10], BB_data[11], TILE_HEIGHT, ti->z, IsTransparencySet(TO_CATENARY), BB_data[8], BB_data[9], BB_Z_SEPARATOR);
}
} else if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) {
DrawCatenary(ti);