summaryrefslogtreecommitdiff
path: root/src/mapgen_v6.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-12-22 23:16:00 +0100
committerest31 <MTest31@outlook.com>2016-12-22 23:16:00 +0100
commit81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (patch)
tree1e9ef1be1b3295a8673d6e4f0bdeb4c2d3a6015f /src/mapgen_v6.cpp
parent8077612dcb48221281e726a60eb97bf73fde462b (diff)
parent231ac33d34dfaaddf292c5f31b1eae43eeefba2d (diff)
downloadminetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.gz
minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.tar.bz2
minetest-81d56b94919dceb7b2e51d70b21a7ca22f852bd5.zip
Merge 0.4.15 changes into stable-0.4
0.4.15 release!
Diffstat (limited to 'src/mapgen_v6.cpp')
-rw-r--r--src/mapgen_v6.cpp82
1 files changed, 43 insertions, 39 deletions
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp
index c389b2ed4..79617a830 100644
--- a/src/mapgen_v6.cpp
+++ b/src/mapgen_v6.cpp
@@ -53,7 +53,7 @@ FlagDesc flagdesc_mapgen_v6[] = {
/////////////////////////////////////////////////////////////////////////////
-MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge)
+MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge)
: Mapgen(mapgenid, params, emerge)
{
this->m_emerge = emerge;
@@ -61,26 +61,25 @@ MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge)
this->heightmap = new s16[csize.X * csize.Z];
- MapgenV6Params *sp = (MapgenV6Params *)params->sparams;
- this->spflags = sp->spflags;
- this->freq_desert = sp->freq_desert;
- this->freq_beach = sp->freq_beach;
+ this->spflags = params->spflags;
+ this->freq_desert = params->freq_desert;
+ this->freq_beach = params->freq_beach;
- np_cave = &sp->np_cave;
- np_humidity = &sp->np_humidity;
- np_trees = &sp->np_trees;
- np_apple_trees = &sp->np_apple_trees;
+ np_cave = &params->np_cave;
+ np_humidity = &params->np_humidity;
+ np_trees = &params->np_trees;
+ np_apple_trees = &params->np_apple_trees;
//// Create noise objects
- noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Y);
- noise_terrain_higher = new Noise(&sp->np_terrain_higher, seed, csize.X, csize.Y);
- noise_steepness = new Noise(&sp->np_steepness, seed, csize.X, csize.Y);
- noise_height_select = new Noise(&sp->np_height_select, seed, csize.X, csize.Y);
- noise_mud = new Noise(&sp->np_mud, seed, csize.X, csize.Y);
- noise_beach = new Noise(&sp->np_beach, seed, csize.X, csize.Y);
- noise_biome = new Noise(&sp->np_biome, seed,
+ 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_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 + 2 * MAP_BLOCKSIZE, csize.Y + 2 * MAP_BLOCKSIZE);
- noise_humidity = new Noise(&sp->np_humidity, seed,
+ noise_humidity = new Noise(&params->np_humidity, seed,
csize.X + 2 * MAP_BLOCKSIZE, csize.Y + 2 * MAP_BLOCKSIZE);
//// Resolve nodes to be used
@@ -269,7 +268,7 @@ float MapgenV6::baseTerrainLevel(float terrain_base, float terrain_higher,
float MapgenV6::baseTerrainLevelFromNoise(v2s16 p)
{
- if ((spflags & MGV6_FLAT) || (flags & MG_FLAT))
+ if (spflags & MGV6_FLAT)
return water_level;
float terrain_base = NoisePerlin2D_PO(&noise_terrain_base->np,
@@ -295,7 +294,7 @@ float MapgenV6::baseTerrainLevelFromMap(v2s16 p)
float MapgenV6::baseTerrainLevelFromMap(int index)
{
- if ((spflags & MGV6_FLAT) || (flags & MG_FLAT))
+ if (spflags & MGV6_FLAT)
return water_level;
float terrain_base = noise_terrain_base->result[index];
@@ -403,7 +402,7 @@ bool MapgenV6::getHaveAppleTree(v2s16 p)
float MapgenV6::getMudAmount(int index)
{
- if ((spflags & MGV6_FLAT) || (flags & MG_FLAT))
+ if (spflags & MGV6_FLAT)
return MGV6_AVERAGE_MUD_AMOUNT;
/*return ((float)AVERAGE_MUD_AMOUNT + 2.0 * noise2d_perlin(
@@ -559,34 +558,38 @@ void MapgenV6::makeChunk(BlockMakeData *data)
if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
DungeonParams dp;
- dp.np_rarity = nparams_dungeon_rarity;
- dp.np_density = nparams_dungeon_density;
- dp.np_wetness = nparams_dungeon_wetness;
- dp.c_water = c_water_source;
+ dp.seed = seed;
+ dp.c_water = c_water_source;
+ dp.c_river_water = c_water_source;
+ dp.rooms_min = 2;
+ dp.rooms_max = 16;
+ dp.y_min = -MAX_MAP_GENERATION_LIMIT;
+ dp.y_max = MAX_MAP_GENERATION_LIMIT;
+ dp.np_density = NoiseParams(0.9, 0.5, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0);
+ dp.np_alt_wall = NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0);
+
if (getBiome(0, v2s16(node_min.X, node_min.Z)) == BT_DESERT) {
- dp.c_cobble = c_desert_stone;
- dp.c_moss = c_desert_stone;
- dp.c_stair = c_desert_stone;
+ dp.c_wall = c_desert_stone;
+ dp.c_alt_wall = CONTENT_IGNORE;
+ dp.c_stair = c_desert_stone;
dp.diagonal_dirs = true;
- dp.mossratio = 0.0;
dp.holesize = v3s16(2, 3, 2);
dp.roomsize = v3s16(2, 5, 2);
dp.notifytype = GENNOTIFY_TEMPLE;
} else {
- dp.c_cobble = c_cobble;
- dp.c_moss = c_mossycobble;
- dp.c_stair = c_stair_cobble;
+ dp.c_wall = c_cobble;
+ dp.c_alt_wall = c_mossycobble;
+ dp.c_stair = c_stair_cobble;
dp.diagonal_dirs = false;
- dp.mossratio = 3.0;
dp.holesize = v3s16(1, 2, 1);
dp.roomsize = v3s16(0, 0, 0);
dp.notifytype = GENNOTIFY_DUNGEON;
}
- DungeonGen dgen(this, &dp);
- dgen.generate(blockseed, full_node_min, full_node_max);
+ DungeonGen dgen(ndef, &gennotify, &dp);
+ dgen.generate(vm, blockseed, full_node_min, full_node_max);
}
// Add top and bottom side of water to transforming_liquid queue
@@ -596,7 +599,7 @@ void MapgenV6::makeChunk(BlockMakeData *data)
growGrass();
// Generate some trees, and add grass, if a jungle
- if ((spflags & MGV6_TREES) || (flags & MG_TREES))
+ if (spflags & MGV6_TREES)
placeTreesAndJungleGrass();
// Generate the registered decorations
@@ -623,7 +626,7 @@ void MapgenV6::calculateNoise()
int fx = full_node_min.X;
int fz = full_node_min.Z;
- if (!((spflags & MGV6_FLAT) || (flags & MG_FLAT))) {
+ if (!(spflags & MGV6_FLAT)) {
noise_terrain_base->perlinMap2D_PO(x, 0.5, z, 0.5);
noise_terrain_higher->perlinMap2D_PO(x, 0.5, z, 0.5);
noise_steepness->perlinMap2D_PO(x, 0.5, z, 0.5);
@@ -1066,9 +1069,10 @@ void MapgenV6::generateCaves(int max_stone_y)
}
for (u32 i = 0; i < caves_count + bruises_count; i++) {
- bool large_cave = (i >= caves_count);
- CaveV6 cave(this, &ps, &ps2, large_cave);
+ CavesV6 cave(ndef, &gennotify, water_level, c_water_source, c_lava_source);
- cave.makeCave(node_min, node_max, max_stone_y);
+ bool large_cave = (i >= caves_count);
+ cave.makeCave(vm, node_min, node_max, &ps, &ps2,
+ large_cave, max_stone_y, heightmap);
}
}