mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r10696) -Codechange: remove duplication of the "make sprite transparent" code.
This commit is contained in:
parent
d031da78d8
commit
02ab86631e
@ -270,15 +270,9 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
|||||||
continue; /* No neighbour, go looking for a better position */
|
continue; /* No neighbour, go looking for a better position */
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID img = pylons_normal[temp];
|
AddSortableSpriteToDraw(pylons_normal[temp], PAL_NONE, x, y, 1, 1, 10,
|
||||||
SpriteID pal = PAL_NONE;
|
GetSlopeZ(ti->x + x_pcp_offsets[i], ti->y + y_pcp_offsets[i]),
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(img, pal, x, y, 1, 1, 10,
|
|
||||||
GetSlopeZ(ti->x + x_pcp_offsets[i], ti->y + y_pcp_offsets[i]));
|
|
||||||
break; /* We already have drawn a pylon, bail out */
|
break; /* We already have drawn a pylon, bail out */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,15 +309,9 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
|||||||
assert(!IsSteepSlope(tileh[TS_HOME]));
|
assert(!IsSteepSlope(tileh[TS_HOME]));
|
||||||
sss = &CatenarySpriteData[Wires[tileh_selector][t][PCPconfig]];
|
sss = &CatenarySpriteData[Wires[tileh_selector][t][PCPconfig]];
|
||||||
|
|
||||||
SpriteID img = sss->image;
|
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||||
SpriteID pal = PAL_NONE;
|
sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + min(sss->x_offset, TILE_SIZE - 1), ti->y + min(sss->y_offset, TILE_SIZE - 1)) + sss->z_offset,
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(img, pal, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
|
||||||
sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + min(sss->x_offset, TILE_SIZE - 1), ti->y + min(sss->y_offset, TILE_SIZE - 1)) + sss->z_offset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,41 +342,27 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
|
|||||||
|
|
||||||
height = GetBridgeHeight(end);
|
height = GetBridgeHeight(end);
|
||||||
|
|
||||||
SpriteID img = sss->image;
|
AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||||
SpriteID pal = PAL_NONE;
|
sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset,
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
HASBIT(_transparent_opt, TO_BUILDINGS)
|
||||||
SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(img, pal, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
|
||||||
sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Finished with wires, draw pylons */
|
/* Finished with wires, draw pylons */
|
||||||
/* every other tile needs a pylon on the northern end */
|
/* every other tile needs a pylon on the northern end */
|
||||||
if (num % 2) {
|
if (num % 2) {
|
||||||
if (axis == AXIS_X) {
|
if (axis == AXIS_X) {
|
||||||
img = pylons_bridge[0 + HASBIT(tlg, 0)];
|
AddSortableSpriteToDraw(pylons_bridge[0 + HASBIT(tlg, 0)], PAL_NONE, ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
AddSortableSpriteToDraw(img, pal, ti->x, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height);
|
|
||||||
} else {
|
} else {
|
||||||
img = pylons_bridge[2 + HASBIT(tlg, 1)];
|
AddSortableSpriteToDraw(pylons_bridge[2 + HASBIT(tlg, 1)], PAL_NONE, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y, 1, 1, 10, height, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
AddSortableSpriteToDraw(img, pal, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y, 1, 1, 10, height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need a pylon on the southern end of the bridge */
|
/* need a pylon on the southern end of the bridge */
|
||||||
if (DistanceMax(ti->tile, start) == length) {
|
if (DistanceMax(ti->tile, start) == length) {
|
||||||
if (axis == AXIS_X) {
|
if (axis == AXIS_X) {
|
||||||
img = pylons_bridge[0 + HASBIT(tlg, 0)];
|
AddSortableSpriteToDraw(pylons_bridge[0 + HASBIT(tlg, 0)], PAL_NONE, ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
AddSortableSpriteToDraw(img, pal, ti->x + 16, ti->y + 4 + 8 * HASBIT(tlg, 0), 1, 1, 10, height);
|
|
||||||
} else {
|
} else {
|
||||||
img = pylons_bridge[2 + HASBIT(tlg, 1)];
|
AddSortableSpriteToDraw(pylons_bridge[2 + HASBIT(tlg, 1)], PAL_NONE, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, height, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
AddSortableSpriteToDraw(img, pal, ti->x + 4 + 8 * HASBIT(tlg, 1), ti->y + 16, 1, 1, 10, height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,17 +384,11 @@ void DrawCatenary(const TileInfo *ti)
|
|||||||
if (IsRailDepot(ti->tile)) {
|
if (IsRailDepot(ti->tile)) {
|
||||||
const SortableSpriteStruct *sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
|
const SortableSpriteStruct *sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
|
||||||
|
|
||||||
SpriteID img = sss->image;
|
|
||||||
SpriteID pal = PAL_NONE;
|
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
|
||||||
SETBIT(img, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
img, pal, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
|
||||||
sss->x_size, sss->y_size, sss->z_size,
|
sss->x_size, sss->y_size, sss->z_size,
|
||||||
GetTileMaxZ(ti->tile) + sss->z_offset
|
GetTileMaxZ(ti->tile) + sss->z_offset,
|
||||||
|
HASBIT(_transparent_opt, TO_BUILDINGS)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -299,22 +299,15 @@ static void DrawTile_Industry(TileInfo *ti)
|
|||||||
/* Add industry on top of the ground? */
|
/* Add industry on top of the ground? */
|
||||||
image = dits->building.sprite;
|
image = dits->building.sprite;
|
||||||
if (image != 0) {
|
if (image != 0) {
|
||||||
if (HASBIT(_transparent_opt, TO_INDUSTRIES)) {
|
AddSortableSpriteToDraw(image,
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
(HASBIT(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) ? GENERAL_SPRITE_COLOR(ind->random_color) : dits->building.pal,
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else if (HASBIT(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) {
|
|
||||||
pal = GENERAL_SPRITE_COLOR(ind->random_color);
|
|
||||||
} else {
|
|
||||||
pal = dits->building.pal;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(image, pal,
|
|
||||||
ti->x + dits->subtile_x,
|
ti->x + dits->subtile_x,
|
||||||
ti->y + dits->subtile_y,
|
ti->y + dits->subtile_y,
|
||||||
dits->width + 1,
|
dits->width + 1,
|
||||||
dits->height + 1,
|
dits->height + 1,
|
||||||
dits->dz,
|
dits->dz,
|
||||||
z);
|
z,
|
||||||
|
HASBIT(_transparent_opt, TO_INDUSTRIES));
|
||||||
|
|
||||||
if (HASBIT(_transparent_opt, TO_INDUSTRIES)) return;
|
if (HASBIT(_transparent_opt, TO_INDUSTRIES)) return;
|
||||||
}
|
}
|
||||||
|
@ -314,10 +314,7 @@ void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, Ho
|
|||||||
image = dtss->image + stage;
|
image = dtss->image + stage;
|
||||||
pal = dtss->pal;
|
pal = dtss->pal;
|
||||||
|
|
||||||
if (!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && HASBIT(_transparent_opt, TO_HOUSES)) {
|
if ((HASBIT(image, SPRITE_MODIFIER_OPAQUE) || !HASBIT(_transparent_opt, TO_HOUSES)) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
|
||||||
if (pal == 0) {
|
if (pal == 0) {
|
||||||
const HouseSpec *hs = GetHouseSpecs(house_id);
|
const HouseSpec *hs = GetHouseSpecs(house_id);
|
||||||
if (HASBIT(hs->callback_mask, CBM_BUILDING_COLOUR)) {
|
if (HASBIT(hs->callback_mask, CBM_BUILDING_COLOUR)) {
|
||||||
@ -339,7 +336,8 @@ void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, Ho
|
|||||||
image, pal,
|
image, pal,
|
||||||
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
||||||
dtss->size_x, dtss->size_y,
|
dtss->size_x, dtss->size_y,
|
||||||
dtss->size_z, ti->z + dtss->delta_z
|
dtss->size_z, ti->z + dtss->delta_z,
|
||||||
|
HASBIT(_transparent_opt, TO_HOUSES)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
||||||
|
@ -166,10 +166,7 @@ void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte r
|
|||||||
image = dtss->image + stage;
|
image = dtss->image + stage;
|
||||||
pal = dtss->pal;
|
pal = dtss->pal;
|
||||||
|
|
||||||
if (!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && HASBIT(_transparent_opt, TO_INDUSTRIES)) {
|
if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
|
||||||
pal = GENERAL_SPRITE_COLOR(rnd_color);
|
pal = GENERAL_SPRITE_COLOR(rnd_color);
|
||||||
} else {
|
} else {
|
||||||
pal = PAL_NONE;
|
pal = PAL_NONE;
|
||||||
@ -180,7 +177,8 @@ void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte r
|
|||||||
image, pal,
|
image, pal,
|
||||||
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
||||||
dtss->size_x, dtss->size_y,
|
dtss->size_x, dtss->size_y,
|
||||||
dtss->size_z, ti->z + dtss->delta_z
|
dtss->size_z, ti->z + dtss->delta_z,
|
||||||
|
!HASBIT(image, SPRITE_MODIFIER_OPAQUE) && HASBIT(_transparent_opt, TO_INDUSTRIES)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
||||||
|
@ -1526,10 +1526,7 @@ default_waypoint:
|
|||||||
image += relocation;
|
image += relocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
|
||||||
pal = _drawtile_track_palette;
|
pal = _drawtile_track_palette;
|
||||||
} else {
|
} else {
|
||||||
pal = dtss->pal;
|
pal = dtss->pal;
|
||||||
@ -1540,7 +1537,8 @@ default_waypoint:
|
|||||||
image, pal,
|
image, pal,
|
||||||
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
||||||
dtss->size_x, dtss->size_y,
|
dtss->size_x, dtss->size_y,
|
||||||
dtss->size_z, ti->z + dtss->delta_z
|
dtss->size_z, ti->z + dtss->delta_z,
|
||||||
|
HASBIT(_transparent_opt, TO_BUILDINGS)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
||||||
|
@ -918,15 +918,8 @@ void DrawTramCatenary(TileInfo *ti, RoadBits tram)
|
|||||||
front = SPR_TRAMWAY_BASE + _road_frontwire_sprites_1[tram];
|
front = SPR_TRAMWAY_BASE + _road_frontwire_sprites_1[tram];
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID pal = PAL_NONE;
|
AddSortableSpriteToDraw(back, PAL_NONE, ti->x, ti->y, 16, 16, 0x1F, ti->z, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
AddSortableSpriteToDraw(front, PAL_NONE, ti->x, ti->y, 16, 16, 0x1F, ti->z, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
SETBIT(front, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
SETBIT(back, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(back, pal, ti->x, ti->y, 16, 16, 0x1F, ti->z);
|
|
||||||
AddSortableSpriteToDraw(front, pal, ti->x, ti->y, 16, 16, 0x1F, ti->z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1084,10 +1077,7 @@ static void DrawTile_Road(TileInfo *ti)
|
|||||||
SpriteID image = dtss->image;
|
SpriteID image = dtss->image;
|
||||||
SpriteID pal;
|
SpriteID pal;
|
||||||
|
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
|
||||||
pal = palette;
|
pal = palette;
|
||||||
} else {
|
} else {
|
||||||
pal = PAL_NONE;
|
pal = PAL_NONE;
|
||||||
@ -1097,7 +1087,8 @@ static void DrawTile_Road(TileInfo *ti)
|
|||||||
image, pal,
|
image, pal,
|
||||||
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
||||||
dtss->size_x, dtss->size_y,
|
dtss->size_x, dtss->size_y,
|
||||||
dtss->size_z, ti->z
|
dtss->size_z, ti->z,
|
||||||
|
HASBIT(_transparent_opt, TO_BUILDINGS)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2131,10 +2131,7 @@ static void DrawTile_Station(TileInfo *ti)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SpriteID pal;
|
SpriteID pal;
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
if (!HASBIT(_transparent_opt, TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
|
||||||
pal = palette;
|
pal = palette;
|
||||||
} else {
|
} else {
|
||||||
pal = dtss->pal;
|
pal = dtss->pal;
|
||||||
@ -2145,7 +2142,8 @@ static void DrawTile_Station(TileInfo *ti)
|
|||||||
image, pal,
|
image, pal,
|
||||||
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
||||||
dtss->size_x, dtss->size_y,
|
dtss->size_x, dtss->size_y,
|
||||||
dtss->size_z, ti->z + dtss->delta_z
|
dtss->size_z, ti->z + dtss->delta_z,
|
||||||
|
HASBIT(_transparent_opt, TO_BUILDINGS)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
|
||||||
|
@ -163,20 +163,14 @@ static void DrawTile_Town(TileInfo *ti)
|
|||||||
/* Add a house on top of the ground? */
|
/* Add a house on top of the ground? */
|
||||||
image = dcts->building.sprite;
|
image = dcts->building.sprite;
|
||||||
if (image != 0) {
|
if (image != 0) {
|
||||||
if (HASBIT(_transparent_opt, TO_HOUSES)) {
|
AddSortableSpriteToDraw(image, dcts->building.pal,
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = dcts->building.pal;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(image, pal,
|
|
||||||
ti->x + dcts->subtile_x,
|
ti->x + dcts->subtile_x,
|
||||||
ti->y + dcts->subtile_y,
|
ti->y + dcts->subtile_y,
|
||||||
dcts->width + 1,
|
dcts->width + 1,
|
||||||
dcts->height + 1,
|
dcts->height + 1,
|
||||||
dcts->dz,
|
dcts->dz,
|
||||||
ti->z
|
ti->z,
|
||||||
|
HASBIT(_transparent_opt, TO_HOUSES)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (HASBIT(_transparent_opt, TO_HOUSES)) return;
|
if (HASBIT(_transparent_opt, TO_HOUSES)) return;
|
||||||
|
@ -374,13 +374,8 @@ static void DrawTile_Trees(TileInfo *ti)
|
|||||||
i = GetTreeCount(ti->tile) + 1;
|
i = GetTreeCount(ti->tile) + 1;
|
||||||
do {
|
do {
|
||||||
SpriteID image = s[0].sprite + (--i == 0 ? GetTreeGrowth(ti->tile) : 3);
|
SpriteID image = s[0].sprite + (--i == 0 ? GetTreeGrowth(ti->tile) : 3);
|
||||||
SpriteID pal;
|
SpriteID pal = s[0].pal;
|
||||||
if (HASBIT(_transparent_opt, TO_TREES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = s[0].pal;
|
|
||||||
}
|
|
||||||
te[i].image = image;
|
te[i].image = image;
|
||||||
te[i].pal = pal;
|
te[i].pal = pal;
|
||||||
te[i].x = d->x;
|
te[i].x = d->x;
|
||||||
@ -404,7 +399,7 @@ static void DrawTile_Trees(TileInfo *ti)
|
|||||||
|
|
||||||
if (tep == NULL) break;
|
if (tep == NULL) break;
|
||||||
|
|
||||||
AddSortableSpriteToDraw(tep->image, tep->pal, ti->x + tep->x, ti->y + tep->y, 5, 5, 0x10, z);
|
AddSortableSpriteToDraw(tep->image, tep->pal, ti->x + tep->x, ti->y + tep->y, 5, 5, 0x10, z, HASBIT(_transparent_opt, TO_TREES));
|
||||||
tep->image = 0;
|
tep->image = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -831,7 +831,6 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis
|
|||||||
int back_height, front_height;
|
int back_height, front_height;
|
||||||
int i = z;
|
int i = z;
|
||||||
const byte *p;
|
const byte *p;
|
||||||
SpriteID pal;
|
|
||||||
|
|
||||||
static const byte _tileh_bits[4][8] = {
|
static const byte _tileh_bits[4][8] = {
|
||||||
{ 2, 1, 8, 4, 16, 2, 0, 9 },
|
{ 2, 1, 8, 4, 16, 2, 0, 9 },
|
||||||
@ -840,13 +839,6 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis
|
|||||||
{ 2, 4, 8, 1, 2, 16, 9, 0 }
|
{ 2, 4, 8, 1, 2, 16, 9, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (HASBIT(_transparent_opt, TO_BRIDGES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = psid->pal;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = _tileh_bits[(image & 1) * 2 + (axis == AXIS_X ? 0 : 1)];
|
p = _tileh_bits[(image & 1) * 2 + (axis == AXIS_X ? 0 : 1)];
|
||||||
front_height = ti->z + (ti->tileh & p[0] ? TILE_HEIGHT : 0);
|
front_height = ti->z + (ti->tileh & p[0] ? TILE_HEIGHT : 0);
|
||||||
back_height = ti->z + (ti->tileh & p[1] ? TILE_HEIGHT : 0);
|
back_height = ti->z + (ti->tileh & p[1] ? TILE_HEIGHT : 0);
|
||||||
@ -861,11 +853,11 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis
|
|||||||
* sprites is at the top
|
* sprites is at the top
|
||||||
*/
|
*/
|
||||||
if (z >= front_height) { // front facing pillar
|
if (z >= front_height) { // front facing pillar
|
||||||
AddSortableSpriteToDraw(image, pal, x, y, p[4], p[5], 1, z);
|
AddSortableSpriteToDraw(image, psid->pal, x, y, p[4], p[5], 1, z, HASBIT(_transparent_opt, TO_BRIDGES));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawfarpillar && z >= back_height && z < i - TILE_HEIGHT) { // back facing pillar
|
if (drawfarpillar && z >= back_height && z < i - TILE_HEIGHT) { // back facing pillar
|
||||||
AddSortableSpriteToDraw(image, pal, x - p[6], y - p[7], p[4], p[5], 1, z);
|
AddSortableSpriteToDraw(image, psid->pal, x - p[6], y - p[7], p[4], p[5], 1, z, HASBIT(_transparent_opt, TO_BRIDGES));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -912,18 +904,9 @@ static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay)
|
|||||||
|
|
||||||
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + tram_offsets[overlay][offset], PAL_NONE, x, y, size_x[offset], size_y[offset], offset >= 2 ? 1 : 0, z);
|
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + tram_offsets[overlay][offset], PAL_NONE, x, y, size_x[offset], size_y[offset], offset >= 2 ? 1 : 0, z);
|
||||||
|
|
||||||
SpriteID front = SPR_TRAMWAY_BASE + front_offsets[offset];
|
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + back_offsets[offset], PAL_NONE, x, y, size_x[offset], size_y[offset], 0, z, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
SpriteID back = SPR_TRAMWAY_BASE + back_offsets[offset];
|
|
||||||
SpriteID pal = PAL_NONE;
|
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
|
||||||
SETBIT(front, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
SETBIT(back, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(back, pal, x, y, size_x[offset], size_y[offset], 0, z);
|
|
||||||
/* For sloped sprites the bounding box needs to be higher, as the pylons stop on a higher point */
|
/* For sloped sprites the bounding box needs to be higher, as the pylons stop on a higher point */
|
||||||
AddSortableSpriteToDraw(front, pal, x, y, size_x[offset], size_y[offset], offset >= 2 ? 0x30 : 0x10, z);
|
AddSortableSpriteToDraw(SPR_TRAMWAY_BASE + front_offsets[offset], PAL_NONE, x, y, size_x[offset], size_y[offset], offset >= 2 ? 0x30 : 0x10, z, HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -942,7 +925,6 @@ static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay)
|
|||||||
static void DrawTile_TunnelBridge(TileInfo *ti)
|
static void DrawTile_TunnelBridge(TileInfo *ti)
|
||||||
{
|
{
|
||||||
SpriteID image;
|
SpriteID image;
|
||||||
SpriteID pal;
|
|
||||||
|
|
||||||
if (IsTunnel(ti->tile)) {
|
if (IsTunnel(ti->tile)) {
|
||||||
if (GetTunnelTransportType(ti->tile) == TRANSPORT_RAIL) {
|
if (GetTunnelTransportType(ti->tile) == TRANSPORT_RAIL) {
|
||||||
@ -1005,21 +987,13 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
|
|||||||
DrawGroundSprite(SPR_FLAT_SNOWY_TILE + _tileh_to_sprite[ti->tileh], PAL_NONE);
|
DrawGroundSprite(SPR_FLAT_SNOWY_TILE + _tileh_to_sprite[ti->tileh], PAL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
image = psid->sprite;
|
|
||||||
|
|
||||||
/* draw ramp */
|
/* draw ramp */
|
||||||
if (HASBIT(_transparent_opt, TO_BRIDGES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = psid->pal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* HACK set the height of the BB of a sloped ramp to 1 so a vehicle on
|
/* HACK set the height of the BB of a sloped ramp to 1 so a vehicle on
|
||||||
* it doesn't disappear behind it
|
* it doesn't disappear behind it
|
||||||
*/
|
*/
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
image, pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z
|
psid->sprite, psid->pal, ti->x, ti->y, 16, 16, ti->tileh == SLOPE_FLAT ? 0 : 8, ti->z, HASBIT(_transparent_opt, TO_BRIDGES)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (GetBridgeTransportType(ti->tile) == TRANSPORT_ROAD) {
|
if (GetBridgeTransportType(ti->tile) == TRANSPORT_ROAD) {
|
||||||
@ -1082,8 +1056,6 @@ static uint CalcBridgePiece(uint north, uint south)
|
|||||||
void DrawBridgeMiddle(const TileInfo* ti)
|
void DrawBridgeMiddle(const TileInfo* ti)
|
||||||
{
|
{
|
||||||
const PalSpriteID* psid;
|
const PalSpriteID* psid;
|
||||||
SpriteID image;
|
|
||||||
SpriteID pal;
|
|
||||||
uint base_offset;
|
uint base_offset;
|
||||||
TileIndex rampnorth;
|
TileIndex rampnorth;
|
||||||
TileIndex rampsouth;
|
TileIndex rampsouth;
|
||||||
@ -1120,28 +1092,13 @@ void DrawBridgeMiddle(const TileInfo* ti)
|
|||||||
uint bridge_z = GetBridgeHeight(rampsouth);
|
uint bridge_z = GetBridgeHeight(rampsouth);
|
||||||
z = bridge_z - 3;
|
z = bridge_z - 3;
|
||||||
|
|
||||||
image = psid->sprite;
|
|
||||||
if (HASBIT(_transparent_opt, TO_BRIDGES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = psid->pal;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axis == AXIS_X) {
|
if (axis == AXIS_X) {
|
||||||
AddSortableSpriteToDraw(image, pal, x, y, 16, 11, 1, z);
|
AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 11, 1, z, HASBIT(_transparent_opt, TO_BRIDGES));
|
||||||
} else {
|
} else {
|
||||||
AddSortableSpriteToDraw(image, pal, x, y, 11, 16, 1, z);
|
AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 11, 16, 1, z, HASBIT(_transparent_opt, TO_BRIDGES));
|
||||||
}
|
}
|
||||||
|
|
||||||
psid++;
|
psid++;
|
||||||
image = psid->sprite;
|
|
||||||
if (HASBIT(_transparent_opt, TO_BRIDGES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = psid->pal;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetBridgeTransportType(rampsouth) == TRANSPORT_ROAD) {
|
if (GetBridgeTransportType(rampsouth) == TRANSPORT_ROAD) {
|
||||||
RoadTypes rts = GetRoadTypes(rampsouth);
|
RoadTypes rts = GetRoadTypes(rampsouth);
|
||||||
@ -1156,22 +1113,21 @@ void DrawBridgeMiddle(const TileInfo* ti)
|
|||||||
/* draw roof, the component of the bridge which is logically between the vehicle and the camera */
|
/* draw roof, the component of the bridge which is logically between the vehicle and the camera */
|
||||||
if (axis == AXIS_X) {
|
if (axis == AXIS_X) {
|
||||||
y += 12;
|
y += 12;
|
||||||
if (image & SPRITE_MASK) AddSortableSpriteToDraw(image, pal, x, y, 16, 1, 0x28, z);
|
if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 16, 1, 0x28, z, HASBIT(_transparent_opt, TO_BRIDGES));
|
||||||
} else {
|
} else {
|
||||||
x += 12;
|
x += 12;
|
||||||
if (image & SPRITE_MASK) AddSortableSpriteToDraw(image, pal, x, y, 1, 16, 0x28, z);
|
if (psid->sprite & SPRITE_MASK) AddSortableSpriteToDraw(psid->sprite, psid->pal, x, y, 1, 16, 0x28, z, HASBIT(_transparent_opt, TO_BRIDGES));
|
||||||
}
|
}
|
||||||
|
|
||||||
psid++;
|
psid++;
|
||||||
if (ti->z + 5 == z) {
|
if (ti->z + 5 == z) {
|
||||||
/* draw poles below for small bridges */
|
/* draw poles below for small bridges */
|
||||||
if (psid->sprite != 0) {
|
if (psid->sprite != 0) {
|
||||||
image = psid->sprite;
|
SpriteID image = psid->sprite;
|
||||||
|
SpriteID pal = psid->pal;
|
||||||
if (HASBIT(_transparent_opt, TO_BRIDGES)) {
|
if (HASBIT(_transparent_opt, TO_BRIDGES)) {
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
pal = PALETTE_TO_TRANSPARENT;
|
||||||
} else {
|
|
||||||
pal = psid->pal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawGroundSpriteAt(image, pal, x, y, z);
|
DrawGroundSpriteAt(image, pal, x, y, z);
|
||||||
|
@ -112,8 +112,6 @@ CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
|
|||||||
|
|
||||||
static void DrawTile_Unmovable(TileInfo *ti)
|
static void DrawTile_Unmovable(TileInfo *ti)
|
||||||
{
|
{
|
||||||
SpriteID image;
|
|
||||||
SpriteID pal;
|
|
||||||
|
|
||||||
switch (GetUnmovableType(ti->tile)) {
|
switch (GetUnmovableType(ti->tile)) {
|
||||||
case UNMOVABLE_TRANSMITTER:
|
case UNMOVABLE_TRANSMITTER:
|
||||||
@ -125,17 +123,10 @@ static void DrawTile_Unmovable(TileInfo *ti)
|
|||||||
|
|
||||||
dtus = &_draw_tile_unmovable_data[GetUnmovableType(ti->tile)];
|
dtus = &_draw_tile_unmovable_data[GetUnmovableType(ti->tile)];
|
||||||
|
|
||||||
image = dtus->image;
|
|
||||||
if (HASBIT(_transparent_opt, TO_STRUCTURES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = PAL_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
image, pal, ti->x | dtus->subcoord_x, ti->y | dtus->subcoord_y,
|
dtus->image, PAL_NONE, ti->x | dtus->subcoord_x, ti->y | dtus->subcoord_y,
|
||||||
dtus->width, dtus->height, dtus->z_size, ti->z
|
dtus->width, dtus->height, dtus->z_size, ti->z,
|
||||||
|
HASBIT(_transparent_opt, TO_STRUCTURES)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -143,23 +134,14 @@ static void DrawTile_Unmovable(TileInfo *ti)
|
|||||||
case UNMOVABLE_STATUE:
|
case UNMOVABLE_STATUE:
|
||||||
DrawGroundSprite(SPR_CONCRETE_GROUND, PAL_NONE);
|
DrawGroundSprite(SPR_CONCRETE_GROUND, PAL_NONE);
|
||||||
|
|
||||||
image = SPR_STATUE_COMPANY;
|
AddSortableSpriteToDraw(SPR_STATUE_COMPANY, PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)), ti->x, ti->y, 16, 16, 25, ti->z, HASBIT(_transparent_opt, TO_STRUCTURES));
|
||||||
if (HASBIT(_transparent_opt, TO_STRUCTURES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
|
|
||||||
}
|
|
||||||
AddSortableSpriteToDraw(image, pal, ti->x, ti->y, 16, 16, 25, ti->z);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNMOVABLE_OWNED_LAND:
|
case UNMOVABLE_OWNED_LAND:
|
||||||
DrawClearLandTile(ti, 0);
|
DrawClearLandTile(ti, 0);
|
||||||
|
|
||||||
image = SPR_BOUGHT_LAND;
|
|
||||||
pal = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
|
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
image, pal,
|
SPR_BOUGHT_LAND, PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)),
|
||||||
ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 10, GetSlopeZ(ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2)
|
ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 10, GetSlopeZ(ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2)
|
||||||
);
|
);
|
||||||
DrawBridgeMiddle(ti);
|
DrawBridgeMiddle(ti);
|
||||||
@ -179,18 +161,12 @@ static void DrawTile_Unmovable(TileInfo *ti)
|
|||||||
DrawGroundSprite(t->ground_sprite, palette);
|
DrawGroundSprite(t->ground_sprite, palette);
|
||||||
|
|
||||||
foreach_draw_tile_seq(dtss, t->seq) {
|
foreach_draw_tile_seq(dtss, t->seq) {
|
||||||
image = dtss->image;
|
|
||||||
if (HASBIT(_transparent_opt, TO_STRUCTURES)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = palette;
|
|
||||||
}
|
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
image, pal,
|
dtss->image, palette,
|
||||||
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
||||||
dtss->size_x, dtss->size_y,
|
dtss->size_x, dtss->size_y,
|
||||||
dtss->size_z, ti->z + dtss->delta_z
|
dtss->size_z, ti->z + dtss->delta_z,
|
||||||
|
HASBIT(_transparent_opt, TO_STRUCTURES)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -852,17 +852,14 @@ static void DoDrawVehicle(const Vehicle *v)
|
|||||||
SpriteID image = v->cur_image;
|
SpriteID image = v->cur_image;
|
||||||
SpriteID pal;
|
SpriteID pal;
|
||||||
|
|
||||||
if (v->vehstatus & VS_SHADOW) {
|
if (v->vehstatus & VS_DEFPAL) {
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else if (v->vehstatus & VS_DEFPAL) {
|
|
||||||
pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
||||||
} else {
|
} else {
|
||||||
pal = PAL_NONE;
|
pal = PAL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddSortableSpriteToDraw(image, pal, v->x_pos + v->x_offs, v->y_pos + v->y_offs,
|
AddSortableSpriteToDraw(image, pal, v->x_pos + v->x_offs, v->y_pos + v->y_offs,
|
||||||
v->sprite_width, v->sprite_height, v->z_height, v->z_pos);
|
v->sprite_width, v->sprite_height, v->z_height, v->z_pos, v->vehstatus & VS_SHADOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewportAddVehicles(DrawPixelInfo *dpi)
|
void ViewportAddVehicles(DrawPixelInfo *dpi)
|
||||||
|
@ -478,8 +478,18 @@ static void AddCombinedSprite(SpriteID image, SpriteID pal, int x, int y, byte z
|
|||||||
AddChildSpriteScreen(image, pal, pt.x - vd->parent_list[-1]->left, pt.y - vd->parent_list[-1]->top);
|
AddChildSpriteScreen(image, pal, pt.x - vd->parent_list[-1]->left, pt.y - vd->parent_list[-1]->top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Draw a (transparent) sprite at given coordinates
|
||||||
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z)
|
* @param image the image to combine and draw,
|
||||||
|
* @param pal the provided palette,
|
||||||
|
* @param x position x of the sprite,
|
||||||
|
* @param y position y of the sprite,
|
||||||
|
* @param w width of the sprite,
|
||||||
|
* @param h height of the sprite,
|
||||||
|
* @param dz delta z, difference of elevation between sprite and parent sprite,
|
||||||
|
* @param z elevation of the sprite,
|
||||||
|
* @param transparent if true, switch the palette between the provided palette and the transparent palette
|
||||||
|
*/
|
||||||
|
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z, bool transparent)
|
||||||
{
|
{
|
||||||
ViewportDrawer *vd = _cur_vd;
|
ViewportDrawer *vd = _cur_vd;
|
||||||
ParentSpriteToDraw *ps;
|
ParentSpriteToDraw *ps;
|
||||||
@ -488,6 +498,12 @@ void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w,
|
|||||||
|
|
||||||
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
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->combine_sprites == 2) {
|
if (vd->combine_sprites == 2) {
|
||||||
AddCombinedSprite(image, pal, x, y, z);
|
AddCombinedSprite(image, pal, x, y, z);
|
||||||
return;
|
return;
|
||||||
|
@ -48,7 +48,7 @@ void OffsetGroundSprite(int x, int y);
|
|||||||
|
|
||||||
void DrawGroundSprite(SpriteID image, SpriteID pal);
|
void DrawGroundSprite(SpriteID image, SpriteID pal);
|
||||||
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z);
|
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, byte dz, byte z);
|
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z, bool transparent = false);
|
||||||
void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
|
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);
|
||||||
|
|
||||||
|
@ -441,23 +441,11 @@ static void DrawWaterStuff(const TileInfo *ti, const WaterDrawTileStruct *wdts,
|
|||||||
DrawGroundSprite(image, PAL_NONE);
|
DrawGroundSprite(image, PAL_NONE);
|
||||||
|
|
||||||
for (; wdts->delta_x != 0x80; wdts++) {
|
for (; wdts->delta_x != 0x80; wdts++) {
|
||||||
SpriteID image = wdts->image;
|
AddSortableSpriteToDraw(wdts->image + base + ((wdts->image < 24) ? locks_base : 0), palette,
|
||||||
SpriteID pal;
|
|
||||||
|
|
||||||
if (image < 24) image += locks_base;
|
|
||||||
image += base;
|
|
||||||
|
|
||||||
if (HASBIT(_transparent_opt, TO_BUILDINGS)) {
|
|
||||||
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
|
|
||||||
pal = PALETTE_TO_TRANSPARENT;
|
|
||||||
} else {
|
|
||||||
pal = palette;
|
|
||||||
}
|
|
||||||
|
|
||||||
AddSortableSpriteToDraw(image, pal,
|
|
||||||
ti->x + wdts->delta_x, ti->y + wdts->delta_y,
|
ti->x + wdts->delta_x, ti->y + wdts->delta_y,
|
||||||
wdts->width, wdts->height,
|
wdts->width, wdts->height,
|
||||||
wdts->unk, ti->z + wdts->delta_z);
|
wdts->unk, ti->z + wdts->delta_z,
|
||||||
|
HASBIT(_transparent_opt, TO_BUILDINGS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user