From: Elias Fleckenstein Date: Wed, 29 Sep 2021 13:59:30 +0000 (+0200) Subject: Fix boulder generation X-Git-Tag: 0.2~19 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=f2ab14fbe89612aff88cc7367e37202cfbf8bac5;p=dragonblocks_alpha.git Fix boulder generation --- diff --git a/.gitignore b/.gitignore index 0d0a330..1053609 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ _deps DragonblocksServer Dragonblocks world.sqlite +world.sqlite-journal DragonblocksAlpha-*.zip src/version.h screenshot-*.png diff --git a/src/client/client_node.c b/src/client/client_node.c index 6289b08..832400d 100644 --- a/src/client/client_node.c +++ b/src/client/client_node.c @@ -23,8 +23,8 @@ static void render_grass(v3s32 pos, unused MapNode *node, Vertex3D *vertex, unus static void render_stone(v3s32 pos, unused MapNode *node, Vertex3D *vertex, unused int f, unused int v) { - vertex->textureCoordinates.s += smooth2d(U32(pos.x), U32(pos.z), 0, seed + SO_TEXTURE_OFFSET_S); - vertex->textureCoordinates.t += smooth2d(U32(pos.x), U32(pos.z), 0, seed + SO_TEXTURE_OFFSET_T); + vertex->textureCoordinates.s += noise2d(pos.x, pos.z, 0, seed + SO_TEXTURE_OFFSET_S); + vertex->textureCoordinates.t += noise2d(pos.x, pos.z, 0, seed + SO_TEXTURE_OFFSET_T); } static void render_wood(unused v3s32 pos, unused MapNode *node, Vertex3D *vertex, int f, unused int v) diff --git a/src/server/biomes.c b/src/server/biomes.c index d596e87..5518515 100644 --- a/src/server/biomes.c +++ b/src/server/biomes.c @@ -92,7 +92,7 @@ static f64 get_ocean_level_factor(f64 factor, OceanLevel level) static bool is_vulcano(v2s32 pos) { f64 factor; - return smooth2d(U32(pos.x), U32(pos.y), 0, seed + SO_VULCANO) > 0.0 && get_biome((v2s32) {pos.x * MAPBLOCK_SIZE, pos.y * MAPBLOCK_SIZE}, &factor) == BIOME_OCEAN && get_ocean_level(factor) == OL_DEEP_OCEAN; + return noise2d(pos.x, pos.y, 0, seed + SO_VULCANO) > 0.0 && get_biome((v2s32) {pos.x * MAPBLOCK_SIZE, pos.y * MAPBLOCK_SIZE}, &factor) == BIOME_OCEAN && get_ocean_level(factor) == OL_DEEP_OCEAN; } static bool find_near_vulcano(v2s32 pos, v2s32 *result) @@ -242,12 +242,12 @@ static s32 height_hills(unused v2s32 pos, unused f64 factor, s32 height, unused static Node generate_hills(v3s32 pos, s32 diff, unused f64 humidity, unused f64 temperature, unused f64 factor, unused MapBlock *block, List *changed_blocks, unused void *row_data, unused void *block_data) { - if (diff == 2 && smooth2d(U32(pos.x), U32(pos.z), 0, seed + SO_BOULDER_CENTER) > 0.999) { + if (diff == 2 && noise2d(pos.x, pos.z, 0, seed + SO_BOULDER_CENTER) > 0.999) { for (s8 bx = -1; bx <= 1; bx++) { for (s8 by = -1; by <= 1; by++) { for (s8 bz = -1; bz <= 1; bz++) { v3s32 bpos = {pos.x + bx, pos.y + by, pos.z + bz}; - if (smooth3d(bpos.x, bpos.y, bpos.z, 0, seed + SO_BOULDER) > 0.0) + if (noise3d(bpos.x, bpos.y, bpos.z, 0, seed + SO_BOULDER) > 0.0) mapgen_set_node(bpos, map_node_create(NODE_STONE), MGS_BOULDERS, changed_blocks); } }