(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
authorpeter1138
Thu, 05 Apr 2007 07:49:04 +0000
changeset 6923 6913c8a82cc0
parent 6922 0f15ee017610
child 6924 a1371365397e
(svn r9563) -Feature: Add more finer control to transparency options, including a new toolbar, accessible from the map menu or Ctrl X. Patch by Wolf01.
projects/openttd.vcproj
projects/openttd_vs80.vcproj
source.list
src/elrail.cpp
src/industry_cmd.cpp
src/lang/english.txt
src/main_gui.cpp
src/newgrf_house.cpp
src/news_gui.cpp
src/openttd.cpp
src/openttd.h
src/rail_cmd.cpp
src/road_cmd.cpp
src/settings.cpp
src/station_cmd.cpp
src/town_cmd.cpp
src/transparency_gui.cpp
src/tree_cmd.cpp
src/tunnelbridge_cmd.cpp
src/unmovable_cmd.cpp
src/variables.h
src/viewport.cpp
src/water_cmd.cpp
--- a/projects/openttd.vcproj	Wed Apr 04 14:21:46 2007 +0000
+++ b/projects/openttd.vcproj	Thu Apr 05 07:49:04 2007 +0000
@@ -757,6 +757,9 @@
 				RelativePath=".\..\src\train_gui.cpp">
 			</File>
 			<File
+				RelativePath=".\..\src\transparency_gui.cpp">
+			</File>
+			<File
 				RelativePath=".\..\src\vehicle_gui.cpp">
 			</File>
 		</Filter>
--- a/projects/openttd_vs80.vcproj	Wed Apr 04 14:21:46 2007 +0000
+++ b/projects/openttd_vs80.vcproj	Thu Apr 05 07:49:04 2007 +0000
@@ -784,7 +784,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\src\direction.h"
+				RelativePath=".\..\src\direction.h"
 				>
 			</File>
 			<File
@@ -1236,6 +1236,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\transparency_gui.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\vehicle_gui.cpp"
 				>
 			</File>
--- a/source.list	Wed Apr 04 14:21:46 2007 +0000
+++ b/source.list	Thu Apr 05 07:49:04 2007 +0000
@@ -220,6 +220,7 @@
 terraform_gui.cpp
 town_gui.cpp
 train_gui.cpp
+transparency_gui.cpp
 vehicle_gui.cpp
 
 # Landscape
--- a/src/elrail.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/elrail.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -269,7 +269,14 @@
 						continue; /* No neighbour, go looking for a better position */
 					}
 
-					AddSortableSpriteToDraw(pylons_normal[temp], PAL_NONE, x, y, 1, 1, 10,
+					SpriteID img = pylons_normal[temp];
+					SpriteID pal = PAL_NONE;
+					if (_transparent_opt & TO_BUILDINGS) {
+						SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+						pal = PALETTE_TO_TRANSPARENT;
+					}
+
+					AddSortableSpriteToDraw(img, pal, x, y, 1, 1, 10,
 							GetSlopeZ(ti->x + x_pcp_offsets[i], ti->y + y_pcp_offsets[i]));
 					break; /* We already have drawn a pylon, bail out */
 				}
@@ -278,7 +285,7 @@
 	}
 
 	/* Don't draw a wire under a low bridge */
-	if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !(_display_opt & DO_TRANS_BUILDINGS)) {
+	if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !(_transparent_opt & TO_BUILDINGS)) {
 		uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
 
 		if (height <= TilePixelHeight(ti->tile) + TILE_HEIGHT) return;
@@ -307,7 +314,14 @@
 			assert(!IsSteepSlope(tileh[TS_HOME]));
 			sss = &CatenarySpriteData[Wires[tileh_selector][t][PCPconfig]];
 
-			AddSortableSpriteToDraw( sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+			SpriteID img = sss->image;
+			SpriteID pal = PAL_NONE;
+			if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
+				SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+				pal = PALETTE_TO_TRANSPARENT;
+			}
+
+			AddSortableSpriteToDraw(img, pal, ti->x + sss->x_offset, ti->y + sss->y_offset,
 				sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + min(sss->x_offset, TILE_SIZE - 1), ti->y + min(sss->y_offset, TILE_SIZE - 1)) + sss->z_offset);
 		}
 	}
@@ -339,7 +353,14 @@
 
 	height = GetBridgeHeight(end);
 
-	AddSortableSpriteToDraw( sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+	SpriteID img = sss->image;
+	SpriteID pal = PAL_NONE;
+	if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
+		SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+		pal = PALETTE_TO_TRANSPARENT;
+	}
+
+	AddSortableSpriteToDraw(img, pal, ti->x + sss->x_offset, ti->y + sss->y_offset,
 		sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset
 	);
 
@@ -347,18 +368,26 @@
 	/* every other tile needs a pylon on the northern end */
 	if (num % 2) {
 		if (axis == AXIS_X) {
-			AddSortableSpriteToDraw(pylons_bridge[0 + HASBIT(tlg, 0)], PAL_NONE, ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height);
+			img = pylons_bridge[0 + HASBIT(tlg, 0)];
+			if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+			AddSortableSpriteToDraw(img, pal, ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height);
 		} else {
-			AddSortableSpriteToDraw(pylons_bridge[2 + HASBIT(tlg, 1)], PAL_NONE, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y, 1, 1, 10, height);
+			img = pylons_bridge[2 + HASBIT(tlg, 1)];
+			if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+			AddSortableSpriteToDraw(img, pal, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y, 1, 1, 10, height);
 		}
 	}
 
 	/* need a pylon on the southern end of the bridge */
 	if (DistanceMax(ti->tile, start) == length) {
 		if (axis == AXIS_X) {
-			AddSortableSpriteToDraw(pylons_bridge[0 + HASBIT(tlg, 0)], PAL_NONE, ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height);
+			img = pylons_bridge[0 + HASBIT(tlg, 0)];
+			if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+			AddSortableSpriteToDraw(img, pal, ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height);
 		} else {
-			AddSortableSpriteToDraw(pylons_bridge[2 + HASBIT(tlg, 1)], PAL_NONE, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, height);
+			img = pylons_bridge[2 + HASBIT(tlg, 1)];
+			if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+			AddSortableSpriteToDraw(img, pal, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, height);
 		}
 	}
 }
@@ -379,8 +408,15 @@
 			if (IsRailDepot(ti->tile)) {
 				const SortableSpriteStruct *sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
 
+				SpriteID img = sss->image;
+				SpriteID pal = PAL_NONE;
+				if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
+					SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
+					pal = PALETTE_TO_TRANSPARENT;
+				}
+
 				AddSortableSpriteToDraw(
-					sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+					img, pal, 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
 				);
--- a/src/industry_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/industry_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -259,7 +259,7 @@
 	/* Add industry on top of the ground? */
 	image = dits->building.sprite;
 	if (image != 0) {
-		if (_display_opt & DO_TRANS_BUILDINGS) {
+		if (HASBIT(_transparent_opt, TO_INDUSTRIES)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else {
@@ -274,7 +274,7 @@
 			dits->dz,
 			z);
 
-		if (_display_opt & DO_TRANS_BUILDINGS) return;
+		if (HASBIT(_transparent_opt, TO_INDUSTRIES)) return;
 	}
 
 	{
--- a/src/lang/english.txt	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/lang/english.txt	Thu Apr 05 07:49:04 2007 +0000
@@ -802,6 +802,7 @@
 STR_02DE_MAP_OF_WORLD                                           :Map of world
 STR_EXTRA_VIEW_PORT                                             :Extra viewport
 STR_SIGN_LIST                                                   :Sign list
+STR_TRANSPARENCY_OPTIONS                                        :Transparency options
 STR_02DF_TOWN_DIRECTORY                                         :Town directory
 STR_TOWN_POPULATION                                             :{BLACK}World population: {COMMA}
 STR_EXTRA_VIEW_PORT_TITLE                                       :{WHITE}Viewport {COMMA}
@@ -3154,3 +3155,12 @@
 STR_FEEDER_CARGO_VALUE                                          :{BLACK}Transfer Credits: {LTBLUE}{CURRENCY}
 STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD                            :{WHITE}...this is a town owned road
 STR_DRIVE_THROUGH_ERROR_DIRECTION                               :{WHITE}...road facing in the wrong direction
+
+STR_TRANSPARENCY_TOOLB                                          :{WHITE}Transparency Options
+STR_TRANSPARENT_SIGNS_DESC                                      :{BLACK}Toggle transparency for station signs
+STR_TRANSPARENT_TREES_DESC                                      :{BLACK}Toggle transparency for trees
+STR_TRANSPARENT_HOUSES_DESC                                     :{BLACK}Toggle transparency for houses
+STR_TRANSPARENT_INDUSTRIES_DESC                                 :{BLACK}Toggle transparency for industries
+STR_TRANSPARENT_BUILDINGS_DESC                                  :{BLACK}Toggle transparency for buildables like stations, depots, waypoints and catenary
+STR_TRANSPARENT_BRIDGES_DESC                                    :{BLACK}Toggle transparency for bridges
+STR_TRANSPARENT_STRUCTURES_DESC                                 :{BLACK}Toggle transparency for structures like lighthouses and antennas, maybe in future for eyecandy
--- a/src/main_gui.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/main_gui.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -37,6 +37,7 @@
 #include "settings.h"
 #include "date.h"
 #include "vehicle_gui.h"
+#include "transparency_gui.h"
 #include "newgrf_config.h"
 
 #include "network/network_data.h"
@@ -160,8 +161,8 @@
 		case  8: _display_opt ^= DO_WAYPOINTS;          break;
 		case  9: _display_opt ^= DO_FULL_ANIMATION;     break;
 		case 10: _display_opt ^= DO_FULL_DETAIL;        break;
-		case 11: _display_opt ^= DO_TRANS_BUILDINGS;    break;
-		case 12: _display_opt ^= DO_TRANS_SIGNS;        break;
+		case 11: TOGGLEBIT(_transparent_opt, TO_BUILDINGS); break;
+		case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS);     break;
 	}
 	MarkWholeScreenDirty();
 }
@@ -192,6 +193,7 @@
 		case 0: ShowSmallMap();            break;
 		case 1: ShowExtraViewPortWindow(); break;
 		case 2: ShowSignList();            break;
+		case 3: ShowTransparencyToolbar(); break;
 	}
 }
 
@@ -206,7 +208,8 @@
 		case 0: ShowSmallMap();            break;
 		case 1: ShowExtraViewPortWindow(); break;
 		case 2: ShowSignList();            break;
-		case 3: ShowTownDirectory();       break;
+		case 3: ShowTransparencyToolbar(); break;
+		case 4: ShowTownDirectory();       break;
 	}
 }
 
@@ -762,7 +765,7 @@
 
 static void ToolbarMapClick(Window *w)
 {
-	PopupMainToolbMenu(w, 4, STR_02DE_MAP_OF_WORLD, 3, 0);
+	PopupMainToolbMenu(w, 4, STR_02DE_MAP_OF_WORLD, 4, 0);
 }
 
 static void ToolbarTownClick(Window *w)
@@ -961,8 +964,8 @@
 	if (_display_opt & DO_WAYPOINTS)          SETBIT(x,  8);
 	if (_display_opt & DO_FULL_ANIMATION)     SETBIT(x,  9);
 	if (_display_opt & DO_FULL_DETAIL)        SETBIT(x, 10);
-	if (_display_opt & DO_TRANS_BUILDINGS)    SETBIT(x, 11);
-	if (_display_opt & DO_TRANS_SIGNS)        SETBIT(x, 12);
+	if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(x, 11);
+	if (HASBIT(_transparent_opt, TO_SIGNS))     SETBIT(x, 12);
 	WP(w,menu_d).checked_items = x;
 }
 
@@ -1001,7 +1004,7 @@
 static void ToolbarScenMapTownDir(Window *w)
 {
 	/* Scenario editor button, *hack*hack* use different button to activate */
-	PopupMainToolbMenu(w, 8 | (17 << 8), STR_02DE_MAP_OF_WORLD, 4, 0);
+	PopupMainToolbMenu(w, 8 | (17 << 8), STR_02DE_MAP_OF_WORLD, 5, 0);
 }
 
 static void ToolbarScenZoomIn(Window *w)
@@ -2330,11 +2333,34 @@
 				break;
 #endif
 
-			case 'X':
-				_display_opt ^= DO_TRANS_BUILDINGS;
+			case '1' | WKC_CTRL:
+			case '2' | WKC_CTRL:
+			case '3' | WKC_CTRL:
+			case '4' | WKC_CTRL:
+			case '5' | WKC_CTRL:
+			case '6' | WKC_CTRL:
+			case '7' | WKC_CTRL:
+				/* Transparency toggle hot keys */
+				TOGGLEBIT(_transparent_opt, e->we.keypress.key - '1');
 				MarkWholeScreenDirty();
 				break;
 
+			case 'X' | WKC_CTRL:
+				ShowTransparencyToolbar();
+				break;
+
+			case 'X': {
+				static byte trans_opt = ~0;
+				if (_transparent_opt == 0) {
+					_transparent_opt = trans_opt;
+				} else {
+					trans_opt = _transparent_opt;
+					_transparent_opt = 0;
+				}
+				MarkWholeScreenDirty();
+				break;
+			}
+
 #ifdef ENABLE_NETWORK
 			case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all
 				if (_networking) {
--- a/src/newgrf_house.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/newgrf_house.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -406,7 +406,7 @@
 		image = dtss->image + stage;
 		pal   = dtss->pal;
 
-		if (!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && ((_display_opt & DO_TRANS_BUILDINGS))) {
+		if (!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && HASBIT(_transparent_opt, TO_HOUSES)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
--- a/src/news_gui.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/news_gui.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -128,10 +128,11 @@
 					DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
 						ni->string_id, w->width - 4);
 				} else {
-					byte bk = _display_opt;
-					_display_opt &= ~DO_TRANS_BUILDINGS;
+					/* Back up transparency options to draw news view */
+					byte to_backup = _transparent_opt;
+					_transparent_opt = 0;
 					DrawWindowViewport(w);
-					_display_opt = bk;
+					_transparent_opt = to_backup;
 
 					/* Shade the viewport into gray, or color*/
 					vp = w->viewport;
--- a/src/openttd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/openttd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -303,7 +303,10 @@
 	char filename[256];
 
 	_game_mode = GM_MENU;
-	CLRBITS(_display_opt, DO_TRANS_BUILDINGS); // don't make buildings transparent in intro
+
+	/* Clear transparency options */
+	_transparent_opt = 0;
+
 	_opt_ptr = &_opt_newgame;
 	ResetGRFConfig(false);
 
--- a/src/openttd.h	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/openttd.h	Thu Apr 05 07:49:04 2007 +0000
@@ -175,10 +175,18 @@
 	DO_SHOW_STATION_NAMES = 1 << 1,
 	DO_SHOW_SIGNS         = 1 << 2,
 	DO_FULL_ANIMATION     = 1 << 3,
-	DO_TRANS_BUILDINGS    = 1 << 4,
 	DO_FULL_DETAIL        = 1 << 5,
 	DO_WAYPOINTS          = 1 << 6,
-	DO_TRANS_SIGNS        = 1 << 7,
+};
+
+enum {
+	TO_SIGNS,
+	TO_TREES,
+	TO_HOUSES,
+	TO_INDUSTRIES,
+	TO_BUILDINGS,
+	TO_BRIDGES,
+	TO_STRUCTURES,
 };
 
 /* Landscape types */
@@ -461,6 +469,7 @@
 	WC_GENERATE_LANDSCAPE,
 	WC_GENERATE_PROGRESS_WINDOW,
 	WC_CONFIRM_POPUP_QUERY,
+	WC_TRANSPARENCY_TOOLBAR,
 };
 
 
--- a/src/rail_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/rail_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -1373,7 +1373,7 @@
 				image += relocation;
 			}
 
-			if (_display_opt & DO_TRANS_BUILDINGS) {
+			if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 				pal = PALETTE_TO_TRANSPARENT;
 			} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
--- a/src/road_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/road_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -765,7 +765,7 @@
 				SpriteID image = dtss->image;
 				SpriteID pal;
 
-				if (_display_opt & DO_TRANS_BUILDINGS) {
+				if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
 					SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 					pal = PALETTE_TO_TRANSPARENT;
 				} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
--- a/src/settings.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/settings.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -1205,7 +1205,7 @@
 #endif /* WIN32 */
 
 static const SettingDescGlobVarList _misc_settings[] = {
-	SDTG_MMANY("display_opt",     SLE_UINT8, S, 0, _display_opt,       (DO_SHOW_TOWN_NAMES|DO_SHOW_STATION_NAMES|DO_SHOW_SIGNS|DO_FULL_ANIMATION|DO_FULL_DETAIL|DO_TRANS_BUILDINGS|DO_WAYPOINTS), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|TRANS_BUILDINGS|FULL_DETAIL|WAYPOINTS", STR_NULL, NULL),
+	SDTG_MMANY("display_opt",     SLE_UINT8, S, 0, _display_opt,       (DO_SHOW_TOWN_NAMES|DO_SHOW_STATION_NAMES|DO_SHOW_SIGNS|DO_FULL_ANIMATION|DO_FULL_DETAIL|DO_WAYPOINTS), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|FULL_DETAIL|WAYPOINTS", STR_NULL, NULL),
 	 SDTG_BOOL("news_ticker_sound",          S, 0, _news_ticker_sound,     true,    STR_NULL, NULL),
 	 SDTG_BOOL("fullscreen",                 S, 0, _fullscreen,           false,    STR_NULL, NULL),
 	  SDTG_STR("videodriver",      SLE_STRB,C|S,0, _ini_videodriver,       NULL,    STR_NULL, NULL),
--- a/src/station_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/station_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -1959,7 +1959,7 @@
 		}
 
 		SpriteID pal;
-		if (_display_opt & DO_TRANS_BUILDINGS) {
+		if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
--- a/src/town_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/town_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -151,7 +151,7 @@
 	/* Add a house on top of the ground? */
 	image = dcts->building.sprite;
 	if (image != 0) {
-		if (_display_opt & DO_TRANS_BUILDINGS) {
+		if (HASBIT(_transparent_opt, TO_HOUSES)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else {
@@ -167,7 +167,7 @@
 			ti->z
 		);
 
-		if (_display_opt & DO_TRANS_BUILDINGS) return;
+		if (HASBIT(_transparent_opt, TO_HOUSES)) return;
 	}
 
 	{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/transparency_gui.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -0,0 +1,68 @@
+/* $Id$ */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "table/sprites.h"
+#include "table/strings.h"
+#include "functions.h"
+#include "window.h"
+#include "gui.h"
+#include "viewport.h"
+#include "gfx.h"
+#include "sound.h"
+#include "variables.h"
+
+static void Transparent_Click(byte widget)
+{
+	TOGGLEBIT(_transparent_opt, widget);
+	SndPlayFx(SND_15_BEEP);
+}
+
+static void TransparencyToolbWndProc(Window *w, WindowEvent *e)
+{
+	switch (e->event) {
+		case WE_PAINT:
+			for (uint i = 0; i < 7; i++) {
+				SetWindowWidgetLoweredState(w, i + 3, HASBIT(_transparent_opt, i));
+			}
+			DrawWindowWidgets(w);
+			break;
+
+		case WE_CLICK:
+			if (e->we.click.widget >= 3) {
+				Transparent_Click(e->we.click.widget - 3);
+				MarkWholeScreenDirty();
+			}
+			break;
+	}
+}
+
+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, 162,   0,  13, STR_TRANSPARENCY_TOOLB,   STR_018C_WINDOW_TITLE_DRAG_THIS},
+{WWT_STICKYBOX,   RESIZE_NONE,  7, 163, 174,   0,  13, STR_NULL,                 STR_STICKY_BUTTON},
+
+/* transparency widgets: transparent signs, trees, houses, industries, player's buildings */
+{   WWT_IMGBTN,   RESIZE_NONE,  7,   0,  21,  14,  35, SPR_IMG_PLACE_SIGN,   STR_TRANSPARENT_SIGNS_DESC},
+{   WWT_IMGBTN,   RESIZE_NONE,  7,  22,  43,  14,  35, SPR_IMG_PLANTTREES,   STR_TRANSPARENT_TREES_DESC},
+{   WWT_IMGBTN,   RESIZE_NONE,  7,  44,  65,  14,  35, SPR_IMG_TOWN,         STR_TRANSPARENT_HOUSES_DESC},
+{   WWT_IMGBTN,   RESIZE_NONE,  7,  66,  87,  14,  35, SPR_IMG_INDUSTRY,     STR_TRANSPARENT_INDUSTRIES_DESC},
+{   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},
+
+{   WIDGETS_END},
+};
+
+static const WindowDesc _transparency_desc = {
+	WDP_ALIGN_TBR, 58+36, 175, 36,
+	WC_TRANSPARENCY_TOOLBAR, WC_NONE,
+	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+	_transparency_widgets,
+	TransparencyToolbWndProc
+};
+
+void ShowTransparencyToolbar(void)
+{
+	AllocateWindowDescFront(&_transparency_desc, 0);
+}
--- a/src/tree_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/tree_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -368,7 +368,7 @@
 
 	StartSpriteCombine();
 
-	if (!(_display_opt & DO_TRANS_BUILDINGS) || !_patches.invisible_trees) {
+	if (!HASBIT(_transparent_opt, TO_TREES) || !_patches.invisible_trees) {
 		TreeListEnt te[4];
 		uint i;
 
@@ -377,7 +377,7 @@
 		do {
 			SpriteID image = s[0].sprite + (--i == 0 ? GetTreeGrowth(ti->tile) : 3);
 			SpriteID pal;
-			if (_display_opt & DO_TRANS_BUILDINGS) {
+			if (HASBIT(_transparent_opt, TO_TREES)) {
 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 				pal = PALETTE_TO_TRANSPARENT;
 			} else {
--- a/src/tunnelbridge_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/tunnelbridge_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -795,7 +795,7 @@
 			{ 2, 4, 8, 1,   2, 16, 9, 0 }
 		};
 
-		if (_display_opt & DO_TRANS_BUILDINGS) {
+		if (HASBIT(_transparent_opt, TO_BRIDGES)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else {
@@ -920,7 +920,7 @@
 		image = psid->sprite;
 
 		/* draw ramp */
-		if (_display_opt & DO_TRANS_BUILDINGS) {
+		if (HASBIT(_transparent_opt, TO_BRIDGES)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else {
@@ -1012,7 +1012,7 @@
 	z = GetBridgeHeight(rampsouth) - 3;
 
 	image = psid->sprite;
-	if (_display_opt & DO_TRANS_BUILDINGS) {
+	if (HASBIT(_transparent_opt, TO_BRIDGES)) {
 		SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 		pal = PALETTE_TO_TRANSPARENT;
 	} else {
@@ -1027,7 +1027,7 @@
 
 	psid++;
 	image = psid->sprite;
-	if (_display_opt & DO_TRANS_BUILDINGS) {
+	if (HASBIT(_transparent_opt, TO_BRIDGES)) {
 		SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 		pal = PALETTE_TO_TRANSPARENT;
 	} else {
@@ -1050,7 +1050,7 @@
 		/* draw poles below for small bridges */
 		if (psid->sprite != 0) {
 			image = psid->sprite;
-			if (_display_opt & DO_TRANS_BUILDINGS) {
+			if (HASBIT(_transparent_opt, TO_BRIDGES)) {
 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 				pal = PALETTE_TO_TRANSPARENT;
 			} else {
--- a/src/unmovable_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/unmovable_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -125,7 +125,7 @@
 			dtus = &_draw_tile_unmovable_data[GetUnmovableType(ti->tile)];
 
 			image = dtus->image;
-			if (_display_opt & DO_TRANS_BUILDINGS) {
+			if (HASBIT(_transparent_opt, TO_STRUCTURES)) {
 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 				pal = PALETTE_TO_TRANSPARENT;
 			} else {
@@ -143,7 +143,7 @@
 			DrawGroundSprite(SPR_CONCRETE_GROUND, PAL_NONE);
 
 			image = SPR_STATUE_COMPANY;
-			if (_display_opt & DO_TRANS_BUILDINGS) {
+			if (HASBIT(_transparent_opt, TO_STRUCTURES)) {
 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 				pal = PALETTE_TO_TRANSPARENT;
 			} else {
@@ -179,7 +179,7 @@
 
 			foreach_draw_tile_seq(dtss, t->seq) {
 				image = dtss->image;
-				if (_display_opt & DO_TRANS_BUILDINGS) {
+				if (HASBIT(_transparent_opt, TO_STRUCTURES)) {
 					SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 					pal = PALETTE_TO_TRANSPARENT;
 				} else {
--- a/src/variables.h	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/variables.h	Thu Apr 05 07:49:04 2007 +0000
@@ -282,6 +282,7 @@
 VARDEF int _autosave_ctr;
 
 VARDEF byte _display_opt;
+VARDEF byte _transparent_opt;
 VARDEF int _caret_timer;
 VARDEF uint32 _news_display_opt;
 VARDEF bool _news_ticker_sound;
--- a/src/viewport.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/viewport.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -1193,11 +1193,12 @@
 
 		/* Draw the rectangle if 'tranparent station signs' is off,
 		 * or if we are drawing a general text sign (STR_2806) */
-			if (!(_display_opt & DO_TRANS_SIGNS) || ss->string == STR_2806)
+			if (!HASBIT(_transparent_opt, TO_SIGNS) || ss->string == STR_2806) {
 				DrawFrameRect(
 					x, y, x + w, bottom, ss->color,
-					(_display_opt & DO_TRANS_BUILDINGS) ? FR_TRANSPARENT : FR_NONE
+					HASBIT(_transparent_opt, TO_SIGNS) ? FR_TRANSPARENT : FR_NONE
 				);
+			}
 		}
 
 		SetDParam(0, ss->params[0]);
@@ -1205,8 +1206,8 @@
 		/* if we didn't draw a rectangle, or if transparant building is on,
 		 * draw the text in the color the rectangle would have */
 		if ((
-					(_display_opt & DO_TRANS_BUILDINGS) ||
-					(_display_opt & DO_TRANS_SIGNS && ss->string != STR_2806)
+					HASBIT(_transparent_opt, TO_BUILDINGS) ||
+					(HASBIT(_transparent_opt, TO_SIGNS) && ss->string != STR_2806)
 				) && ss->width != 0) {
 			/* Real colors need the IS_PALETTE_COLOR flag
 			 * otherwise colors from _string_colormap are assumed. */
--- a/src/water_cmd.cpp	Wed Apr 04 14:21:46 2007 +0000
+++ b/src/water_cmd.cpp	Thu Apr 05 07:49:04 2007 +0000
@@ -421,7 +421,7 @@
 		SpriteID image = wdts->image + base;
 		SpriteID pal;
 
-		if (_display_opt & DO_TRANS_BUILDINGS) {
+		if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
 			SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 			pal = PALETTE_TO_TRANSPARENT;
 		} else {