diff options
author | nathan <nathansmith@disroot.org> | 2025-07-29 03:07:22 +0000 |
---|---|---|
committer | nathan <nathansmith@disroot.org> | 2025-07-29 03:07:22 +0000 |
commit | 6bcf165f3af3da713953b9b3b80b4f101f7a0f7a (patch) | |
tree | 7b85781c886cd18f10f119944c59e51310ca0d51 /src/world.c | |
parent | 2aae6dcb8e4ab7261f4449e99b7724e665db3e3b (diff) | |
download | FindThings-6bcf165f3af3da713953b9b3b80b4f101f7a0f7a.tar.gz FindThings-6bcf165f3af3da713953b9b3b80b4f101f7a0f7a.tar.bz2 FindThings-6bcf165f3af3da713953b9b3b80b4f101f7a0f7a.zip |
Lazy
Diffstat (limited to 'src/world.c')
-rw-r--r-- | src/world.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/world.c b/src/world.c index c2159d8..fd6fc19 100644 --- a/src/world.c +++ b/src/world.c @@ -328,9 +328,9 @@ void buildWorldBVH(World* world) world->bvhDebugSelect = 0; } -Seed generateWorldPlants(World* world, Seed seed) +Seed generateWorldPlants(World* world, Seed seed, int start, int end) { - for (int index = 0; index < WORLD_PLANT_COUNT; ++index) + for (int index = start; index < end; ++index) { FT_RANDOM16(seed); @@ -355,9 +355,9 @@ Seed generateWorldPlants(World* world, Seed seed) return seed; } -Seed generateWorldItems(World* world, Seed seed) +Seed generateWorldItems(World* world, Seed seed, int start, int end) { - for (int index = WORLD_PLANT_COUNT; index < WORLD_ENTITY_MAX; ++index) + for (int index = start; index < end; ++index) { FT_RANDOM16(seed); @@ -381,7 +381,12 @@ Seed generateWorldItems(World* world, Seed seed) Seed generatePond(World* world, Seed seed) { - Vector3 position; + // Get position. + int distanceRange = PLACE_POND_MAX_DISTANCE * 2; + Vector3 position = Vector3Scale(world->size, 0.5); + position.x += FT_RANDOM16(seed) % distanceRange - PLACE_POND_MAX_DISTANCE; + position.z += FT_RANDOM16(seed) % distanceRange - PLACE_POND_MAX_DISTANCE; + return seed; } @@ -415,8 +420,8 @@ World createWorld(Seed seed) // Places. generatePond(&world, seed); - seed = generateWorldPlants(&world, seed); - seed = generateWorldItems(&world, seed); + seed = generateWorldPlants(&world, seed, 0, WORLD_PLANT_COUNT); + seed = generateWorldItems(&world, seed, WORLD_PLANT_COUNT, WORLD_ENTITY_MAX); // Generate BVH. double currentTime = GetTime(); |