From 7efe89ff584b2c0338dcede4c1e08504d0158780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20R=C3=BChl?= Date: Sun, 26 Jun 2011 13:47:21 +0200 Subject: backported cactus, papyrus and clay --- src/mapgen.cpp | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 10 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 801dd72b1..71696a349 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -151,6 +151,34 @@ static void make_tree(VoxelManipulator &vmanip, v3s16 p0) } } +void make_papyrus(VoxelManipulator &vmanip, v3s16 p0) +{ + MapNode papyrusnode(CONTENT_PAPYRUS); + + s16 trunk_h = myrand_range(2, 3); + v3s16 p1 = p0; + for(s16 ii=0; iiseed+4321, 6, 0.95); + + have_clay = have_sand && (claynoise > 1.25); + // Use fast index incrementing s16 start_y = node_max.Y+2; v3s16 em = vmanip.m_area.getExtent(); @@ -1778,7 +1815,10 @@ void make_block(BlockMakeData *data) { if(have_sand) { - vmanip.m_data[i] = MapNode(CONTENT_SAND); + if (have_clay) + vmanip.m_data[i] = MapNode(CONTENT_CLAY); + else + vmanip.m_data[i] = MapNode(CONTENT_SAND); } #if 1 else if(current_depth==0 && !water_detected @@ -1823,7 +1863,7 @@ void make_block(BlockMakeData *data) //s16 y = find_ground_level(data->vmanip, v2s16(x,z)); s16 y = find_ground_level_from_noise(data->seed, v2s16(x,z), 4); // Don't make a tree under water level - if(y < WATER_LEVEL) + if(y < WATER_LEVEL - 1) continue; // Make sure tree fits (only trees whose starting point is // at this block are added) @@ -1847,19 +1887,36 @@ void make_block(BlockMakeData *data) // If not found, handle next one if(found == false) continue; - /* - Trees grow only on mud and grass - */ + { u32 i = data->vmanip->m_area.index(p); MapNode *n = &data->vmanip->m_data[i]; - if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS) + + if(n->d != CONTENT_MUD && n->d != CONTENT_GRASS && n->d != CONTENT_SAND) + continue; + + // Papyrus grows only on mud and in water + if(n->d == CONTENT_MUD && y == WATER_LEVEL - 1) + { + p.Y++; + make_papyrus(vmanip, p); + } + // Don't make a tree under water level + if(y < WATER_LEVEL) continue; + // Trees grow only on mud and grass + if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) + { + p.Y++; + make_tree(vmanip, p); + } + // Cactii grow only on sand + else if(n->d == CONTENT_SAND) + { + p.Y++; + make_cactus(vmanip, p); + } } - // Tree will be placed one higher - p.Y++; - // Make a tree - make_tree(vmanip, p); } #if 0 -- cgit v1.2.3 From a676493f46984efc4aa8cc14374f44b0ae0bd549 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 13 Jul 2011 16:21:20 +0200 Subject: * regression fix, papyrus should appear again now --- src/mapgen.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 71696a349..b7e077f68 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1863,7 +1863,7 @@ void make_block(BlockMakeData *data) //s16 y = find_ground_level(data->vmanip, v2s16(x,z)); s16 y = find_ground_level_from_noise(data->seed, v2s16(x,z), 4); // Don't make a tree under water level - if(y < WATER_LEVEL - 1) + if(y < WATER_LEVEL) continue; // Make sure tree fits (only trees whose starting point is // at this block are added) @@ -1878,7 +1878,7 @@ void make_block(BlockMakeData *data) { u32 i = data->vmanip->m_area.index(p); MapNode *n = &data->vmanip->m_data[i]; - if(n->d != CONTENT_AIR && n->d != CONTENT_IGNORE) + if(n->d != CONTENT_AIR && n->d != CONTENT_WATERSOURCE && n->d != CONTENT_IGNORE) { found = true; break; @@ -1896,22 +1896,19 @@ void make_block(BlockMakeData *data) continue; // Papyrus grows only on mud and in water - if(n->d == CONTENT_MUD && y == WATER_LEVEL - 1) + if(n->d == CONTENT_MUD && y <= WATER_LEVEL) { p.Y++; make_papyrus(vmanip, p); } - // Don't make a tree under water level - if(y < WATER_LEVEL) - continue; - // Trees grow only on mud and grass - if(n->d == CONTENT_MUD || n->d == CONTENT_GRASS) + // Trees grow only on mud and grass, on land + else if((n->d == CONTENT_MUD || n->d == CONTENT_GRASS) && y > WATER_LEVEL + 2) { p.Y++; make_tree(vmanip, p); } - // Cactii grow only on sand - else if(n->d == CONTENT_SAND) + // Cactii grow only on sand, on land + else if(n->d == CONTENT_SAND && y > WATER_LEVEL + 2) { p.Y++; make_cactus(vmanip, p); -- cgit v1.2.3 From b96450b58666b26e960684b398c54201736e8274 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 13 Jul 2011 23:10:41 +0200 Subject: * slightly different values for 3d perlin noise --- src/mapgen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index b7e077f68..0fd2e4c82 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -903,8 +903,8 @@ NoiseParams get_cave_noise2_params(u64 seed) NoiseParams get_ground_noise1_params(u64 seed) { - return NoiseParams(NOISE_PERLIN, seed+983240, 5, - 0.60, 100.0, 30.0); + return NoiseParams(NOISE_PERLIN, seed+983240, 4, + 0.55, 80.0, 40.0); } NoiseParams get_ground_crumbleness_params(u64 seed) @@ -939,7 +939,7 @@ bool val_is_ground(double ground_noise1_val, v3s16 p, u64 seed) double f = 0.8 + noise2d_perlin( 0.5+(float)p.X/250, 0.5+(float)p.Z/250, - seed+920381, 3, 0.5); + seed+920381, 3, 0.45); if(f < 0.01) f = 0.01; else if(f >= 1.0) -- cgit v1.2.3 From 5383aa847f1b9d5400def4f2a1b83904dcea9db9 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Wed, 13 Jul 2011 23:12:18 +0200 Subject: * possible fix for large cubic holes in map --- src/mapgen.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 0fd2e4c82..a491ac81a 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1317,7 +1317,8 @@ void make_block(BlockMakeData *data) data->seed, v2s16(blockpos.X, blockpos.Z), 1); // Maximum amount of ground above the bottom of the central block s16 maximum_ground_depth = maximum_groundlevel - node_min.Y; - + + #if 0 /* Special case for high air or water: Just fill with air and water. */ @@ -1351,6 +1352,7 @@ void make_block(BlockMakeData *data) // We're done return; } + #endif /* If block is deep underground, this is set to true and ground -- cgit v1.2.3 From 287b735224a905cbc679420aea64c9ac8289c488 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Fri, 15 Jul 2011 02:23:41 +0200 Subject: * possibly nicer trees --- src/mapgen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index d7b6e56c4..bb4785bbf 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -85,7 +85,7 @@ static void make_tree(VoxelManipulator &vmanip, v3s16 p0) MapNode treenode(CONTENT_TREE); MapNode leavesnode(CONTENT_LEAVES); - s16 trunk_h = myrand_range(3, 6); + s16 trunk_h = myrand_range(4, 5); v3s16 p1 = p0; for(s16 ii=0; ii leaves_d(new u8[leaves_a.getVolume()]); Buffer leaves_d(leaves_a.getVolume()); for(s32 i=0; i Date: Fri, 15 Jul 2011 06:37:47 +0200 Subject: * regression fix, clay occurs again now --- src/mapgen.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index bb4785bbf..dfea862a5 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1840,13 +1840,6 @@ void make_block(BlockMakeData *data) bool water_detected = false; bool have_clay = false; - // Determine whether to have clay in the sand here - double claynoise = noise2d_perlin( - 0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500, - data->seed+4321, 6, 0.95); - - have_clay = have_sand && (claynoise > 1.25); - // Use fast index incrementing s16 start_y = node_max.Y+2; v3s16 em = vmanip.m_area.getExtent(); @@ -1873,6 +1866,15 @@ void make_block(BlockMakeData *data) { if(have_sand) { + // Determine whether to have clay in the sand here + double claynoise = noise2d_perlin( + 0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500, + data->seed+4321, 6, 0.95) + 0.5; + + have_clay = (y <= WATER_LEVEL) && (y >= WATER_LEVEL-2) && ( + ((claynoise > 0) && (claynoise < 0.04) && (current_depth == 0)) || + ((claynoise > 0) && (claynoise < 0.12) && (current_depth == 1)) + ); if (have_clay) vmanip.m_data[i] = MapNode(CONTENT_CLAY); else -- cgit v1.2.3