Changeset - r7849:cfd99cb69695
[Not reviewed]
master
0 24 1
belugas - 17 years ago 2007-11-10 01:17:15
belugas@openttd.org
(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.
25 files changed with 165 insertions and 102 deletions:
0 comments (0 inline, 0 general)
projects/openttd.vcproj
Show inline comments
 
@@ -682,12 +682,15 @@
 
				RelativePath=".\..\src\town.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\transparency.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\transparency_gui.h">
 
			</File>
 
			<File
 
				RelativePath=".\..\src\variables.h">
 
			</File>
 
			<File
projects/openttd_vs80.vcproj
Show inline comments
 
@@ -1141,12 +1141,16 @@
 
			</File>
 
			<File
 
				RelativePath=".\..\src\train.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\transparency.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\transparency_gui.h"
 
				>
 
			</File>
 
			<File
 
				RelativePath=".\..\src\variables.h"
 
				>
source.list
Show inline comments
 
@@ -191,12 +191,13 @@ texteff.hpp
 
tgp.h
 
thread.h
 
tile.h
 
timetable.h
 
town.h
 
train.h
 
transparency.h
 
transparency_gui.h
 
variables.h
 
vehicle.h
 
vehicle_gui.h
 
viewport.h
 
waypoint.h
src/elrail.cpp
Show inline comments
 
@@ -62,12 +62,13 @@
 
#include "rail_map.h"
 
#include "table/sprites.h"
 
#include "table/elrail_data.h"
 
#include "vehicle.h"
 
#include "train.h"
 
#include "gui.h"
 
#include "transparency.h"
 

	
 
static inline TLG GetTLG(TileIndex t)
 
{
 
	return (TLG)((HASBIT(TileX(t), 0) << 1) + HASBIT(TileY(t), 0));
 
}
 

	
 
@@ -192,13 +193,13 @@ void DrawCatenaryOnTunnel(const TileInfo
 
	const SortableSpriteStruct *sss = &CatenarySpriteData_Tunnel[dir];
 
	const int *BB_data = _tunnel_wire_BB[dir];
 
	AddSortableSpriteToDraw(
 
		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
 
	);
 
}
 

	
 
/** Draws wires and, if required, pylons on a given tile
 
 * @param ti The Tileinfo to draw the tile for
 
@@ -339,21 +340,21 @@ static void DrawCatenaryRailway(const Ti
 
						if (trackconfig[TS_NEIGHBOUR] != 0) break;
 
						continue; /* No neighbour, go looking for a better position */
 
					}
 

	
 
					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 */
 
				}
 
			}
 
		}
 
	}
 

	
 
	/* 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;
 
	}
 

	
 
	/* Drawing of pylons is finished, now draw the wires */
 
@@ -374,13 +375,13 @@ static void DrawCatenaryRailway(const Ti
 
			 * The "wire"-sprite position is inside the tile, i.e. 0 <= sss->?_offset < TILE_SIZE.
 
			 * Therefore it is save to use GetSlopeZ() for the elevation.
 
			 * Also note, that the result of GetSlopeZ() is very special for bridge-ramps.
 
			 */
 
			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));
 
		}
 
	}
 
}
 

	
 
static void DrawCatenaryOnBridge(const TileInfo *ti)
 
{
 
@@ -407,34 +408,34 @@ static void DrawCatenaryOnBridge(const T
 
	}
 

	
 
	height = GetBridgeHeight(end);
 

	
 
	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 */
 
	/* every other tile needs a pylon on the northern end */
 
	if (num % 2) {
 
		DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_NE : DIAGDIR_NW);
 
		Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE);
 
		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 */
 
	if (DistanceMax(ti->tile, start) == length) {
 
		DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE);
 
		Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE);
 
		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);
 
	}
 
}
 

	
 
void DrawCatenary(const TileInfo *ti)
 
{
 
	if (_patches.disable_elrails) return;
 
@@ -454,13 +455,13 @@ void DrawCatenary(const TileInfo *ti)
 

	
 
				/* This wire is not visible with the default depot sprites */
 
				AddSortableSpriteToDraw(
 
					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;
 
			}
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
src/industry_cmd.cpp
Show inline comments
 
@@ -35,12 +35,13 @@
 
#include "newgrf_commons.h"
 
#include "newgrf_industries.h"
 
#include "newgrf_industrytiles.h"
 
#include "newgrf_callbacks.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "transparency.h"
 

	
 
void ShowIndustryViewWindow(int industry);
 
void BuildOilRig(TileIndex tile);
 

	
 
static byte _industry_sound_ctr;
 
static TileIndex _industry_sound_tile;
 
@@ -307,15 +308,15 @@ static void DrawTile_Industry(TileInfo *
 
			ti->x + dits->subtile_x,
 
			ti->y + dits->subtile_y,
 
			dits->width,
 
			dits->height,
 
			dits->dz,
 
			ti->z,
 
			HASBIT(_transparent_opt, TO_INDUSTRIES));
 
			IsTransparencySet(TO_INDUSTRIES));
 

	
 
		if (HASBIT(_transparent_opt, TO_INDUSTRIES)) return;
 
		if (IsTransparencySet(TO_INDUSTRIES)) return;
 
	}
 

	
 
	{
 
		int proc = dits->draw_proc - 1;
 
		if (proc >= 0) _industry_draw_tile_procs[proc](ti);
 
	}
src/main_gui.cpp
Show inline comments
 
@@ -44,12 +44,13 @@
 

	
 
#include "network/network_data.h"
 
#include "network/network_client.h"
 
#include "network/network_server.h"
 
#include "network/network_gui.h"
 
#include "industry.h"
 
#include "transparency.h"
 

	
 
static int _rename_id = 1;
 
static int _rename_what = -1;
 

	
 
static byte _terraform_size = 1;
 
RailType _last_built_railtype;
 
@@ -153,28 +154,12 @@ static void ToolbarFastForwardClick(Wind
 
{
 
	_fast_forward ^= true;
 
	SndPlayFx(SND_15_BEEP);
 
}
 

	
 

	
 
/** Toggle all transparency options, except for signs */
 
static void ToggleTransparency()
 
{
 
	static byte trans_opt = ~0;
 

	
 
	if (GB(_transparent_opt, 1, 7) == 0) {
 
		SB(_transparent_opt, 1, 7, GB(trans_opt, 1, 7));
 
	} else {
 
		trans_opt = _transparent_opt;
 
		SB(_transparent_opt, 1, 7, 0);
 
	}
 

	
 
	MarkWholeScreenDirty();
 
}
 

	
 

	
 
static void MenuClickSettings(int index)
 
{
 
	switch (index) {
 
		case 0: ShowGameOptions();      return;
 
		case 1: ShowGameDifficulty();   return;
 
		case 2: ShowPatchesSelection(); return;
 
@@ -184,14 +169,17 @@ static void MenuClickSettings(int index)
 
		case  6: TOGGLEBIT(_display_opt, DO_SHOW_TOWN_NAMES);    break;
 
		case  7: TOGGLEBIT(_display_opt, DO_SHOW_STATION_NAMES); break;
 
		case  8: TOGGLEBIT(_display_opt, DO_SHOW_SIGNS);         break;
 
		case  9: TOGGLEBIT(_display_opt, DO_WAYPOINTS);          break;
 
		case 10: TOGGLEBIT(_display_opt, DO_FULL_ANIMATION);     break;
 
		case 11: TOGGLEBIT(_display_opt, DO_FULL_DETAIL);        break;
 
		case 12: ToggleTransparency(); break;
 
		case 13: TOGGLEBIT(_transparent_opt, TO_SIGNS); break;
 
		case 12:
 
			ToggleTransparency(TO_TREES);
 
			ToggleTransparency(TO_HOUSES);
 
			break;
 
		case 13: ToggleTransparency(TO_SIGNS);                   break;
 
	}
 
	MarkWholeScreenDirty();
 
}
 

	
 
static void MenuClickSaveLoad(int index)
 
{
 
@@ -985,14 +973,14 @@ static void ToolbarOptionsClick(Window *
 
	if (HASBIT(_display_opt, DO_SHOW_TOWN_NAMES))    SETBIT(x,  6);
 
	if (HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x,  7);
 
	if (HASBIT(_display_opt, DO_SHOW_SIGNS))         SETBIT(x,  8);
 
	if (HASBIT(_display_opt, DO_WAYPOINTS))          SETBIT(x,  9);
 
	if (HASBIT(_display_opt, DO_FULL_ANIMATION))     SETBIT(x, 10);
 
	if (HASBIT(_display_opt, DO_FULL_DETAIL))        SETBIT(x, 11);
 
	if (GB(_transparent_opt, 1, 7) != 0)      SETBIT(x, 12);
 
	if (HASBIT(_transparent_opt, TO_SIGNS))   SETBIT(x, 13);
 
	if (IsTransparencySet(TO_HOUSES) && IsTransparencySet(TO_TREES)) SETBIT(x, 12);
 
	if (IsTransparencySet(TO_SIGNS))                     SETBIT(x, 13);
 
	WP(w,menu_d).checked_items = x;
 
}
 

	
 

	
 
static void ToolbarScenSaveOrLoad(Window *w)
 
{
 
@@ -2256,23 +2244,24 @@ static void MainWindowWndProc(Window *w,
 
			case '2' | WKC_CTRL:
 
			case '3' | WKC_CTRL:
 
			case '4' | WKC_CTRL:
 
			case '5' | WKC_CTRL:
 
			case '6' | WKC_CTRL:
 
			case '7' | WKC_CTRL:
 
			case '8' | WKC_CTRL:
 
				/* Transparency toggle hot keys */
 
				TOGGLEBIT(_transparent_opt, e->we.keypress.keycode - ('1' | WKC_CTRL));
 
				ToggleTransparency((TransparencyOption)(e->we.keypress.keycode - ('1' | WKC_CTRL)));
 
				MarkWholeScreenDirty();
 
				break;
 

	
 
			case 'X' | WKC_CTRL:
 
				ShowTransparencyToolbar();
 
				break;
 

	
 
			case 'X':
 
				ToggleTransparency();
 
				ResetRestoreAllTransparency();
 
				break;
 

	
 
#ifdef ENABLE_NETWORK
 
			case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all
 
				if (_networking) {
 
					const NetworkClientInfo *cio = NetworkFindClientInfoFromIndex(_network_own_client_index);
src/newgrf_house.cpp
Show inline comments
 
@@ -22,12 +22,13 @@
 
#include "newgrf_house.h"
 
#include "newgrf_spritegroup.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_town.h"
 
#include "newgrf_sound.h"
 
#include "newgrf_commons.h"
 
#include "transparency.h"
 

	
 
static BuildingCounts    _building_counts;
 
static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX];
 

	
 
HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, HOUSE_MAX, INVALID_HOUSE_ID);
 

	
 
@@ -317,13 +318,13 @@ void DrawTileLayout(const TileInfo *ti, 
 

	
 
		image = dtss->image;
 
		pal   = dtss->pal;
 

	
 
		if (IS_CUSTOM_SPRITE(image)) image += stage;
 

	
 
		if ((HASBIT(image, SPRITE_MODIFIER_OPAQUE) || !HASBIT(_transparent_opt, TO_HOUSES)) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
		if ((HASBIT(image, SPRITE_MODIFIER_OPAQUE) || !IsTransparencySet(TO_HOUSES)) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
			if (pal == 0) {
 
				const HouseSpec *hs = GetHouseSpecs(house_id);
 
				if (HASBIT(hs->callback_mask, CBM_HOUSE_COLOUR)) {
 
					uint16 callback = GetHouseCallback(CBID_HOUSE_COLOUR, 0, 0, house_id, GetTownByTile(ti->tile), ti->tile);
 
					if (callback != CALLBACK_FAILED) {
 
						/* If bit 14 is set, we should use a 2cc colour map, else use the callback value. */
 
@@ -340,16 +341,16 @@ void DrawTileLayout(const TileInfo *ti, 
 
		if ((byte)dtss->delta_z != 0x80) {
 
			AddSortableSpriteToDraw(
 
				image, pal,
 
				ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
				dtss->size_x, dtss->size_y,
 
				dtss->size_z, ti->z + dtss->delta_z,
 
				HASBIT(_transparent_opt, TO_HOUSES)
 
				IsTransparencySet(TO_HOUSES)
 
			);
 
		} else {
 
			AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, HASBIT(_transparent_opt, TO_HOUSES));
 
			AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, IsTransparencySet(TO_HOUSES));
 
		}
 
	}
 
}
 

	
 
void DrawNewHouseTile(TileInfo *ti, HouseID house_id)
 
{
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -19,12 +19,13 @@
 
#include "newgrf_text.h"
 
#include "industry_map.h"
 
#include "clear_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "sprite.h"
 
#include "transparency.h"
 

	
 
/**
 
 * Based on newhouses equivalent, but adapted for newindustries
 
 * @param parameter from callback.  It's in fact a pair of coordinates
 
 * @param tile TileIndex from which the callback was initiated
 
 * @param index of the industry been queried for
 
@@ -192,16 +193,16 @@ void IndustryDrawTileLayout(const TileIn
 
		if ((byte)dtss->delta_z != 0x80) {
 
			AddSortableSpriteToDraw(
 
				image, pal,
 
				ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
				dtss->size_x, dtss->size_y,
 
				dtss->size_z, ti->z + dtss->delta_z,
 
				!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && HASBIT(_transparent_opt, TO_INDUSTRIES)
 
				!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_INDUSTRIES)
 
			);
 
		} else {
 
			AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, HASBIT(_transparent_opt, TO_INDUSTRIES));
 
			AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, IsTransparencySet(TO_INDUSTRIES));
 
		}
 
	}
 
}
 

	
 
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
 
{
src/news_gui.cpp
Show inline comments
 
@@ -14,12 +14,13 @@
 
#include "news.h"
 
#include "vehicle.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "date.h"
 
#include "string.h"
 
#include "transparency.h"
 

	
 
/** @file news_gui.cpp
 
 *
 
 * News system is realized as a FIFO queue (in an array)
 
 * The positions in the queue can't be rearranged, we only access
 
 * the array elements through pointers to the elements. Once the
 
@@ -134,16 +135,16 @@ static void NewsWindowProc(Window *w, Wi
 
				if (!(ni->flags & NF_VIEWPORT)) {
 
					CopyInDParam(0, ni->params, lengthof(ni->params));
 
					DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
 
						ni->string_id, w->width - 4);
 
				} else {
 
					/* Back up transparency options to draw news view */
 
					byte to_backup = _transparent_opt;
 
					_transparent_opt = 0;
 
					TransparencyOptionBits to_backup = _transparency_opt;
 
					_transparency_opt = 0;
 
					DrawWindowViewport(w);
 
					_transparent_opt = to_backup;
 
					_transparency_opt = to_backup;
 

	
 
					/* Shade the viewport into gray, or color*/
 
					vp = w->viewport;
 
					GfxFillRect(vp->left - w->left, vp->top - w->top,
 
						vp->left - w->left + vp->width - 1, vp->top - w->top + vp->height - 1,
 
						(ni->flags & NF_INCOLOR ? PALETTE_TO_TRANSPARENT : PALETTE_TO_STRUCT_GREY) | (1 << USE_COLORTABLE)
src/openttd.cpp
Show inline comments
 
@@ -318,15 +318,12 @@ static void UnInitializeGame()
 
}
 

	
 
static void LoadIntroGame()
 
{
 
	_game_mode = GM_MENU;
 

	
 
	/* Clear transparency options */
 
	_transparent_opt = 0;
 

	
 
	_opt_ptr = &_opt_newgame;
 
	ResetGRFConfig(false);
 

	
 
	/* Setup main window */
 
	ResetWindowSystem();
 
	SetupColorsAndInitialWindow();
src/openttd.h
Show inline comments
 
@@ -184,23 +184,12 @@ enum {
 
	DO_SHOW_SIGNS         = 2,
 
	DO_FULL_ANIMATION     = 3,
 
	DO_FULL_DETAIL        = 5,
 
	DO_WAYPOINTS          = 6,
 
};
 

	
 
enum {
 
	TO_SIGNS,
 
	TO_TREES,
 
	TO_HOUSES,
 
	TO_INDUSTRIES,
 
	TO_BUILDINGS,
 
	TO_BRIDGES,
 
	TO_STRUCTURES,
 
	TO_LOADING,
 
};
 

	
 
/* Landscape types */
 
enum {
 
	LT_TEMPERATE  = 0,
 
	LT_ARCTIC     = 1,
 
	LT_TROPIC     = 2,
 
	LT_TOYLAND    = 3,
src/rail_cmd.cpp
Show inline comments
 
@@ -37,12 +37,13 @@
 
#include "newgrf_engine.h"
 
#include "newgrf_callbacks.h"
 
#include "newgrf_station.h"
 
#include "train.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "transparency.h"
 

	
 
const byte _track_sloped_sprites[14] = {
 
	14, 15, 22, 13,
 
	 0, 21, 17, 12,
 
	23,  0, 18, 20,
 
	19, 16
 
@@ -1752,25 +1753,25 @@ default_waypoint:
 
			if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
 
				image += rti->total_offset;
 
			} else {
 
				image += relocation;
 
			}
 

	
 
			if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
			if (!IsTransparencySet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
				pal = _drawtile_track_palette;
 
			} else {
 
				pal = dtss->pal;
 
			}
 

	
 
			if ((byte)dtss->delta_z != 0x80) {
 
				AddSortableSpriteToDraw(
 
					image, pal,
 
					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
					dtss->size_x, dtss->size_y,
 
					dtss->size_z, ti->z + dtss->delta_z,
 
					HASBIT(_transparent_opt, TO_BUILDINGS)
 
					IsTransparencySet(TO_BUILDINGS)
 
				);
 
			} else {
 
				AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
 
			}
 
		}
 
	}
src/road_cmd.cpp
Show inline comments
 
@@ -30,12 +30,13 @@
 
#include "depot.h"
 
#include "newgrf.h"
 
#include "station_map.h"
 
#include "tunnel_map.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "transparency.h"
 

	
 
#define M(x) (1 << (x))
 
/* Level crossings may only be built on these slopes */
 
static const uint32 VALID_LEVEL_CROSSING_SLOPES = (M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT));
 
#undef M
 

	
 
@@ -943,13 +944,13 @@ static bool AlwaysDrawUnpavedRoads(TileI
 
 * @param ti   information about the tile (slopes, height etc)
 
 * @param tram the roadbits for the tram
 
 */
 
void DrawTramCatenary(TileInfo *ti, RoadBits tram)
 
{
 
	/* Don't draw the catenary 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;
 
	}
 

	
 
	SpriteID front;
 
@@ -960,14 +961,14 @@ void DrawTramCatenary(TileInfo *ti, Road
 
		front = SPR_TRAMWAY_FRONT_WIRES_SLOPED + _road_sloped_sprites[ti->tileh - 1];
 
	} else {
 
		back  = SPR_TRAMWAY_BASE + _road_backpole_sprites_1[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, HASBIT(_transparent_opt, TO_BUILDINGS));
 
	AddSortableSpriteToDraw(front, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, HASBIT(_transparent_opt, TO_BUILDINGS));
 
	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));
 
}
 

	
 
/**
 
 * Draws details on/around the road
 
 * @param img the sprite to draw
 
 * @param ti  the tile to draw on
 
@@ -1117,24 +1118,24 @@ static void DrawTile_Road(TileInfo *ti)
 
			DrawGroundSprite(dts->ground_sprite, PAL_NONE);
 

	
 
			for (dtss = dts->seq; dtss->image != 0; dtss++) {
 
				SpriteID image = dtss->image;
 
				SpriteID pal;
 

	
 
				if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
				if (!IsTransparencySet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
					pal = palette;
 
				} else {
 
					pal = PAL_NONE;
 
				}
 

	
 
				AddSortableSpriteToDraw(
 
					image, pal,
 
					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
					dtss->size_x, dtss->size_y,
 
					dtss->size_z, ti->z,
 
					HASBIT(_transparent_opt, TO_BUILDINGS)
 
					IsTransparencySet(TO_BUILDINGS)
 
				);
 
			}
 
			break;
 
		}
 
	}
 
	DrawBridgeMiddle(ti);
src/settings.cpp
Show inline comments
 
@@ -46,12 +46,13 @@
 
#include "news.h"
 
#ifdef WITH_FREETYPE
 
#include "gfx.h"
 
#include "fontcache.h"
 
#endif
 
#include "spritecache.h"
 
#include "transparency.h"
 

	
 
/** The patch values that are used for new games and/or modified in config file */
 
Patches _patches_newgame;
 

	
 
struct IniFile;
 
struct IniItem;
 
@@ -1272,12 +1273,13 @@ static const SettingDescGlobVarList _mis
 
	 SDTG_BOOL("small_aa",                   S, 0, _freetype.small_aa,    false,    STR_NULL, NULL),
 
	 SDTG_BOOL("medium_aa",                  S, 0, _freetype.medium_aa,   false,    STR_NULL, NULL),
 
	 SDTG_BOOL("large_aa",                   S, 0, _freetype.large_aa,    false,    STR_NULL, NULL),
 
#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_END()
 
};
 

	
 
#ifdef ENABLE_NETWORK
 
static const SettingDescGlobVarList _network_settings[] = {
 
	  SDTG_VAR("sync_freq",           SLE_UINT16,C|S,0, _network_sync_freq,            100, 0,   100,   0, STR_NULL, NULL),
src/station_cmd.cpp
Show inline comments
 
@@ -40,12 +40,13 @@
 
#include "helpers.hpp"
 
#include "misc/autoptr.hpp"
 
#include "road.h"
 
#include "cargotype.h"
 
#include "strings.h"
 
#include "autoslope.h"
 
#include "transparency.h"
 

	
 
DEFINE_OLD_POOL_GENERIC(Station, Station)
 
DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop)
 

	
 

	
 
/**
 
@@ -2135,28 +2136,28 @@ static void DrawTile_Station(TileInfo *t
 
			image += rti->total_offset;
 
		} else {
 
			image += relocation;
 
		}
 

	
 
		SpriteID pal;
 
		if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
		if (!IsTransparencySet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
 
			pal = palette;
 
		} else {
 
			pal = dtss->pal;
 
		}
 

	
 
		if ((byte)dtss->delta_z != 0x80) {
 
			AddSortableSpriteToDraw(
 
				image, pal,
 
				ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
				dtss->size_x, dtss->size_y,
 
				dtss->size_z, ti->z + dtss->delta_z,
 
				HASBIT(_transparent_opt, TO_BUILDINGS)
 
				IsTransparencySet(TO_BUILDINGS)
 
			);
 
		} else {
 
			AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, HASBIT(_transparent_opt, TO_BUILDINGS));
 
			AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, IsTransparencySet(TO_BUILDINGS));
 
		}
 
	}
 
}
 

	
 
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image)
 
{
src/texteff.cpp
Show inline comments
 
@@ -17,12 +17,13 @@
 
#include "table/sprites.h"
 
#include "blitter/factory.hpp"
 
#include <stdarg.h> /* va_list */
 
#include "date.h"
 
#include "texteff.hpp"
 
#include "video/video_driver.hpp"
 
#include "transparency.h"
 

	
 
enum {
 
	MAX_TEXTMESSAGE_LENGTH = 200,
 
	INIT_NUM_TEXT_MESSAGES =  20,
 
	MAX_CHAT_MESSAGES      =  10,
 
};
 
@@ -387,13 +388,13 @@ void DrawTextEffects(DrawPixelInfo *dpi)
 
				TextEffect *te = &_text_effect_list[i];
 
				if (te->string_id != INVALID_STRING_ID &&
 
						dpi->left <= te->right &&
 
						dpi->top  <= te->bottom &&
 
						dpi->left + dpi->width  > te->x &&
 
						dpi->top  + dpi->height > te->y) {
 
					if (te->mode == TE_RISING || (_patches.loading_indicators && !HASBIT(_transparent_opt, TO_LOADING))) {
 
					if (te->mode == TE_RISING || (_patches.loading_indicators && !IsTransparencySet(TO_LOADING))) {
 
						AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2);
 
					}
 
				}
 
			}
 
			break;
 

	
 
@@ -402,13 +403,13 @@ void DrawTextEffects(DrawPixelInfo *dpi)
 
				TextEffect *te = &_text_effect_list[i];
 
				if (te->string_id != INVALID_STRING_ID &&
 
						dpi->left <= te->right  * 2 - te->x &&
 
						dpi->top  <= te->bottom * 2 - te->y &&
 
						dpi->left + dpi->width  > te->x &&
 
						dpi->top  + dpi->height > te->y) {
 
					if (te->mode == TE_RISING || (_patches.loading_indicators && !HASBIT(_transparent_opt, TO_LOADING))) {
 
					if (te->mode == TE_RISING || (_patches.loading_indicators && !IsTransparencySet(TO_LOADING))) {
 
						AddStringToDraw(te->x, te->y, (StringID)(te->string_id - 1), te->params_1, te->params_2);
 
					}
 
				}
 
			}
 
			break;
 

	
src/town_cmd.cpp
Show inline comments
 
@@ -40,12 +40,13 @@
 
#include "newgrf_house.h"
 
#include "newgrf_commons.h"
 
#include "newgrf_townname.h"
 
#include "misc/autoptr.hpp"
 
#include "autoslope.h"
 
#include "waypoint.h"
 
#include "transparency.h"
 

	
 
/* Initialize the town-pool */
 
DEFINE_OLD_POOL_GENERIC(Town, Town)
 

	
 
Town::Town(TileIndex tile)
 
{
 
@@ -180,16 +181,16 @@ static void DrawTile_Town(TileInfo *ti)
 
			ti->x + dcts->subtile_x,
 
			ti->y + dcts->subtile_y,
 
			dcts->width,
 
			dcts->height,
 
			dcts->dz,
 
			ti->z,
 
			HASBIT(_transparent_opt, TO_HOUSES)
 
			IsTransparencySet(TO_HOUSES)
 
		);
 

	
 
		if (HASBIT(_transparent_opt, TO_HOUSES)) return;
 
		if (IsTransparencySet(TO_HOUSES)) return;
 
	}
 

	
 
	{
 
		int proc = dcts->draw_proc - 1;
 

	
 
		if (proc >= 0) _town_draw_tile_procs[proc](ti);
src/transparency.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/** @file transparency.h */
 

	
 
#ifndef TRANSPARENCY_H
 
#define TRANSPARENCY_H
 

	
 
/**
 
 * Transparency option bits: which position in _transparency_opt stands for which transparency.
 
 * If you change the order, change the order of the ShowTransparencyToolbar() stuff in transparency_gui.cpp too.
 
 * If you add or remove an option don't forget to change the transparency 'hot keys' in main_gui.cpp.
 
 * If you add an option and have more then 8, change the typedef TransparencyOptionBits and
 
 * the save stuff (e.g. SLE_UINT8 to SLE_UINT16) in settings.cpp .
 
 */
 
enum TransparencyOption {
 
	TO_SIGNS = 0,  ///< signs
 
	TO_TREES,      ///< trees
 
	TO_HOUSES,     ///< town buildings
 
	TO_INDUSTRIES, ///< industries
 
	TO_BUILDINGS,  ///< player buildings - depots, stations, HQ, ...
 
	TO_BRIDGES,    ///< bridges
 
	TO_STRUCTURES, ///< unmovable structures
 
	TO_LOADING,    ///< loading indicators
 
	TO_END,
 
};
 

	
 
typedef byte TransparencyOptionBits; ///< transparency option bits
 
extern TransparencyOptionBits _transparency_opt;
 

	
 
/**
 
 * Check if the transparency option bit is set
 
 * and if we aren't in the game menu (there's never transparency)
 
 *
 
 * @param to the structure which transparency option is ask for
 
 */
 
static inline bool IsTransparencySet(TransparencyOption to)
 
{
 
	return (HASBIT(_transparency_opt, to) && _game_mode != GM_MENU);
 
}
 

	
 
/**
 
 * Toggle the transparency option bit
 
 *
 
 * @param to the structure which transparency option is toggle
 
 */
 
static inline void ToggleTransparency(TransparencyOption to)
 
{
 
	TOGGLEBIT(_transparency_opt, to);
 
}
 

	
 
/** Toggle all transparency options (except signs) or restore the stored transparencies */
 
static inline void ResetRestoreAllTransparency()
 
{
 
	/* backup of the original transparencies or if all transparencies false toggle them to true */
 
	static TransparencyOptionBits trans_opt = ~0;
 

	
 
	if (_transparency_opt == 0) {
 
		/* no structure is transparent, so restore the old transparency if present otherwise set all true */
 
		_transparency_opt = trans_opt;
 
	} else {
 
		/* any structure is transparent, so store current transparency settings and reset it */
 
		trans_opt = _transparency_opt;
 
		_transparency_opt = 0;
 
	}
 

	
 
	MarkWholeScreenDirty();
 
}
 

	
 
#endif /* TRANSPARENCY_H */
src/transparency_gui.cpp
Show inline comments
 
@@ -8,12 +8,15 @@
 
#include "window.h"
 
#include "gui.h"
 
#include "viewport.h"
 
#include "gfx.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "transparency.h"
 

	
 
TransparencyOptionBits _transparency_opt;
 

	
 
enum TransparencyToolbarWidgets{
 
	/* Widgets not toggled when pressing the X key */
 
	TTW_WIDGET_SIGNS = 3,    ///< Make signs background transparent
 

	
 
	/* Widgets toggled when pressing the X key */
 
@@ -24,37 +27,29 @@ enum TransparencyToolbarWidgets{
 
	TTW_WIDGET_BRIDGES,      ///< Make bridges transparent
 
	TTW_WIDGET_STRUCTURES,   ///< Make unmovable structures transparent
 
	TTW_WIDGET_LOADING,      ///< Make loading indicators transperent
 
	TTW_WIDGET_END,          ///< End of toggle buttons
 
};
 

	
 
/** Toggle the bits of the transparencies variable
 
 * when clicking on a widget, and play a sound
 
 * @param widget been clicked.
 
 */
 
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:
 
			/* must be sure that the widgets show the transparency variable changes
 
			 * also when we use shortcuts */
 
			for (uint i = TTW_WIDGET_SIGNS; i < TTW_WIDGET_END; i++) {
 
				SetWindowWidgetLoweredState(w, i, HASBIT(_transparent_opt, i - TTW_WIDGET_SIGNS));
 
				SetWindowWidgetLoweredState(w, i, IsTransparencySet((TransparencyOption)(i - TTW_WIDGET_SIGNS)));
 
			}
 
			DrawWindowWidgets(w);
 
			break;
 

	
 
		case WE_CLICK:
 
			if (e->we.click.widget >= TTW_WIDGET_SIGNS) {
 
				Transparent_Click(e->we.click.widget - TTW_WIDGET_SIGNS);
 
				/* toggle the bit of the transparencies variable when clicking on a widget, and play a sound */
 
				ToggleTransparency((TransparencyOption)(e->we.click.widget - TTW_WIDGET_SIGNS));
 
				SndPlayFx(SND_15_BEEP);
 
				MarkWholeScreenDirty();
 
			}
 
			break;
 
	}
 
}
 

	
src/tree_cmd.cpp
Show inline comments
 
@@ -17,12 +17,13 @@
 
#include "viewport.h"
 
#include "command.h"
 
#include "town.h"
 
#include "sound.h"
 
#include "variables.h"
 
#include "genworld.h"
 
#include "transparency.h"
 

	
 
/**
 
 * List of tree placer algorithm.
 
 *
 
 * This enumeration defines all possible tree placer algorithm in the game.
 
 */
 
@@ -424,13 +425,13 @@ static void DrawTile_Trees(TileInfo *ti)
 
		assert(index < lengthof(_tree_layout_sprite));
 
		s = _tree_layout_sprite[index];
 
	}
 

	
 
	StartSpriteCombine();
 

	
 
	if (!HASBIT(_transparent_opt, TO_TREES) || !_patches.invisible_trees) {
 
	if (!IsTransparencySet(TO_TREES) || !_patches.invisible_trees) {
 
		TreeListEnt te[4];
 
		uint i;
 

	
 
		/* put the trees to draw in a list */
 
		i = GetTreeCount(ti->tile) + 1;
 
		do {
 
@@ -457,13 +458,13 @@ static void DrawTile_Trees(TileInfo *ti)
 
					tep = &te[i];
 
				}
 
			} while (i);
 

	
 
			if (tep == NULL) break;
 

	
 
			AddSortableSpriteToDraw(tep->image, tep->pal, ti->x + tep->x, ti->y + tep->y, 16 - tep->x, 16 - tep->y, 0x30, z, HASBIT(_transparent_opt, TO_TREES), -tep->x, -tep->y);
 
			AddSortableSpriteToDraw(tep->image, tep->pal, ti->x + tep->x, ti->y + tep->y, 16 - tep->x, 16 - tep->y, 0x30, z, IsTransparencySet(TO_TREES), -tep->x, -tep->y);
 
			tep->image = 0;
 
		}
 
	}
 

	
 
	EndSpriteCombine();
 
}
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -30,12 +30,13 @@
 
#include "train.h"
 
#include "water_map.h"
 
#include "yapf/yapf.h"
 
#include "date.h"
 
#include "newgrf_sound.h"
 
#include "autoslope.h"
 
#include "transparency.h"
 

	
 
#include "table/bridge_land.h"
 

	
 
const Bridge orig_bridge[] = {
 
/*
 
	     year of availablity
 
@@ -855,18 +856,18 @@ static void DrawBridgePillars(const PalS
 
		int x_back = x - (axis == AXIS_X ? 0 : 9);
 
		int y_back = y - (axis == AXIS_X ? 9 : 0);
 

	
 
		for (int cur_z = z_bridge; cur_z >= front_height || cur_z >= back_height; cur_z -= TILE_HEIGHT) {
 
			/* Draw front facing pillar */
 
			if (cur_z >= front_height) {
 
				AddSortableSpriteToDraw(image, psid->pal, x, y, w, h, BB_HEIGHT_UNDER_BRIDGE - 5, cur_z, HASBIT(_transparent_opt, TO_BRIDGES), 0, 0, -5);
 
				AddSortableSpriteToDraw(image, psid->pal, x, y, w, h, BB_HEIGHT_UNDER_BRIDGE - 5, cur_z, IsTransparencySet(TO_BRIDGES), 0, 0, -5);
 
			}
 

	
 
			/* Draw back facing pillar, but not the highest part directly under the bridge-floor */
 
			if (drawfarpillar && cur_z >= back_height && cur_z < z_bridge - TILE_HEIGHT) {
 
				AddSortableSpriteToDraw(image, psid->pal, x_back, y_back, w, h, BB_HEIGHT_UNDER_BRIDGE - 5, cur_z, HASBIT(_transparent_opt, TO_BRIDGES), 0, 0, -5);
 
				AddSortableSpriteToDraw(image, psid->pal, x_back, y_back, w, h, BB_HEIGHT_UNDER_BRIDGE - 5, cur_z, IsTransparencySet(TO_BRIDGES), 0, 0, -5);
 
			}
 
		}
 
	}
 
}
 

	
 
Foundation GetBridgeFoundation(Slope tileh, Axis axis)
 
@@ -894,22 +895,22 @@ static void DrawBridgeTramBits(int x, in
 
	static const uint size_y[6] = { 16,  1,  1, 16,  1, 16 };
 
	static const uint front_bb_offset_x[6] = { 15,  0,  0, 15,  0, 15 };
 
	static const uint front_bb_offset_y[6] = {  0, 15, 15,  0, 15,  0 };
 

	
 
	/* The sprites under the vehicles are drawn as SpriteCombine. StartSpriteCombine() has already been called
 
	 * 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, HASBIT(_transparent_opt, TO_BRIDGES));
 
	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, HASBIT(_transparent_opt, TO_BUILDINGS));
 
	AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + back_offsets[offset],  PAL_NONE, x, y, size_x[offset], size_y[offset], 0x28, z, IsTransparencySet(TO_BUILDINGS));
 

	
 
	/* 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, HASBIT(_transparent_opt, 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_BUILDINGS), front_bb_offset_x[offset], front_bb_offset_y[offset]);
 
}
 

	
 
/**
 
 * 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
 
@@ -966,13 +967,13 @@ static void DrawTile_TunnelBridge(TileIn
 
				static const SpriteID tunnel_sprites[2][4] = { { 28, 78, 79, 27 }, {  5, 76, 77,  4 } };
 

	
 
				DrawGroundSprite(SPR_TRAMWAY_BASE + tunnel_sprites[rts - ROADTYPES_TRAM][dir], PAL_NONE);
 

	
 
				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, HASBIT(_transparent_opt, 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_BUILDINGS), BB_data[8], BB_data[9], BB_Z_SEPARATOR);
 
			}
 
		} else if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) {
 
			DrawCatenary(ti);
 

	
 
			catenary = true;
 
			StartSpriteCombine();
 
@@ -1025,13 +1026,13 @@ static void DrawTile_TunnelBridge(TileIn
 
		if (GetBridgeTransportType(ti->tile) == TRANSPORT_ROAD) StartSpriteCombine();
 

	
 
		/* HACK set the height of the BB of a sloped ramp to 1 so a vehicle on
 
		 * it doesn't disappear behind it
 
		 */
 
		AddSortableSpriteToDraw(
 
			psid->sprite, psid->pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z, HASBIT(_transparent_opt, TO_BRIDGES)
 
			psid->sprite, psid->pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z, IsTransparencySet(TO_BRIDGES)
 
		);
 

	
 
		if (GetBridgeTransportType(ti->tile) == TRANSPORT_ROAD) {
 
			RoadTypes rts = GetRoadTypes(ti->tile);
 

	
 
			if (HASBIT(rts, ROADTYPE_TRAM)) {
 
@@ -1153,15 +1154,15 @@ void DrawBridgeMiddle(const TileInfo* ti
 

	
 
	/* Draw Trambits as SpriteCombine */
 
	if (GetBridgeTransportType(rampsouth) == TRANSPORT_ROAD) StartSpriteCombine();
 

	
 
	/* Draw floor and far part of bridge*/
 
	if (axis == AXIS_X) {
 
		AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 1, 0x28, z, HASBIT(_transparent_opt, TO_BRIDGES), 0, 0, BRIDGE_Z_START);
 
		AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 1, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 0, BRIDGE_Z_START);
 
	} else {
 
		AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 1, 16, 0x28, z, HASBIT(_transparent_opt, TO_BRIDGES), 0, 0, BRIDGE_Z_START);
 
		AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 1, 16, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 0, BRIDGE_Z_START);
 
	}
 

	
 
	psid++;
 

	
 
	if (GetBridgeTransportType(rampsouth) == TRANSPORT_ROAD) {
 
		RoadTypes rts = GetRoadTypes(rampsouth);
 
@@ -1177,28 +1178,28 @@ void DrawBridgeMiddle(const TileInfo* ti
 
		DrawCatenary(ti);
 
	}
 

	
 
	/* draw roof, the component of the bridge which is logically between the vehicle and the camera */
 
	if (axis == AXIS_X) {
 
		y += 12;
 
		if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 4, 0x28, z, HASBIT(_transparent_opt, TO_BRIDGES), 0, 3, BRIDGE_Z_START);
 
		if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 4, 0x28, z, IsTransparencySet(TO_BRIDGES), 0, 3, BRIDGE_Z_START);
 
	} else {
 
		x += 12;
 
		if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 4, 16, 0x28, z, HASBIT(_transparent_opt, TO_BRIDGES), 3, 0, BRIDGE_Z_START);
 
		if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 4, 16, 0x28, z, IsTransparencySet(TO_BRIDGES), 3, 0, BRIDGE_Z_START);
 
	}
 

	
 
	/* Draw TramFront as SpriteCombine */
 
	if (GetBridgeTransportType(rampsouth) == TRANSPORT_ROAD) EndSpriteCombine();
 

	
 
	psid++;
 
	if (ti->z + 5 == z) {
 
		/* draw poles below for small bridges */
 
		if (psid->sprite != 0) {
 
			SpriteID image = psid->sprite;
 
			SpriteID pal   = psid->pal;
 
			if (HASBIT(_transparent_opt, TO_BRIDGES)) {
 
			if (IsTransparencySet(TO_BRIDGES)) {
 
				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
 
				pal = PALETTE_TO_TRANSPARENT;
 
			}
 

	
 
			DrawGroundSpriteAt(image, pal, x, y, z);
 
		}
src/unmovable_cmd.cpp
Show inline comments
 
@@ -22,12 +22,13 @@
 
#include "unmovable_map.h"
 
#include "variables.h"
 
#include "table/unmovable_land.h"
 
#include "genworld.h"
 
#include "bridge.h"
 
#include "autoslope.h"
 
#include "transparency.h"
 

	
 
/** Destroy a HQ.
 
 * During normal gameplay you can only implicitely destroy a HQ when you are
 
 * rebuilding it. Otherwise, only water can destroy it.
 
 * @param pid Player requesting the destruction of his HQ
 
 * @param flags docommand flags of calling function
 
@@ -126,24 +127,24 @@ static void DrawTile_Unmovable(TileInfo 
 

	
 
			dtus = &_draw_tile_unmovable_data[GetUnmovableType(ti->tile)];
 

	
 
			AddSortableSpriteToDraw(
 
				dtus->image, PAL_NONE, ti->x | dtus->subcoord_x, ti->y | dtus->subcoord_y,
 
				dtus->width, dtus->height, dtus->z_size, ti->z,
 
				HASBIT(_transparent_opt, TO_STRUCTURES)
 
				IsTransparencySet(TO_STRUCTURES)
 
			);
 
			break;
 
		}
 

	
 
		case UNMOVABLE_STATUE:
 
			/* This should prevent statues from sinking into the ground when on a slope. */
 
			if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, GetFoundation_Unmovable(ti->tile, ti->tileh));
 

	
 
			DrawGroundSprite(SPR_CONCRETE_GROUND, PAL_NONE);
 

	
 
			AddSortableSpriteToDraw(SPR_STATUE_COMPANY, PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)), ti->x, ti->y, 16, 16, 25, ti->z, HASBIT(_transparent_opt, TO_STRUCTURES));
 
			AddSortableSpriteToDraw(SPR_STATUE_COMPANY, PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)), ti->x, ti->y, 16, 16, 25, ti->z, IsTransparencySet(TO_STRUCTURES));
 
			break;
 

	
 
		case UNMOVABLE_OWNED_LAND:
 
			DrawClearLandTile(ti, 0);
 

	
 
			AddSortableSpriteToDraw(
 
@@ -169,13 +170,13 @@ static void DrawTile_Unmovable(TileInfo 
 
			foreach_draw_tile_seq(dtss, t->seq) {
 
				AddSortableSpriteToDraw(
 
					dtss->image, palette,
 
					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
 
					dtss->size_x, dtss->size_y,
 
					dtss->size_z, ti->z + dtss->delta_z,
 
					HASBIT(_transparent_opt, TO_STRUCTURES)
 
					IsTransparencySet(TO_STRUCTURES)
 
				);
 
			}
 
			break;
 
		}
 
	}
 
}
src/variables.h
Show inline comments
 
@@ -287,13 +287,12 @@ VARDEF uint32 _realtime_tick;
 
VARDEF bool _is_old_ai_player; // current player is an oldAI player? (enables a lot of cheats..)
 

	
 
VARDEF bool _do_autosave;
 
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;
 

	
 
VARDEF StringID _error_message;
 
VARDEF Money _additional_cash_required;
src/viewport.cpp
Show inline comments
 
@@ -23,12 +23,13 @@
 
#include "waypoint.h"
 
#include "variables.h"
 
#include "train.h"
 
#include "roadveh.h"
 
#include "vehicle_gui.h"
 
#include "blitter/factory.hpp"
 
#include "transparency.h"
 

	
 
#define VIEWPORT_DRAW_MEM (65536 * 2)
 

	
 
ZoomLevel _saved_scrollpos_zoom;
 

	
 
/* XXX - maximum viewports is maximum windows - 2 (main toolbar + status bar) */
 
@@ -1480,25 +1481,25 @@ static void ViewportDrawStrings(DrawPixe
 
				bottom -= 6;
 
				w -= 3;
 
			}
 

	
 
		/* Draw the rectangle if 'tranparent station signs' is off,
 
		 * or if we are drawing a general text sign (STR_2806) */
 
			if (!HASBIT(_transparent_opt, TO_SIGNS) || ss->string == STR_2806) {
 
			if (!IsTransparencySet(TO_SIGNS) || ss->string == STR_2806) {
 
				DrawFrameRect(
 
					x, y, x + w, bottom, ss->color,
 
					HASBIT(_transparent_opt, TO_SIGNS) ? FR_TRANSPARENT : FR_NONE
 
					IsTransparencySet(TO_SIGNS) ? FR_TRANSPARENT : FR_NONE
 
				);
 
			}
 
		}
 

	
 
		SetDParam(0, ss->params[0]);
 
		SetDParam(1, ss->params[1]);
 
		/* if we didn't draw a rectangle, or if transparant building is on,
 
		 * draw the text in the color the rectangle would have */
 
		if (HASBIT(_transparent_opt, TO_SIGNS) && ss->string != STR_2806 && ss->width != 0) {
 
		if (IsTransparencySet(TO_SIGNS) && ss->string != STR_2806 && ss->width != 0) {
 
			/* Real colors need the IS_PALETTE_COLOR flag
 
			 * otherwise colors from _string_colormap are assumed. */
 
			colour = _colour_gradient[ss->color][6] | IS_PALETTE_COLOR;
 
		} else {
 
			colour = TC_BLACK;
 
		}
src/water_cmd.cpp
Show inline comments
 
@@ -27,12 +27,13 @@
 
#include "roadveh.h"
 
#include "water_map.h"
 
#include "industry_map.h"
 
#include "newgrf.h"
 
#include "newgrf_canal.h"
 
#include "misc/autoptr.hpp"
 
#include "transparency.h"
 

	
 
/** Array for the shore sprites */
 
static const SpriteID _water_shore_sprites[] = {
 
	0,
 
	SPR_SHORE_TILEH_1,  // SLOPE_W
 
	SPR_SHORE_TILEH_2,  // SLOPE_S
 
@@ -446,13 +447,13 @@ static void DrawWaterStuff(const TileInf
 

	
 
	for (; wdts->delta_x != 0x80; wdts++) {
 
		AddSortableSpriteToDraw(wdts->image + base + ((wdts->image < 24) ? locks_base : 0), palette,
 
			ti->x + wdts->delta_x, ti->y + wdts->delta_y,
 
			wdts->width, wdts->height,
 
			wdts->unk, ti->z + wdts->delta_z,
 
			HASBIT(_transparent_opt, TO_BUILDINGS));
 
			IsTransparencySet(TO_BUILDINGS));
 
	}
 
}
 

	
 
static void DrawTile_Water(TileInfo *ti)
 
{
 
	switch (GetWaterTileType(ti->tile)) {
0 comments (0 inline, 0 general)