diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -421,7 +421,7 @@ uint16 GetHouseCallback(CallbackID callb return group->g.callback.result; } -void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, HouseID house_id) +static void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, HouseID house_id) { const DrawTileSprites *dts = group->g.layout.dts; const DrawTileSeqStruct *dtss; @@ -444,7 +444,7 @@ void DrawTileLayout(const TileInfo *ti, if (IS_CUSTOM_SPRITE(image)) image += stage; - if ((HasBit(image, SPRITE_MODIFIER_OPAQUE) || !IsTransparencySet(TO_HOUSES)) && HasBit(image, PALETTE_MODIFIER_COLOR)) { + if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOR)) { if (pal == 0) { const HouseSpec *hs = GetHouseSpecs(house_id); if (HasBit(hs->callback_mask, CBM_HOUSE_COLOUR)) { @@ -467,10 +467,11 @@ void DrawTileLayout(const TileInfo *ti, ti->x + dtss->delta_x, ti->y + dtss->delta_y, dtss->size_x, dtss->size_y, dtss->size_z, ti->z + dtss->delta_z, - IsTransparencySet(TO_HOUSES) + !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_HOUSES) ); } else { - AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, IsTransparencySet(TO_HOUSES)); + /* For industries and houses delta_x and delta_y are unsigned */ + AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_HOUSES)); } } } diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -167,7 +167,7 @@ static void NewIndustryTileResolver(Reso res->grffile = (its != NULL ? its->grf_prop.grffile : NULL); } -void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte rnd_color, byte stage, IndustryGfx gfx) +static void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte rnd_color, byte stage, IndustryGfx gfx) { const DrawTileSprites *dts = group->g.layout.dts; const DrawTileSeqStruct *dtss; @@ -198,7 +198,7 @@ void IndustryDrawTileLayout(const TileIn if (IS_CUSTOM_SPRITE(image)) image += stage; - if (HasBit(image, PALETTE_MODIFIER_COLOR)) { + if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOR)) { if (pal == 0) { pal = GENERAL_SPRITE_COLOR(rnd_color); } @@ -215,7 +215,8 @@ void IndustryDrawTileLayout(const TileIn !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_INDUSTRIES) ); } else { - AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, IsTransparencySet(TO_INDUSTRIES)); + /* For industries and houses delta_x and delta_y are unsigned */ + AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_INDUSTRIES)); } } } diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2014,10 +2014,14 @@ default_waypoint: image += relocation; } - if (!(!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)) && HasBit(image, PALETTE_MODIFIER_COLOR)) { - pal = _drawtile_track_palette; + if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOR)) { + if (dtss->image.pal != 0) { + pal = dtss->image.pal; + } else { + pal = _drawtile_track_palette; + } } else { - pal = dtss->image.pal; + pal = PAL_NONE; } if ((byte)dtss->delta_z != 0x80) { @@ -2029,7 +2033,8 @@ default_waypoint: !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS) ); } else { - AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y); + /* For stations and original spritelayouts delta_x and delta_y are signed */ + AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)); } } } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2344,7 +2344,8 @@ static void DrawTile_Station(TileInfo *t !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS) ); } else { - AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, IsTransparencySet(TO_BUILDINGS)); + /* For stations and original spritelayouts delta_x and delta_y are signed */ + AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)); } } }