Generate beaches

master
Perttu Ahola 2012-03-29 03:44:37 +03:00
parent d376148ca1
commit 75821c6889
3 changed files with 13 additions and 10 deletions

View File

@ -125,7 +125,7 @@ HeightPoint ground_height(u64 seed, v2s16 p2d)
hp.ma = (4)*BS;
/*hp.gh = BS*base_rock_level_2d(seed, p2d);
hp.ma = BS*get_mud_add_amount(seed, p2d);*/
hp.have_sand = mapgen::get_have_sand(seed, p2d);
hp.have_sand = mapgen::get_have_beach(seed, p2d);
if(hp.gh > BS*WATER_LEVEL)
hp.tree_amount = mapgen::tree_amount_2d(seed, p2d);
else

View File

@ -1268,14 +1268,14 @@ double get_mud_add_amount(u64 seed, v2s16 p)
seed+91013, 3, 0.55));
}
bool get_have_sand(u64 seed, v2s16 p2d)
bool get_have_beach(u64 seed, v2s16 p2d)
{
// Determine whether to have sand here
double sandnoise = noise2d_perlin(
0.5+(float)p2d.X/500, 0.5+(float)p2d.Y/500,
seed+59420, 3, 0.50);
return (sandnoise > -0.15);
return (sandnoise > 0.15);
}
u32 get_blockseed(u64 seed, v3s16 p)
@ -1769,17 +1769,20 @@ void make_block(BlockMakeData *data)
// Randomize mud amount
s16 mud_add_amount = get_mud_add_amount(data->seed, p2d) / 2.0;
if(mud_add_amount <= 0){
mud_add_amount = 1 - mud_add_amount;
addnode = MapNode(c_gravel);
}
// Find ground level
s16 surface_y = find_stone_level(vmanip, p2d, ndef);
// Handle area not found
if(surface_y == vmanip.m_area.MinEdge.Y - 1)
continue;
if(mud_add_amount <= 0){
mud_add_amount = 1 - mud_add_amount;
addnode = MapNode(c_gravel);
} else if(get_have_beach(data->seed, p2d) &&
surface_y + mud_add_amount <= WATER_LEVEL+2){
addnode = MapNode(c_sand);
}
/*
If topmost node is grass, change it to mud.
It might be if it was flown to there from a neighboring
@ -2367,7 +2370,7 @@ void make_block(BlockMakeData *data)
// Node position
v2s16 p2d(x,z);
{
bool possibly_have_sand = get_have_sand(data->seed, p2d);
bool possibly_have_sand = get_have_beach(data->seed, p2d);
bool have_sand = false;
u32 current_depth = 0;
bool air_detected = false;

View File

@ -49,7 +49,7 @@ namespace mapgen
/*
These are used by FarMesh
*/
bool get_have_sand(u64 seed, v2s16 p2d);
bool get_have_beach(u64 seed, v2s16 p2d);
double tree_amount_2d(u64 seed, v2s16 p);
struct BlockMakeData