summaryrefslogtreecommitdiff
path: root/src/game/worldgen.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-16 19:34:01 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-16 19:34:01 +0100
commitec38926a517e9c1cfab41cf9da1e334688d006a5 (patch)
tree5e7a61efd3708bbe57bb3d5d17e0e3559d1df876 /src/game/worldgen.cpp
parentda4e3c6509fa6e00f5bbcb3a34607dd966650d1a (diff)
Start refactoring decos.
Diffstat (limited to 'src/game/worldgen.cpp')
-rw-r--r--src/game/worldgen.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/game/worldgen.cpp b/src/game/worldgen.cpp
index 01b05ca..e5f19c8 100644
--- a/src/game/worldgen.cpp
+++ b/src/game/worldgen.cpp
@@ -8,6 +8,7 @@ void add_decoration(world_t *world, state_t *game, v2f_t x, float noise)
{
deco_t *deco;
deco_type_t type;
+ v2f_t center, offset;
if (noise < 0.3)
return;
@@ -21,9 +22,13 @@ void add_decoration(world_t *world, state_t *game, v2f_t x, float noise)
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->spawn(world, x);
- deco->phase_shift = noise * 500.0;
+ deco->phase_shift = offset[0] * 500.0;
+ deco->place(world, x);
}
void worldgen(world_t *world, sector_index_t index, sector_t *sector, void *data)