From a2256f6b0f87eb8bca4c78b738613049efc8cd17 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 30 Sep 2007 19:33:40 +0000 Subject: (svn r11190) -Fix: make snowy roofs of (newgrf) houses also transparent. --- src/newgrf_house.cpp | 2 +- src/newgrf_industrytiles.cpp | 2 +- src/station_cmd.cpp | 2 +- src/viewport.cpp | 8 +++++++- src/viewport.h | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index 49679017d..b7718ee62 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -346,7 +346,7 @@ void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, Ho HASBIT(_transparent_opt, TO_HOUSES) ); } else { - AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y); + AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, HASBIT(_transparent_opt, TO_HOUSES)); } } } diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index 22a50df8b..6c3c40c99 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -196,7 +196,7 @@ void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte r !HASBIT(image, SPRITE_MODIFIER_OPAQUE) && HASBIT(_transparent_opt, TO_INDUSTRIES) ); } else { - AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y); + AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, HASBIT(_transparent_opt, TO_INDUSTRIES)); } } } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 28ac9e134..ef27fc4a6 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2115,7 +2115,7 @@ static void DrawTile_Station(TileInfo *ti) HASBIT(_transparent_opt, TO_BUILDINGS) ); } else { - AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y); + AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, HASBIT(_transparent_opt, TO_BUILDINGS)); } } } diff --git a/src/viewport.cpp b/src/viewport.cpp index a33df3db3..b23f4d1f2 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -613,13 +613,19 @@ void EndSpriteCombine() _cur_vd->combine_sprites = 0; } -void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y) +void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent) { ViewportDrawer *vd = _cur_vd; ChildScreenSpriteToDraw *cs; assert((image & SPRITE_MASK) < MAX_SPRITES); + /* make the sprites transparent with the right palette */ + if (transparent) { + SETBIT(image, PALETTE_MODIFIER_TRANSPARENT); + pal = PALETTE_TO_TRANSPARENT; + } + if (vd->spritelist_mem >= vd->eof_spritelist_mem) { DEBUG(sprite, 0, "Out of sprite memory"); return; diff --git a/src/viewport.h b/src/viewport.h index 4bd9fec5a..869bbee1a 100644 --- a/src/viewport.h +++ b/src/viewport.h @@ -61,7 +61,7 @@ void DrawGroundSprite(SpriteID image, SpriteID pal); void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z); void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent = false, int bb_offset_x = 0, int bb_offset_y = 0, int bb_offset_z = 0); void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2); -void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y); +void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false); void StartSpriteCombine(); -- cgit v1.2.3-70-g09d2