From ec38926a517e9c1cfab41cf9da1e334688d006a5 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 16 Dec 2017 19:34:01 +0100 Subject: Start refactoring decos. --- src/game/worldgen.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/game/worldgen.cpp') 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) -- cgit