summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tiledgnbuf.cc
diff options
context:
space:
mode:
authorPete Hurst <pete@streamuniverse.tv>2013-05-24 00:19:30 +0100
committerPete Hurst <pete@streamuniverse.tv>2013-05-25 17:05:48 +0100
commit8f2e336bb97bcaf7a0193c443bb682424dc52b7e (patch)
tree0367ec5a5d7ecf353212e951622526694cf9ef82 /crawl-ref/source/tiledgnbuf.cc
parent60f276de766666d1f2852beb8c5f3a2159ce8750 (diff)
downloadcrawl-ref-8f2e336bb97bcaf7a0193c443bb682424dc52b7e.tar.gz
crawl-ref-8f2e336bb97bcaf7a0193c443bb682424dc52b7e.zip
Implement cloud alpha overlay tiles layer
This works very well for the most part with two small problems: - Webtiles will not support this yet (in probability, this will stop any clouds showing in webtiles) - Floor items interact strangely and will draw over the top of clouds instead of behind them
Diffstat (limited to 'crawl-ref/source/tiledgnbuf.cc')
-rw-r--r--crawl-ref/source/tiledgnbuf.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/crawl-ref/source/tiledgnbuf.cc b/crawl-ref/source/tiledgnbuf.cc
index 9240e34084..111aab8b2c 100644
--- a/crawl-ref/source/tiledgnbuf.cc
+++ b/crawl-ref/source/tiledgnbuf.cc
@@ -40,6 +40,10 @@ void DungeonCellBuffer::add(const packed_cell &cell, int x, int y)
const tileidx_t fg_idx = cell.fg & TILE_FLAG_MASK;
const bool in_water = _in_water(cell);
+ const tileidx_t cloud_idx = cell.cloud & TILE_FLAG_MASK;
+ const tileidx_t cloud_base_idx = tileidx_known_base_item(cloud_idx);
+ const tileidx_t cloud_final_idx = cloud_base_idx ? cloud_base_idx : cloud_idx;
+
if (fg_idx >= TILEP_MCACHE_START)
{
mcache_entry *entry = mcache.get(fg_idx);
@@ -54,6 +58,21 @@ void DungeonCellBuffer::add(const packed_cell &cell, int x, int y)
m_buf_doll.add(fg_idx, x, y, TILEP_PART_MAX, in_water, false);
pack_foreground(x, y, cell);
+
+ // Draw cloud layer(s)
+ if (cloud_idx && cloud_idx < TILE_FEAT_MAX)
+ {
+ // If there's a foreground, sandwich it between two semi-transparent
+ // clouds at different z-indices
+ if (fg_idx)
+ {
+ m_buf_main_trans.add_alpha(cloud_final_idx, x, y, 0, 0, 0, -1, 255);
+ m_buf_main_trans.add_alpha(cloud_final_idx, x, y, 50, 0, 0, -1, 127);
+ }
+ else
+ // Otherwise render it normally with full transparency
+ m_buf_main.add(cloud_final_idx, x, y);
+ }
}
void DungeonCellBuffer::add_dngn_tile(int tileidx, int x, int y,