Mercurial > hg > openttd
changeset 8158:e2bea11667fd draft
(svn r11720) -Codechange: [NewGRF] Add support for bit 30 of station tile layouts; forcing a sprite to always be opaque.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Sat, 29 Dec 2007 21:06:54 +0000 |
parents | 019833e42fda |
children | 8debc9f52e23 |
files | src/newgrf.cpp src/rail_cmd.cpp src/station_cmd.cpp src/table/sprites.h |
diffstat | 4 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -950,6 +950,10 @@ 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 @@ 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);
--- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1811,7 +1811,7 @@ 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 @@ 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);
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2160,7 +2160,7 @@ } 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 @@ 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));
--- a/src/table/sprites.h +++ b/src/table/sprites.h @@ -1415,6 +1415,7 @@ 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 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