diff options
author | frosch <frosch@openttd.org> | 2008-10-18 17:21:56 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-10-18 17:21:56 +0000 |
commit | 1505c8f3843667dff95d7c71ee076c42ed4c1ab4 (patch) | |
tree | 9039e308f0d1ea5cf472eeac69885f8c155b5db8 /src | |
parent | 3d7ab65557c0c4533debbbb500e6f74edf84736a (diff) | |
download | openttd-1505c8f3843667dff95d7c71ee076c42ed4c1ab4.tar.xz |
(svn r14488) -Fix: Synchronize drawing of spritelayouts in DrawTileLayout (Houses), IndustryDrawTileLayout, DrawStationTile, DrawTile_Station and DrawTile_Track (Waypoint).
Now transparency options, PALETTE_MODIFIER_TRANSPARENT and SPRITE_MODIFIER_OPAQUE should work for all of them.
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf_house.cpp | 9 | ||||
-rw-r--r-- | src/newgrf_industrytiles.cpp | 7 | ||||
-rw-r--r-- | src/rail_cmd.cpp | 13 | ||||
-rw-r--r-- | src/station_cmd.cpp | 3 |
4 files changed, 20 insertions, 12 deletions
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index b7907945f..296139caa 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -421,7 +421,7 @@ uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, House 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, const SpriteGroup *group, byte stage, Ho 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, const SpriteGroup *group, byte stage, Ho 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 index 3ca228889..50bdcba4b 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -167,7 +167,7 @@ static void NewIndustryTileResolver(ResolverObject *res, IndustryGfx gfx, TileIn 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 TileInfo *ti, const SpriteGroup *group, byte r 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 TileInfo *ti, const SpriteGroup *group, byte r !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 index f08a613a4..61beff3bf 100644 --- 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 index 20e9091e5..23503ddbe 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2344,7 +2344,8 @@ static void DrawTile_Station(TileInfo *ti) !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)); } } } |