From cde3d38766a19ddbe001e70573eb521eaf62cc66 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Wed, 26 Dec 2012 03:15:16 -0500 Subject: Clean up EmergeManager, do initial work on Mapgen configuration --- src/mapgen_v6.cpp | 117 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 50 deletions(-) (limited to 'src/mapgen_v6.cpp') diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index b1c2583ba..f31a754d6 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -32,9 +32,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" // For g_settings #include "main.h" // For g_profiler +/* #define AVERAGE_MUD_AMOUNT 4 - NoiseParams nparams_v6_def_terrain_base = {-AVERAGE_MUD_AMOUNT, 20.0, v3f(250.0, 250.0, 250.0), 82341, 5, 0.6}; NoiseParams nparams_v6_def_terrain_higher = @@ -51,42 +51,54 @@ NoiseParams nparams_v6_def_beach = {0.0, 1.0, v3f(250.0, 250.0, 250.0), 59420, 3, 0.50}; NoiseParams nparams_v6_def_biome = {0.0, 1.0, v3f(250.0, 250.0, 250.0), 9130, 3, 0.50}; -//NoiseParams nparams_v6_def_cave = -// {6.0, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50}; - +NoiseParams nparams_v6_def_cave = + {6.0, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50}; + + +MapgenV6Params mg_def_params_v6 = { + 0, + 1, + 5, + MG_TREES | MG_CAVES | MGV6_BIOME_BLEND, + 0.45, + 0.15, + &nparams_v6_def_terrain_base, + &nparams_v6_def_terrain_higher, + &nparams_v6_def_steepness, + &nparams_v6_def_height_select, + &nparams_v6_def_trees, + &nparams_v6_def_mud, + &nparams_v6_def_beach, + &nparams_v6_def_biome, + &nparams_v6_def_cave +}; +*/ -NoiseParams *np_terrain_base = &nparams_v6_def_terrain_base; -NoiseParams *np_terrain_higher = &nparams_v6_def_terrain_higher; -NoiseParams *np_steepness = &nparams_v6_def_steepness; -NoiseParams *np_height_select = &nparams_v6_def_height_select; -NoiseParams *np_trees = &nparams_v6_def_trees; -NoiseParams *np_mud = &nparams_v6_def_mud; -NoiseParams *np_beach = &nparams_v6_def_beach; -NoiseParams *np_biome = &nparams_v6_def_biome; -//NoiseParams *np_cave = &nparams_v6_def_cave; +/////////////////////////////////////////////////////////////////////////////// -MapgenV6::MapgenV6(int mapgenid, u64 seed) { +MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params) { this->generating = false; this->id = mapgenid; - this->seed = (int)seed; - this->water_level = 1; + this->seed = params->seed; + this->water_level = params->water_level; + this->flags = flags; + this->csize = v3s16(1, 1, 1) * params->chunksize * MAP_BLOCKSIZE; - this->csize = v3s16(5, 5, 5) * MAP_BLOCKSIZE; /////////////////get this from config! - this->ystride = csize.X; + this->freq_desert = params->freq_desert; + this->freq_beach = params->freq_beach; - this->use_smooth_biome_trans = g_settings->getBool("mgv6_use_smooth_biome_trans"); + this->ystride = csize.X; //////fix this - noise_terrain_base = new Noise(np_terrain_base, seed, csize.X, csize.Y); - noise_terrain_higher = new Noise(np_terrain_higher, seed, csize.X, csize.Y); - noise_steepness = new Noise(np_steepness, seed, csize.X, csize.Y); - noise_height_select = new Noise(np_height_select, seed, csize.X, csize.Y); - noise_trees = new Noise(np_trees, seed, csize.X, csize.Y); - noise_mud = new Noise(np_mud, seed, csize.X, csize.Y); - noise_beach = new Noise(np_beach, seed, csize.X, csize.Y); - noise_biome = new Noise(np_biome, seed, csize.X, csize.Y); - //noise_cave = new Noise(np_cave, seed, csize.X, csize.Y); + noise_terrain_base = new Noise(params->np_terrain_base, seed, csize.X, csize.Y); + noise_terrain_higher = new Noise(params->np_terrain_higher, seed, csize.X, csize.Y); + noise_steepness = new Noise(params->np_steepness, seed, csize.X, csize.Y); + noise_height_select = new Noise(params->np_height_select, seed, csize.X, csize.Y); + noise_trees = new Noise(params->np_trees, seed, csize.X, csize.Y); + noise_mud = new Noise(params->np_mud, seed, csize.X, csize.Y); + noise_beach = new Noise(params->np_beach, seed, csize.X, csize.Y); + noise_biome = new Noise(params->np_biome, seed, csize.X, csize.Y); map_terrain_base = noise_terrain_base->result; map_terrain_higher = noise_terrain_higher->result; @@ -96,7 +108,6 @@ MapgenV6::MapgenV6(int mapgenid, u64 seed) { map_mud = noise_mud->result; map_beach = noise_beach->result; map_biome = noise_biome->result; - //map_cave = noise_cave->result; } @@ -294,9 +305,7 @@ double MapgenV6::base_rock_level_2d(u64 seed, v2s16 p) 0.5+(float)p.X/250., 0.5+(float)p.Y/250., seed+82341, 5, 0.6);*/ double base = water_level + map_terrain_base[index]; - //return base; -//printf("%f ", base); -//return base; + // Higher ground level /*double higher = (double)WATER_LEVEL + 20. + 16. * noise2d_perlin( 0.5+(float)p.X/500., 0.5+(float)p.Y/500., @@ -316,6 +325,7 @@ double MapgenV6::base_rock_level_2d(u64 seed, v2s16 p) b = pow(b, 7); b *= 5; b = rangelim(b, 0.5, 1000.0); + // Values 1.5...100 give quite horrible looking slopes if(b > 1.5 && b < 100.0){ if(b < 10.0) @@ -323,22 +333,19 @@ double MapgenV6::base_rock_level_2d(u64 seed, v2s16 p) else b = 100.0; } - //dstream<<"b="<