summaryrefslogtreecommitdiff
path: root/src/game/worldgen.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-16 22:41:48 +0000
committerPaweł Redman <pawel.redman@gmail.com>2017-12-16 22:41:48 +0000
commit38edebe4bdeb8caedccf6127a86fddfe9c5808a8 (patch)
tree466cf659201a66a12d922943337e636b5125bccb /src/game/worldgen.cpp
parent5c7d962e605e123e1ce4e0610e8f330b1f4f5e82 (diff)
Fully working nests.
Diffstat (limited to 'src/game/worldgen.cpp')
-rw-r--r--src/game/worldgen.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/game/worldgen.cpp b/src/game/worldgen.cpp
index e5f19c8..18a98b5 100644
--- a/src/game/worldgen.cpp
+++ b/src/game/worldgen.cpp
@@ -13,19 +13,23 @@ void add_decoration(world_t *world, state_t *game, v2f_t x, float noise)
if (noise < 0.3)
return;
- if (noise > 0.5)
- type = DECO_NEST;
- else if (noise > 0.40)
+ offset[0] = world->perlin.get(x, 0.17331f);
+ offset[1] = world->perlin.get(x, 0.19571f);
+ center = x + v2f_t(0.5f, 0.5f) + offset.norm() * 0.1;
+
+ if (noise > 0.5) {
+ unit_nest_t *nest = new unit_nest_t(game);
+ nest->place(world, center);
+ return;
+ }
+
+ if (noise > 0.40)
type = DECO_EYETHING;
else if (noise > 0.35)
type = DECO_STONE;
else
type = DECO_STONE_SMALL;
- offset[0] = world->perlin.get(x, 0.17331f);
- offset[1] = world->perlin.get(x, 0.19571f);
- center = x + v2f_t(0.5f, 0.5f) + offset.norm() * 0.1;
-
deco = new deco_t(game, type);
deco->phase_shift = offset[0] * 500.0;
deco->place(world, x);