forked from mirror/OpenTTD
(svn r18762) -Codechange: unduplicate sprite layout drawing between industries and houses
This commit is contained in:
@@ -403,7 +403,6 @@ uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, House
|
||||
static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte stage, HouseID house_id)
|
||||
{
|
||||
const DrawTileSprites *dts = group->dts;
|
||||
const DrawTileSeqStruct *dtss;
|
||||
|
||||
const HouseSpec *hs = HouseSpec::Get(house_id);
|
||||
SpriteID palette = hs->random_colour[TileHash2Bit(ti->x, ti->y)] + PALETTE_RECOLOUR_START;
|
||||
@@ -424,32 +423,7 @@ static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *grou
|
||||
DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette));
|
||||
}
|
||||
|
||||
foreach_draw_tile_seq(dtss, dts->seq) {
|
||||
if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
|
||||
|
||||
image = dtss->image.sprite;
|
||||
pal = dtss->image.pal;
|
||||
|
||||
/* Stop drawing sprite sequence once we meet a sprite that doesn't have to be opaque */
|
||||
if (IsInvisibilitySet(TO_HOUSES) && !HasBit(image, SPRITE_MODIFIER_OPAQUE)) return;
|
||||
|
||||
if (IS_CUSTOM_SPRITE(image)) image += stage;
|
||||
|
||||
pal = SpriteLayoutPaletteTransform(image, pal, palette);
|
||||
|
||||
if ((byte)dtss->delta_z != 0x80) {
|
||||
AddSortableSpriteToDraw(
|
||||
image, pal,
|
||||
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) && IsTransparencySet(TO_HOUSES)
|
||||
);
|
||||
} else {
|
||||
/* 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));
|
||||
}
|
||||
}
|
||||
DrawTileSeq(ti, dts, TO_HOUSES, stage, palette);
|
||||
}
|
||||
|
||||
void DrawNewHouseTile(TileInfo *ti, HouseID house_id)
|
||||
|
Reference in New Issue
Block a user