(svn r11720) -Codechange: [NewGRF] Add support for bit 30 of station tile layouts; forcing a sprite to always be opaque.

This commit is contained in:
peter1138 2007-12-29 21:06:54 +00:00
parent e5e75bd8f8
commit 06d578d07e
4 changed files with 15 additions and 5 deletions

View File

@ -950,6 +950,10 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
ClrBit(dts->ground_pal, 15);
SetBit(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET);
}
if (HasBit(dts->ground_pal, 14)) {
ClrBit(dts->ground_pal, 14);
SetBit(dts->ground_sprite, SPRITE_MODIFIER_OPAQUE);
}
if (HasBit(dts->ground_sprite, 15)) {
ClrBit(dts->ground_sprite, 15);
SetBit(dts->ground_sprite, PALETTE_MODIFIER_COLOR);
@ -981,6 +985,10 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
ClrBit(dtss->pal, 15);
SetBit(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
}
if (HasBit(dtss->pal, 14)) {
ClrBit(dtss->pal, 14);
SetBit(dtss->image, SPRITE_MODIFIER_OPAQUE);
}
if (HasBit(dtss->image, 15)) {
ClrBit(dtss->image, 15);

View File

@ -1811,7 +1811,7 @@ default_waypoint:
image += relocation;
}
if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
if (!(!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
pal = _drawtile_track_palette;
} else {
pal = dtss->pal;
@ -1823,7 +1823,7 @@ default_waypoint:
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_BUILDINGS)
!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)
);
} else {
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);

View File

@ -2160,7 +2160,7 @@ static void DrawTile_Station(TileInfo *ti)
}
SpriteID pal;
if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
if (!(!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
pal = palette;
} else {
pal = dtss->pal;
@ -2172,7 +2172,7 @@ static void DrawTile_Station(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_BUILDINGS)
!HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_BUILDINGS)
);
} else {
AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y, IsTransparencySet(TO_BUILDINGS));

View File

@ -1415,6 +1415,7 @@ enum SpriteSetup {
TRANSPARENT_BIT = 31, ///< toggles transparency in the sprite
RECOLOR_BIT = 30, ///< toggles recoloring in the sprite
OFFSET_BIT = 29,
OPAQUE_BIT = 28,
PALETTE_WIDTH = 24, ///< number of bits of the sprite containing the recolor palette
SPRITE_WIDTH = 24, ///< number of bits for the sprite number
@ -1430,7 +1431,8 @@ enum SpriteSetup {
*/
enum Modifiers {
SPRITE_MODIFIER_USE_OFFSET = OFFSET_BIT,
SPRITE_MODIFIER_OPAQUE = OFFSET_BIT,
/// Set when a sprite must not ever be displayed transparently
SPRITE_MODIFIER_OPAQUE = OPAQUE_BIT,
///when a sprite is to be displayed transparently, this bit needs to be set.
PALETTE_MODIFIER_TRANSPARENT = TRANSPARENT_BIT,
///this bit is set when a recoloring process is in action