X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fmapgen_v7.cpp;h=4b263bdb3b70156fcf3a2c54e9983f36581593a3;hb=8299e4b67eff48e0f6e101afea2fae8f0e65c421;hp=d74d050ef9d947a106bcfcd482a95ac3d52f0c67;hpb=34e8e0e5ce2887391f55d5d7285088ec2c0f5761;p=minetest.git diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp index d74d050ef..4b263bdb3 100644 --- a/src/mapgen_v7.cpp +++ b/src/mapgen_v7.cpp @@ -54,17 +54,21 @@ FlagDesc flagdesc_mapgen_v7[] = { MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge) : MapgenBasic(mapgenid, params, emerge) { - this->spflags = params->spflags; - this->cave_width = params->cave_width; - this->large_cave_depth = params->large_cave_depth; - this->lava_depth = params->lava_depth; - this->float_mount_density = params->float_mount_density; - float_mount_height_lim = MYMAX(params->float_mount_height, 1.0f); - this->floatland_level = params->floatland_level; - this->shadow_limit = params->shadow_limit; - this->cavern_limit = params->cavern_limit; - this->cavern_taper = params->cavern_taper; - this->cavern_threshold = params->cavern_threshold; + spflags = params->spflags; + cave_width = params->cave_width; + large_cave_depth = params->large_cave_depth; + lava_depth = params->lava_depth; + float_mount_density = params->float_mount_density; + floatland_level = params->floatland_level; + shadow_limit = params->shadow_limit; + cavern_limit = params->cavern_limit; + cavern_taper = params->cavern_taper; + cavern_threshold = params->cavern_threshold; + + // This is to avoid a divide-by-zero. + // Parameter will be saved to map_meta.txt in limited form. + params->float_mount_height = MYMAX(params->float_mount_height, 1.0f); + float_mount_height = params->float_mount_height; // 2D noise noise_terrain_base = new Noise(¶ms->np_terrain_base, seed, csize.X, csize.Z); @@ -294,7 +298,7 @@ void MapgenV7::makeChunk(BlockMakeData *data) // Init biome generator, place biome-specific nodes, and build biomemap biomegen->calcBiomeNoise(node_min); - MgStoneType stone_type = generateBiomes(); + MgStoneType stone_type = generateBiomes(water_level - 1); // Generate caverns, tunnels and classic caves if (flags & MG_CAVES) { @@ -318,10 +322,12 @@ void MapgenV7::makeChunk(BlockMakeData *data) // Generate the registered decorations if (flags & MG_DECORATIONS) - m_emerge->decomgr->placeAllDecos(this, blockseed, node_min, node_max); + m_emerge->decomgr->placeAllDecos(this, blockseed, + node_min, node_max, water_level - 1); // Generate the registered ores - m_emerge->oremgr->placeAllOres(this, blockseed, node_min, node_max); + m_emerge->oremgr->placeAllOres(this, blockseed, + node_min, node_max, water_level - 1); // Sprinkle some dust on top after everything else was generated dustTopNodes(); @@ -405,8 +411,8 @@ bool MapgenV7::getFloatlandMountainFromMap(int idx_xyz, int idx_xz, s16 y) { // Make rim 2 nodes thick to match floatland base terrain float density_gradient = (y >= floatland_level) ? - -pow((float)(y - floatland_level) / float_mount_height_lim, 0.75f) : - -pow((float)(floatland_level - 1 - y) / float_mount_height_lim, 0.75f); + -pow((float)(y - floatland_level) / float_mount_height, 0.75f) : + -pow((float)(floatland_level - 1 - y) / float_mount_height, 0.75f); float floatn = noise_mountain->result[idx_xyz] + float_mount_density;