Index: projects/openttd.vcproj =================================================================== --- projects/openttd.vcproj (revision 11293) +++ projects/openttd.vcproj (working copy) @@ -685,6 +685,9 @@ RelativePath=".\..\src\train.h"> + + + + Index: source.list =================================================================== --- source.list (revision 11293) +++ source.list (working copy) @@ -194,6 +194,7 @@ timetable.h town.h train.h +transparency.h transparency_gui.h variables.h vehicle.h Index: src/elrail.cpp =================================================================== --- src/elrail.cpp (revision 11293) +++ src/elrail.cpp (working copy) @@ -65,6 +65,7 @@ #include "vehicle.h" #include "train.h" #include "gui.h" +#include "transparency.h" static inline TLG GetTLG(TileIndex t) { @@ -195,7 +196,7 @@ 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), + IsTransparentOptionSet(TO_BUILDINGS), BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset ); } @@ -334,7 +335,7 @@ 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); + IsTransparentOptionSet(TO_BUILDINGS), -1, -1); break; /* We already have drawn a pylon, bail out */ } } @@ -342,7 +343,7 @@ } /* 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) && !IsTransparentOptionSet(TO_BUILDINGS)) { uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; @@ -369,7 +370,7 @@ */ 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)); + IsTransparentOptionSet(TO_BUILDINGS)); } } } @@ -402,7 +403,7 @@ 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) + IsTransparentOptionSet(TO_BUILDINGS) ); /* Finished with wires, draw pylons */ @@ -413,7 +414,7 @@ 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, IsTransparentOptionSet(TO_BUILDINGS), -1, -1); } /* need a pylon on the southern end of the bridge */ @@ -423,7 +424,7 @@ 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, IsTransparentOptionSet(TO_BUILDINGS), -1, -1); } } @@ -449,7 +450,7 @@ 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) + IsTransparentOptionSet(TO_BUILDINGS) ); return; } Index: src/industry_cmd.cpp =================================================================== --- src/industry_cmd.cpp (revision 11293) +++ src/industry_cmd.cpp (working copy) @@ -38,6 +38,7 @@ #include "newgrf_callbacks.h" #include "misc/autoptr.hpp" #include "autoslope.h" +#include "transparency.h" void ShowIndustryViewWindow(int industry); void BuildOilRig(TileIndex tile); @@ -310,9 +311,9 @@ dits->height, dits->dz, ti->z, - HASBIT(_transparent_opt, TO_INDUSTRIES)); + IsTransparentOptionSet(TO_INDUSTRIES)); - if (HASBIT(_transparent_opt, TO_INDUSTRIES)) return; + if (IsTransparentOptionSet(TO_INDUSTRIES)) return; } { Index: src/main_gui.cpp =================================================================== --- src/main_gui.cpp (revision 11293) +++ src/main_gui.cpp (working copy) @@ -41,6 +41,7 @@ #include "vehicle_gui.h" #include "transparency_gui.h" #include "newgrf_config.h" +#include "transparency.h" #include "network/network_data.h" #include "network/network_client.h" @@ -987,8 +988,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 (GB(_transparent_opt, 1, 7) != 0) SETBIT(x, 12); + if (IsTransparentOptionSet(TO_SIGNS)) SETBIT(x, 13); WP(w,menu_d).checked_items = x; } @@ -2417,3 +2418,4 @@ + Index: src/newgrf_house.cpp =================================================================== --- src/newgrf_house.cpp (revision 11293) +++ src/newgrf_house.cpp (working copy) @@ -15,6 +15,7 @@ #include "sound.h" #include "sprite.h" #include "strings.h" +#include "transparency.h" #include "table/strings.h" #include "table/sprites.h" #include "table/town_land.h" @@ -320,7 +321,7 @@ 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) || !IsTransparentOptionSet(TO_HOUSES)) && HASBIT(image, PALETTE_MODIFIER_COLOR)) { if (pal == 0) { const HouseSpec *hs = GetHouseSpecs(house_id); if (HASBIT(hs->callback_mask, CBM_HOUSE_COLOUR)) { @@ -343,10 +344,10 @@ 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) + IsTransparentOptionSet(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, IsTransparentOptionSet(TO_HOUSES)); } } } Index: src/newgrf_industrytiles.cpp =================================================================== --- src/newgrf_industrytiles.cpp (revision 11293) +++ src/newgrf_industrytiles.cpp (working copy) @@ -9,6 +9,7 @@ #include "debug.h" #include "viewport.h" #include "landscape.h" +#include "transparency.h" #include "newgrf.h" #include "industry.h" #include "newgrf_commons.h" @@ -193,10 +194,10 @@ 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) && IsTransparentOptionSet(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, IsTransparentOptionSet(TO_INDUSTRIES)); } } } Index: src/news_gui.cpp =================================================================== --- src/news_gui.cpp (revision 11293) +++ src/news_gui.cpp (working copy) @@ -17,6 +17,7 @@ #include "variables.h" #include "date.h" #include "string.h" +#include "transparency.h" /** @file news_gui.cpp * Index: src/openttd.cpp =================================================================== --- src/openttd.cpp (revision 11293) +++ src/openttd.cpp (working copy) @@ -77,6 +77,7 @@ #include "industry_map.h" #include "unmovable_map.h" #include "tree_map.h" +#include "transparency.h" #include Index: src/openttd.h =================================================================== --- src/openttd.h (revision 11293) +++ src/openttd.h (working copy) @@ -185,16 +185,6 @@ DO_WAYPOINTS = 6, }; -enum { - TO_SIGNS, - TO_TREES, - TO_HOUSES, - TO_INDUSTRIES, - TO_BUILDINGS, - TO_BRIDGES, - TO_STRUCTURES, - TO_LOADING, -}; /* Landscape types */ enum { Index: src/rail_cmd.cpp =================================================================== --- src/rail_cmd.cpp (revision 11293) +++ src/rail_cmd.cpp (working copy) @@ -40,6 +40,7 @@ #include "train.h" #include "misc/autoptr.hpp" #include "autoslope.h" +#include "transparency.h" const byte _track_sloped_sprites[14] = { 14, 15, 22, 13, @@ -1587,7 +1588,7 @@ image += relocation; } - if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) { + if (!IsTransparentOptionSet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) { pal = _drawtile_track_palette; } else { pal = dtss->pal; @@ -1599,7 +1600,7 @@ 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) + IsTransparentOptionSet(TO_BUILDINGS) ); } else { AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y); Index: src/road_cmd.cpp =================================================================== --- src/road_cmd.cpp (revision 11293) +++ src/road_cmd.cpp (working copy) @@ -33,6 +33,7 @@ #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 */ @@ -946,7 +947,7 @@ 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) && !IsTransparentOptionSet(TO_BUILDINGS)) { uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; @@ -963,8 +964,8 @@ 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, IsTransparentOptionSet(TO_BUILDINGS)); + AddSortableSpriteToDraw(front, PAL_NONE, ti->x, ti->y, 16, 16, TILE_HEIGHT + BB_HEIGHT_UNDER_BRIDGE, ti->z, IsTransparentOptionSet(TO_BUILDINGS)); } /** @@ -1120,7 +1121,7 @@ SpriteID image = dtss->image; SpriteID pal; - if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) { + if (!IsTransparentOptionSet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) { pal = palette; } else { pal = PAL_NONE; @@ -1131,7 +1132,7 @@ 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) + IsTransparentOptionSet(TO_BUILDINGS) ); } break; Index: src/station_cmd.cpp =================================================================== --- src/station_cmd.cpp (revision 11293) +++ src/station_cmd.cpp (working copy) @@ -43,6 +43,7 @@ #include "cargotype.h" #include "strings.h" #include "autoslope.h" +#include "transparency.h" DEFINE_OLD_POOL_GENERIC(Station, Station) DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop) @@ -2100,7 +2101,7 @@ } SpriteID pal; - if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) { + if (!IsTransparentOptionSet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) { pal = palette; } else { pal = dtss->pal; @@ -2112,10 +2113,10 @@ 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) + IsTransparentOptionSet(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, IsTransparentOptionSet(TO_BUILDINGS)); } } } Index: src/texteff.cpp =================================================================== --- src/texteff.cpp (revision 11293) +++ src/texteff.cpp (working copy) @@ -14,6 +14,7 @@ #include "console.h" #include "string.h" #include "variables.h" +#include "transparency.h" #include "table/sprites.h" #include "blitter/factory.hpp" #include /* va_list */ @@ -390,7 +391,7 @@ 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 && !IsTransparentOptionSet(TO_LOADING))) { AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2); } } @@ -405,7 +406,7 @@ 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 && !IsTransparentOptionSet(TO_LOADING))) { AddStringToDraw(te->x, te->y, (StringID)(te->string_id - 1), te->params_1, te->params_2); } } Index: src/town_cmd.cpp =================================================================== --- src/town_cmd.cpp (revision 11293) +++ src/town_cmd.cpp (working copy) @@ -42,6 +42,7 @@ #include "newgrf_townname.h" #include "misc/autoptr.hpp" #include "autoslope.h" +#include "transparency.h" #include "waypoint.h" /* Initialize the town-pool */ @@ -183,10 +184,10 @@ dcts->height, dcts->dz, ti->z, - HASBIT(_transparent_opt, TO_HOUSES) + IsTransparentOptionSet(TO_HOUSES) ); - if (HASBIT(_transparent_opt, TO_HOUSES)) return; + if (IsTransparentOptionSet(TO_HOUSES)) return; } { Index: src/transparency.h =================================================================== --- src/transparency.h (revision 0) +++ src/transparency.h (revision 0) @@ -0,0 +1,27 @@ +/* $Id$ */ + +/** @file transparency.h */ + +#ifndef TRANSPARENCY_H +#define TRANSPARENCY_H + +extern byte _transparent_opt; ///< transparent bits + +/* Transparency option bits */ +enum TransparencyOptions { + TO_SIGNS, ///< Signs. Must be first, some parts of code suppose that + TO_TREES, ///< Trees + TO_HOUSES, ///< Town buildings + TO_INDUSTRIES, ///< Industries + TO_BUILDINGS, ///< Player buildings - depots, stations, ... + TO_BRIDGES, ///< Bridges + TO_STRUCTURES, ///< Unmovable structures + TO_LOADING, ///< Loading indicators +}; + +static inline bool IsTransparentOptionSet(TransparencyOptions what) +{ + return HASBIT(_transparent_opt, what); +} + +#endif /* TRANSPARENCY_H */ Property changes on: src\transparency.h ___________________________________________________________________ Name: svn:keywords + Id Name: svn:eol-style + native Index: src/transparency_gui.cpp =================================================================== --- src/transparency_gui.cpp (revision 11293) +++ src/transparency_gui.cpp (working copy) @@ -11,7 +11,10 @@ #include "gfx.h" #include "sound.h" #include "variables.h" +#include "transparency.h" +byte _transparent_opt; ///< transparent bits, see transparency.h for enum + enum TransparencyToolbarWidgets{ /* Widgets not toggled when pressing the X key */ TTW_WIDGET_SIGNS = 3, ///< Make signs background transparent Index: src/tree_cmd.cpp =================================================================== --- src/tree_cmd.cpp (revision 11293) +++ src/tree_cmd.cpp (working copy) @@ -20,6 +20,7 @@ #include "sound.h" #include "variables.h" #include "genworld.h" +#include "transparency.h" /** * List of tree placer algorithm. @@ -427,7 +428,7 @@ StartSpriteCombine(); - if (!HASBIT(_transparent_opt, TO_TREES) || !_patches.invisible_trees) { + if (!IsTransparentOptionSet(TO_TREES) || !_patches.invisible_trees) { TreeListEnt te[4]; uint i; @@ -460,7 +461,7 @@ 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, IsTransparentOptionSet(TO_TREES), -tep->x, -tep->y); tep->image = 0; } } Index: src/tunnelbridge_cmd.cpp =================================================================== --- src/tunnelbridge_cmd.cpp (revision 11293) +++ src/tunnelbridge_cmd.cpp (working copy) @@ -33,6 +33,7 @@ #include "date.h" #include "newgrf_sound.h" #include "autoslope.h" +#include "transparency.h" #include "table/bridge_land.h" @@ -859,12 +860,12 @@ 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, IsTransparentOptionSet(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, IsTransparentOptionSet(TO_BRIDGES), 0, 0, -5); } } } @@ -898,16 +899,16 @@ /* 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, IsTransparentOptionSet(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, IsTransparentOptionSet(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, IsTransparentOptionSet(TO_BUILDINGS), front_bb_offset_x[offset], front_bb_offset_y[offset]); } /** @@ -970,7 +971,7 @@ 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, IsTransparentOptionSet(TO_BUILDINGS), BB_data[8], BB_data[9], BB_Z_SEPARATOR); } } else if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) { DrawCatenary(ti); @@ -1029,7 +1030,7 @@ * 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, IsTransparentOptionSet(TO_BRIDGES) ); if (GetBridgeTransportType(ti->tile) == TRANSPORT_ROAD) { @@ -1157,9 +1158,9 @@ /* 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, IsTransparentOptionSet(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, IsTransparentOptionSet(TO_BRIDGES), 0, 0, BRIDGE_Z_START); } psid++; @@ -1181,10 +1182,10 @@ /* 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, IsTransparentOptionSet(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, IsTransparentOptionSet(TO_BRIDGES), 3, 0, BRIDGE_Z_START); } /* Draw TramFront as SpriteCombine */ @@ -1196,7 +1197,7 @@ if (psid->sprite != 0) { SpriteID image = psid->sprite; SpriteID pal = psid->pal; - if (HASBIT(_transparent_opt, TO_BRIDGES)) { + if (IsTransparentOptionSet(TO_BRIDGES)) { SETBIT(image, PALETTE_MODIFIER_TRANSPARENT); pal = PALETTE_TO_TRANSPARENT; } Index: src/unmovable_cmd.cpp =================================================================== --- src/unmovable_cmd.cpp (revision 11293) +++ src/unmovable_cmd.cpp (working copy) @@ -25,6 +25,7 @@ #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 @@ -129,7 +130,7 @@ 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) + IsTransparentOptionSet(TO_STRUCTURES) ); break; } @@ -140,7 +141,7 @@ 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, IsTransparentOptionSet(TO_STRUCTURES)); break; case UNMOVABLE_OWNED_LAND: @@ -172,7 +173,7 @@ 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) + IsTransparentOptionSet(TO_STRUCTURES) ); } break; Index: src/variables.h =================================================================== --- src/variables.h (revision 11293) +++ src/variables.h (working copy) @@ -290,7 +290,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; Index: src/viewport.cpp =================================================================== --- src/viewport.cpp (revision 11293) +++ src/viewport.cpp (working copy) @@ -26,6 +26,7 @@ #include "roadveh.h" #include "vehicle_gui.h" #include "blitter/factory.hpp" +#include "transparency.h" #define VIEWPORT_DRAW_MEM (65536 * 2) @@ -1413,10 +1414,10 @@ /* 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 (!IsTransparentOptionSet(TO_SIGNS) || ss->string == STR_2806) { DrawFrameRect( x, y, x + w, bottom, ss->color, - HASBIT(_transparent_opt, TO_SIGNS) ? FR_TRANSPARENT : FR_NONE + IsTransparentOptionSet(TO_SIGNS) ? FR_TRANSPARENT : FR_NONE ); } } @@ -1425,7 +1426,7 @@ 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 (IsTransparentOptionSet(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; Index: src/water_cmd.cpp =================================================================== --- src/water_cmd.cpp (revision 11293) +++ src/water_cmd.cpp (working copy) @@ -30,6 +30,7 @@ #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[] = { @@ -449,7 +450,7 @@ 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)); + IsTransparentOptionSet(TO_BUILDINGS)); } }