summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dgn-proclayouts.cc
diff options
context:
space:
mode:
authorBrendan Hickey <brendan@bhickey.net>2012-09-16 01:09:49 -0700
committerBrendan Hickey <brendan@bhickey.net>2012-12-30 19:06:13 -0800
commit51d65a72a231f63d3ba523b2f953bd09464351d5 (patch)
treee4aef7f5cf0993894a64d54bdc91f96e21b03e7c /crawl-ref/source/dgn-proclayouts.cc
parent6783c3696236768d6d505bca012d4bb84294abd2 (diff)
downloadcrawl-ref-51d65a72a231f63d3ba523b2f953bd09464351d5.tar.gz
crawl-ref-51d65a72a231f63d3ba523b2f953bd09464351d5.zip
"And I will make you a raging river"
Fuzzed up the Abyss River with some perlin noise. Grabbed a free perlin noise implementation, crudely ported it to C/C++.
Diffstat (limited to 'crawl-ref/source/dgn-proclayouts.cc')
-rw-r--r--crawl-ref/source/dgn-proclayouts.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/crawl-ref/source/dgn-proclayouts.cc b/crawl-ref/source/dgn-proclayouts.cc
index ef02d17e46..b11d2d6ce0 100644
--- a/crawl-ref/source/dgn-proclayouts.cc
+++ b/crawl-ref/source/dgn-proclayouts.cc
@@ -6,9 +6,10 @@
#include <cmath>
#include "dgn-proclayouts.h"
-#include "cellular.h"
#include "hash.h"
+#include "perlin.h"
#include "terrain.h"
+#include "worley.h"
#include "random.h"
@@ -101,12 +102,18 @@ RoilingChaosLayout::operator()(const coord_def &p, const uint32_t offset) const
ProceduralSample
TheRiver::operator()(const coord_def &p, const uint32_t offset) const
{
- int x = p.x + sin(p.y / 6.0) * 7;
- if (x % 100 < 30)
+ int xi = p.x + perlin::noise(p.x/4.0, p.y/4.0, offset / 200.0) * 3;
+ int yi = p.y + perlin::noise(p.x/4.0 + 31., p.y/4.0 + 17., offset / 200.0) * 3;
+ int x = xi + sin(yi / 6.0) * 7;
+ int width = 15 + perlin::noise(p.x/5.0, p.y/5.0, seed) * 8;
+ if (x % 100 < width)
{
- return ProceduralSample(p, DNGN_SHALLOW_WATER, offset + 4096, MMT_VAULT);
+ dungeon_feature_type feat = DNGN_SHALLOW_WATER;
+ if (width > 15 && (x - 7) % 100 > 12)
+ feat = DNGN_DEEP_WATER;
+ return ProceduralSample(p, feat, offset + random2(50));
}
- if ((x + 4) % 100 < 38)
- return ProceduralSample(p, DNGN_FLOOR, offset + 4096);
+ if ((x + 4) % 100 < width + 8)
+ return ProceduralSample(p, DNGN_FLOOR, offset + random2(50));
return layout(p, offset);
}