summaryrefslogtreecommitdiff
path: root/src/unmovable_cmd.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-01-14 19:57:49 +0000
committerpeter1138 <peter1138@openttd.org>2007-01-14 19:57:49 +0000
commitca9843424be6008d9b8019423f2ead65fdb75fe2 (patch)
treec62990da208a45b3bd1c7379a1835190458d5a49 /src/unmovable_cmd.cpp
parentc04c2b28245770aa7729b818fb876cd23c880620 (diff)
downloadopenttd-ca9843424be6008d9b8019423f2ead65fdb75fe2.tar.xz
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
This lets us increase the sprite width from 14 to up to 29 bits, effectively nulling the old sprite limit. Table changes in next commit.
Diffstat (limited to 'src/unmovable_cmd.cpp')
-rw-r--r--src/unmovable_cmd.cpp49
1 files changed, 34 insertions, 15 deletions
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index bc63a8523..b67a1a0a2 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -107,7 +107,8 @@ int32 CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
static void DrawTile_Unmovable(TileInfo *ti)
{
- uint32 image, ormod;
+ SpriteID image;
+ SpriteID pal;
switch (GetUnmovableType(ti->tile)) {
case UNMOVABLE_TRANSMITTER:
@@ -120,29 +121,45 @@ static void DrawTile_Unmovable(TileInfo *ti)
dtus = &_draw_tile_unmovable_data[GetUnmovableType(ti->tile)];
image = dtus->image;
- if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
+ if (_display_opt & DO_TRANS_BUILDINGS) {
+ SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+ pal = PALETTE_TO_TRANSPARENT;
+ } else {
+ pal = PAL_NONE;
+ }
AddSortableSpriteToDraw(
- image, ti->x | dtus->subcoord_x, ti->y | dtus->subcoord_y,
+ image, pal, ti->x | dtus->subcoord_x, ti->y | dtus->subcoord_y,
dtus->width, dtus->height, dtus->z_size, ti->z
);
break;
}
case UNMOVABLE_STATUE:
- DrawGroundSprite(SPR_CONCRETE_GROUND);
-
- image = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
- image += PALETTE_MODIFIER_COLOR | SPR_STATUE_COMPANY;
- if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image);
- AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 25, ti->z);
+ DrawGroundSprite(SPR_CONCRETE_GROUND, PAL_NONE);
+
+ image = SPR_STATUE_COMPANY;
+ if (_display_opt & DO_TRANS_BUILDINGS) {
+ 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;
case UNMOVABLE_OWNED_LAND:
DrawClearLandTile(ti, 0);
+ image = SPR_BOUGHT_LAND;
+ if (_display_opt & DO_TRANS_BUILDINGS) {
+ SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+ pal = PALETTE_TO_TRANSPARENT;
+ } else {
+ pal = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
+ }
AddSortableSpriteToDraw(
- PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)) + PALETTE_MODIFIER_COLOR + SPR_BOUGHT_LAND,
+ image, pal,
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);
@@ -151,24 +168,26 @@ static void DrawTile_Unmovable(TileInfo *ti)
default: {
const DrawTileSeqStruct* dtss;
const DrawTileSprites* t;
+ SpriteID palette;
assert(IsCompanyHQ(ti->tile));
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh);
- ormod = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
+ palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
t = &_unmovable_display_datas[GetCompanyHQSection(ti->tile)];
- DrawGroundSprite(t->ground_sprite | ormod);
+ DrawGroundSprite(t->ground_sprite, palette);
foreach_draw_tile_seq(dtss, t->seq) {
image = dtss->image;
if (_display_opt & DO_TRANS_BUILDINGS) {
- MAKE_TRANSPARENT(image);
+ SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
+ pal = PALETTE_TO_TRANSPARENT;
} else {
- image |= ormod;
+ pal = palette;
}
AddSortableSpriteToDraw(
- image,
+ 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