Index: elrail.c =================================================================== --- elrail.c (revision 7493) +++ elrail.c (working copy) @@ -261,6 +261,7 @@ if ((PPPallowed[i] & PPPpreferred[i]) != 0) PPPallowed[i] &= PPPpreferred[i]; if (PPPallowed[i] != 0 && HASBIT(PCPstatus, i) && !HASBIT(OverridePCP, i)) { + uint32 pylon; for (k = 0; k < DIR_END; k++) { byte temp = PPPorder[i][GetTLG(ti->tile)][k]; @@ -275,8 +276,11 @@ continue; /* No neighbour, go looking for a better position */ } - AddSortableSpriteToDraw(pylons_normal[temp], x, y, 1, 1, 10, + pylon=pylons_normal[temp]; + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(pylon); + AddSortableSpriteToDraw(pylon, x, y, 1, 1, 10, GetSlopeZ(ti->x + x_pcp_offsets[i], ti->y + y_pcp_offsets[i])); + if (_display_opt & DO_TRANS_BUILDINGS) return; break; /* We already have drawn a pylon, bail out */ } } @@ -298,6 +302,7 @@ byte PCPconfig = HASBIT(PCPstatus, PCPpositions[t][0]) + (HASBIT(PCPstatus, PCPpositions[t][1]) << 1); + uint32 img; const SortableSpriteStruct *sss; int tileh_selector = !(tileh[TS_HOME] % 3) * tileh[TS_HOME] / 3; /* tileh for the slopes, 0 otherwise */ @@ -305,8 +310,16 @@ assert(!IsSteepSlope(tileh[TS_HOME])); sss = &CatenarySpriteData[Wires[tileh_selector][t][PCPconfig]]; - AddSortableSpriteToDraw( sss->image, 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); + img=sss->image; + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(img); + AddSortableSpriteToDraw( img, + 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); + if (_display_opt & DO_TRANS_BUILDINGS) return; } } } @@ -320,6 +333,7 @@ uint num = DistanceMax(ti->tile, start); uint height; + uint32 img; const SortableSpriteStruct *sss; Axis axis = GetBridgeAxis(ti->tile); TLG tlg = GetTLG(ti->tile); @@ -334,10 +348,11 @@ /* Draw "long" wires on all other tiles of the bridge (one pylon every two tiles) */ sss = &CatenarySpriteData[WIRE_X_FLAT_SW + (num % 2) + offset]; } - + + img=sss->image; height = GetBridgeHeight(ti->tile); - - AddSortableSpriteToDraw( sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset, + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(img); + AddSortableSpriteToDraw( img, ti->x + sss->x_offset, ti->y + sss->y_offset, sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset ); @@ -345,18 +360,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)], ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height); + img=pylons_bridge[0 + HASBIT(tlg, 0)]; + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(img); + AddSortableSpriteToDraw( img, ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height); } else { - AddSortableSpriteToDraw(pylons_bridge[2 + HASBIT(tlg, 1)], ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y, 1, 1, 10, height); + img=pylons_bridge[2 + HASBIT(tlg, 1)]; + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(img); + AddSortableSpriteToDraw( img, 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)], ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height); + img=pylons_bridge[0 + HASBIT(tlg, 0)]; + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(img); + AddSortableSpriteToDraw( img, ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height); } else { - AddSortableSpriteToDraw(pylons_bridge[2 + HASBIT(tlg, 1)], ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, height); + img=pylons_bridge[2 + HASBIT(tlg, 1)]; + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(img); + AddSortableSpriteToDraw( img, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, height); } } } @@ -370,8 +393,10 @@ if (IsRailDepot(ti->tile)) { const SortableSpriteStruct* sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)]; - AddSortableSpriteToDraw( - sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset, + uint32 img; + img=sss->image; + if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(img); + AddSortableSpriteToDraw( img, 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 ); Index: industry_cmd.c =================================================================== --- industry_cmd.c (revision 7493) +++ industry_cmd.c (working copy) @@ -236,7 +236,7 @@ if (image & PALETTE_MODIFIER_COLOR && (image & PALETTE_SPRITE_MASK) == 0) image |= ormod; - if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); + if (_display_opt & DO_TRANS_INDUSTRIES) MAKE_TRANSPARENT(image); AddSortableSpriteToDraw(image, ti->x + dits->subtile_x, @@ -246,7 +246,7 @@ dits->dz, z); - if (_display_opt & DO_TRANS_BUILDINGS) return; + if (_display_opt & DO_TRANS_INDUSTRIES) return; } { Index: lang/english.txt =================================================================== --- lang/english.txt (revision 7493) +++ lang/english.txt (working copy) @@ -777,8 +777,11 @@ STR_WAYPOINTS_DISPLAYED2 :{SETX 12}Waypoints displayed STR_02D0_FULL_ANIMATION :{SETX 12}Full animation STR_02D2_FULL_DETAIL :{SETX 12}Full detail +STR_TRANSPARENT_SIGNS :{SETX 12}Transparent station signs +STR_TRANSPARENT_TREES :{SETX 12}Transparent trees +STR_TRANSPARENT_HOUSES :{SETX 12}Transparent houses +STR_TRANSPARENT_INDUSTRIES :{SETX 12}Transparent industries STR_02D4_TRANSPARENT_BUILDINGS :{SETX 12}Transparent buildings -STR_TRANSPARENT_SIGNS :{SETX 12}Transparent station signs ############ range ends here ############ range for menu starts @@ -1122,6 +1125,7 @@ STR_CONFIG_PATCHES_TOOLBAR_POS_RIGHT :Right STR_CONFIG_PATCHES_SNAP_RADIUS :{LTBLUE}Window snap radius: {ORANGE}{STRING1} px STR_CONFIG_PATCHES_SNAP_RADIUS_DISABLED :{LTBLUE}Window snap radius: {ORANGE}disabled +STR_CONFIG_PATCHES_TRANSPARENCY_MEM :{LTBLUE}Toggle transparency memorization: {ORANGE}{STRING1} STR_CONFIG_PATCHES_GUI :{BLACK}Interface STR_CONFIG_PATCHES_CONSTRUCTION :{BLACK}Construction Index: main_gui.c =================================================================== --- main_gui.c (revision 7493) +++ main_gui.c (working copy) @@ -161,8 +161,11 @@ 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: _display_opt ^= DO_TRANS_SIGNS; break; + case 12: _display_opt ^= DO_TRANS_TREES; break; + case 13: _display_opt ^= DO_TRANS_HOUSES; break; + case 14: _display_opt ^= DO_TRANS_INDUSTRIES; break; + case 15: _display_opt ^= DO_TRANS_BUILDINGS; break; } MarkWholeScreenDirty(); } @@ -955,7 +958,7 @@ { uint16 x = 0; - w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 13, 0); + w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 16, 0); if (_display_opt & DO_SHOW_TOWN_NAMES) SETBIT(x, 5); if (_display_opt & DO_SHOW_STATION_NAMES) SETBIT(x, 6); @@ -963,8 +966,11 @@ 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 (_display_opt & DO_TRANS_SIGNS) SETBIT(x, 11); + if (_display_opt & DO_TRANS_TREES) SETBIT(x, 12); + if (_display_opt & DO_TRANS_HOUSES) SETBIT(x, 13); + if (_display_opt & DO_TRANS_INDUSTRIES) SETBIT(x, 14); + if (_display_opt & DO_TRANS_BUILDINGS) SETBIT(x, 15); WP(w,menu_d).checked_items = x; } @@ -2296,11 +2302,39 @@ break; #endif - case 'X': - _display_opt ^= DO_TRANS_BUILDINGS; - MarkWholeScreenDirty(); - break; + case 'X' | WKC_CTRL: { //make only player buildings transparent + _display_opt ^= DO_TRANS_BUILDINGS; + MarkWholeScreenDirty(); + break; + } + case 'X': { //toggle all transparent (as normal behaviour) + static byte trans_opt = 0xF; + if (GB(_display_opt, 7, 4) == 0) { + // If transparency is off, set to our remembered selection. + if (_patches.memorize_transp) SB(_display_opt, 7, 4, trans_opt); + else SB(_display_opt,7,4,0xF); + } else { + // Remember the existing selection, and then clear it. + if (_patches.memorize_transp) trans_opt = GB(_display_opt, 7, 4); + SB(_display_opt, 7, 4, 0); + } + MarkWholeScreenDirty(); + break; + } + + case 'X' | WKC_SHIFT: { //cycle transparency + bool add_bit = false; + byte temp_trans_opt = GB(_display_opt, 7, 4); + + if (!HASBIT(temp_trans_opt, 3)) add_bit = true; + temp_trans_opt <<= 1; + if (add_bit) temp_trans_opt |= 1; + SB(_display_opt, 7, 4, temp_trans_opt); + MarkWholeScreenDirty(); + break; + } + #ifdef ENABLE_NETWORK case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all if (_networking) { @@ -2452,3 +2486,4 @@ } + Index: news_gui.c =================================================================== --- news_gui.c (revision 7493) +++ news_gui.c (working copy) @@ -136,7 +136,10 @@ DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56, ni->string_id, 426); } else { - byte bk = _display_opt; + uint16 bk = _display_opt; + _display_opt &= ~DO_TRANS_TREES; + _display_opt &= ~DO_TRANS_HOUSES; + _display_opt &= ~DO_TRANS_INDUSTRIES; _display_opt &= ~DO_TRANS_BUILDINGS; DrawWindowViewport(w); _display_opt = bk; Index: openttd.c =================================================================== --- openttd.c (revision 7493) +++ openttd.c (working copy) @@ -280,7 +280,10 @@ char filename[256]; _game_mode = GM_MENU; - CLRBITS(_display_opt, DO_TRANS_BUILDINGS); // don't make buildings transparent in intro + CLRBITS(_display_opt, DO_TRANS_TREES); // don't make buildings, trees, etc transparent in intro + CLRBITS(_display_opt, DO_TRANS_HOUSES); + CLRBITS(_display_opt, DO_TRANS_INDUSTRIES); + CLRBITS(_display_opt, DO_TRANS_BUILDINGS); _opt_ptr = &_opt_newgame; ResetGRFConfig(false); Index: openttd.h =================================================================== --- openttd.h (revision 7493) +++ openttd.h (working copy) @@ -154,10 +154,13 @@ 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, + DO_FULL_DETAIL = 1 << 4, + DO_WAYPOINTS = 1 << 5, + DO_TRANS_SIGNS = 1 << 6, + DO_TRANS_TREES = 1 << 7, + DO_TRANS_HOUSES = 1 << 8, + DO_TRANS_INDUSTRIES = 1 << 9, + DO_TRANS_BUILDINGS = 1 << 10, }; /* Landscape types */ Index: settings.c =================================================================== --- settings.c (revision 7493) +++ settings.c (working copy) @@ -1180,8 +1180,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_VAR("news_display_opt", SLE_UINT, S, 0, _news_display_opt,0xAAAAAAAA,0,0xAAAAAAAA,0,STR_NULL, NULL), // default to all full messages: 10101010101010101010 = 0xAAAAAAAA + SDTG_MMANY("display_opt", SLE_UINT16,S, 0, _display_opt, (DO_SHOW_TOWN_NAMES|DO_SHOW_STATION_NAMES|DO_SHOW_SIGNS|DO_FULL_ANIMATION|DO_FULL_DETAIL|DO_WAYPOINTS|DO_TRANS_TREES|DO_TRANS_HOUSES|DO_TRANS_INDUSTRIES|DO_TRANS_BUILDINGS), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|FULL_DETAIL|DO_WAYPOINTS|DO_TRANS_TREES|DO_TRANS_HOUSES|DO_TRANS_INDUSTRIES|DO_TRANS_BUILDINGS", STR_NULL, NULL), SDTG_VAR("news_display_opt", SLE_UINT, S, 0, _news_display_opt,0xAAAAAAAA,0,0xAAAAAAAA,0,STR_NULL, NULL), // default to all full messages: 10101010101010101010 = 0xAAAAAAAA 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), @@ -1281,6 +1280,7 @@ SDT_BOOL(Patches, link_terraform_toolbar, S, 0, false, STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,NULL), SDT_VAR(Patches, liveries, SLE_UINT8, S,MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_LIVERIES, RedrawScreen), SDT_BOOL(Patches, prefer_teamchat, S, 0, false, STR_CONFIG_PATCHES_PREFER_TEAMCHAT, NULL), + SDT_BOOL(Patches, memorize_transp, S, 0, false, STR_CONFIG_PATCHES_TRANSPARENCY_MEM ,NULL), /***************************************************************************/ /* Construction section of the GUI-configure patches window */ Index: settings_gui.c =================================================================== --- settings_gui.c (revision 7493) +++ settings_gui.c (working copy) @@ -573,6 +573,7 @@ "link_terraform_toolbar", "liveries", "prefer_teamchat", + "memorize_transp", }; static const char *_patches_construction[] = { Index: town_cmd.c =================================================================== --- town_cmd.c (revision 7493) +++ town_cmd.c (working copy) @@ -124,7 +124,7 @@ /* Add a house on top of the ground? */ image = dcts->building; if (image != 0) { - if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); + if (_display_opt & DO_TRANS_HOUSES) MAKE_TRANSPARENT(image); AddSortableSpriteToDraw(image, ti->x + dcts->subtile_x, @@ -135,7 +135,7 @@ ti->z ); - if (_display_opt & DO_TRANS_BUILDINGS) return; + if (_display_opt & DO_TRANS_HOUSES) return; } { Index: tree_cmd.c =================================================================== --- tree_cmd.c (revision 7493) +++ tree_cmd.c (working copy) @@ -358,7 +358,7 @@ StartSpriteCombine(); - if (!(_display_opt & DO_TRANS_BUILDINGS) || !_patches.invisible_trees) { + if (!(_display_opt & DO_TRANS_TREES) || !_patches.invisible_trees) { TreeListEnt te[4]; uint i; @@ -366,7 +366,7 @@ i = GetTreeCount(ti->tile) + 1; do { uint32 image = s[0] + (--i == 0 ? GetTreeGrowth(ti->tile) : 3); - if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); + if (_display_opt & DO_TRANS_TREES) MAKE_TRANSPARENT(image); te[i].image = image; te[i].x = d->x; te[i].y = d->y; Index: unmovable_cmd.c =================================================================== --- unmovable_cmd.c (revision 7493) +++ unmovable_cmd.c (working copy) @@ -119,7 +119,7 @@ dtus = &_draw_tile_unmovable_data[GetUnmovableType(ti->tile)]; image = dtus->image; - if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); + if (_display_opt & DO_TRANS_HOUSES) MAKE_TRANSPARENT(image); AddSortableSpriteToDraw( image, ti->x | dtus->subcoord_x, ti->y | dtus->subcoord_y, @@ -133,7 +133,7 @@ image = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)); image += PALETTE_MODIFIER_COLOR | SPR_STATUE_COMPANY; - if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); + if (_display_opt & DO_TRANS_HOUSES) MAKE_TRANSPARENT(image); AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 25, ti->z); break; @@ -160,7 +160,7 @@ foreach_draw_tile_seq(dtss, t->seq) { image = dtss->image; - if (_display_opt & DO_TRANS_BUILDINGS) { + if (_display_opt & DO_TRANS_HOUSES) { MAKE_TRANSPARENT(image); } else { image |= ormod; Index: variables.h =================================================================== --- variables.h (revision 7493) +++ variables.h (working copy) @@ -214,6 +214,8 @@ bool population_in_label; // Show the population of a town in his label? + bool memorize_transp; //memorize transparency options to toggle between reset and memorized instead of set-reset + uint8 freight_trains; ///< Value to multiply the weight of cargo by /** YAPF settings */ @@ -275,7 +277,7 @@ VARDEF bool _do_autosave; VARDEF int _autosave_ctr; -VARDEF byte _display_opt; +VARDEF uint16 _display_opt; VARDEF byte _pause; VARDEF int _caret_timer; VARDEF uint32 _news_display_opt;