diff options
author | Pete Hurst <pete@streamuniverse.tv> | 2013-04-09 15:09:33 +0100 |
---|---|---|
committer | Pete Hurst <pete@streamuniverse.tv> | 2013-04-09 15:09:33 +0100 |
commit | 2444626377ca1e8d35a568eddd32340bed80e1de (patch) | |
tree | c0b6c4bb1ce3d7a8ad4cc899dd7fbc76f6aed21b /crawl-ref/source/dgn-proclayouts.cc | |
parent | c0e35169b45f135e33ef9eab980375810fcfa7ab (diff) | |
download | crawl-ref-2444626377ca1e8d35a568eddd32340bed80e1de.tar.gz crawl-ref-2444626377ca1e8d35a568eddd32340bed80e1de.zip |
Prevent a warning, make abyssal forest slightly less homogenous
Diffstat (limited to 'crawl-ref/source/dgn-proclayouts.cc')
-rw-r--r-- | crawl-ref/source/dgn-proclayouts.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/crawl-ref/source/dgn-proclayouts.cc b/crawl-ref/source/dgn-proclayouts.cc index e9d14c3201..894dfc66e8 100644 --- a/crawl-ref/source/dgn-proclayouts.cc +++ b/crawl-ref/source/dgn-proclayouts.cc @@ -290,28 +290,31 @@ ForestLayout::operator()(const coord_def &p, const uint32_t offset) const worley::noise_datum fn = tfunc.datum(p.x,p.y,offset); - // Split the id into four 8-bit numbers to use for randomness - uint16_t rand[4] = { fn.id[0] >> 24, fn.id[0] >> 16 & 0x000000ff, fn.id[0] >> 8 & 0x000000ff, fn.id[0] & 0x000000ff }; + // Split the id into some 8-bit numbers to use for randomness + uint8_t rand[2] = { fn.id[0] >> 24, fn.id[0] >> 16 & 0x000000ff }; + // , fn.id[0] >> 8 & 0x000000ff, fn.id[0] & 0x000000ff }; double diff = fn.distance[1]-fn.distance[0]; - // 50% chance of trees - if (rand[0]<0x80) + float size_factor = (float)rand[1]/(255.0 * 2.0) + 0.15; + // 75% chance of trees + if (rand[0]<0xC0) { - if (diff > 0.3) + // Size of clump depends on factor + if (diff > size_factor) feat = DNGN_TREE; } // Small chance of henge - else if (rand[0]<0x90) + else if (rand[0]<0xC8) { - if (diff > 0.5 && diff < 0.6) + if (diff > (size_factor+0.3) && diff < (size_factor+0.4)) feat = DNGN_STONE_ARCH; } // Somewhat under 25% chance of pool - else if (rand[0]<0xC0) + else if (rand[0]<0xE0) { - if (diff > 0.8) + if (diff > size_factor*2.0) feat = DNGN_DEEP_WATER; - else if (diff > 0.4) + else if (diff > size_factor) feat = DNGN_SHALLOW_WATER; } // 25% chance of empty cell |