summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-12-29 21:06:54 +0000
committerpeter1138 <peter1138@openttd.org>2007-12-29 21:06:54 +0000
commit06d578d07e6c1d0e0fa5ec2848b223a179410ed3 (patch)
treebf60d74800aa8f3a5e8803efc79333b30a8e6fb3
parente5e75bd8f8f7df43ff39f2cb15bd12d200f1131f (diff)
downloadopenttd-06d578d07e6c1d0e0fa5ec2848b223a179410ed3.tar.xz
(svn r11720) -Codechange: [NewGRF] Add support for bit 30 of station tile layouts; forcing a sprite to always be opaque.
-rw-r--r--src/newgrf.cpp8
-rw-r--r--src/rail_cmd.cpp4
-rw-r--r--src/station_cmd.cpp4
-rw-r--r--src/table/sprites.h4
4 files changed, 15 insertions, 5 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index c70845f4e..42bd6088c 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -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);
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index e733a61eb..d550b311c 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -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);
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 93d984811..fa55814ce 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -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));
diff --git a/src/table/sprites.h b/src/table/sprites.h
index 02d931df3..16fc900d7 100644
--- a/src/table/sprites.h
+++ b/src/table/sprites.h
@@ -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