/*
Minetest
-Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
+Copyright (C) 2010-2015 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
+Copyright (C) 2010-2015 paramat, Matt Gregory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
#include "content_sao.h"
#include "nodedef.h"
#include "voxelalgorithms.h"
+//#include "profiler.h" // For TimeTaker
#include "settings.h" // For g_settings
#include "emerge.h"
#include "dungeongen.h"
{
spflags = MGV7_MOUNTAINS | MGV7_RIDGES;
- np_terrain_base = NoiseParams(4, 70, v3f(600, 600, 600), 82341, 5, 0.6, 2.0);
- np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0);
- np_terrain_persist = NoiseParams(0.6, 0.12, v3f(2000, 2000, 2000), 539, 3, 0.5, 2.0);
- np_height_select = NoiseParams(-12, 24, v3f(500, 500, 500), 4213, 6, 0.69, 2.0);
- np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 4, 0.7, 2.0);
- np_mount_height = NoiseParams(184, 72, v3f(1000, 1000, 1000), 72449, 3, 0.5, 2.0);
- np_ridge_uwater = NoiseParams(0, 1, v3f(1000, 1000, 1000), 85039, 5, 0.6, 2.0);
- np_mountain = NoiseParams(-0.6, 1, v3f(250, 350, 250), 5333, 5, 0.68, 2.0);
- np_ridge = NoiseParams(0, 1, v3f(100, 100, 100), 6467, 4, 0.75, 2.0);
- np_cave1 = NoiseParams(0, 12, v3f(100, 100, 100), 52534, 4, 0.5, 2.0);
- np_cave2 = NoiseParams(0, 12, v3f(100, 100, 100), 10325, 4, 0.5, 2.0);
+ np_terrain_base = NoiseParams(4, 70, v3f(600, 600, 600), 82341, 5, 0.6, 2.0);
+ np_terrain_alt = NoiseParams(4, 25, v3f(600, 600, 600), 5934, 5, 0.6, 2.0);
+ np_terrain_persist = NoiseParams(0.6, 0.1, v3f(2000, 2000, 2000), 539, 3, 0.6, 2.0);
+ np_height_select = NoiseParams(-12, 24, v3f(500, 500, 500), 4213, 6, 0.7, 2.0);
+ np_filler_depth = NoiseParams(0, 1.2, v3f(150, 150, 150), 261, 3, 0.7, 2.0);
+ np_mount_height = NoiseParams(256, 112, v3f(1000, 1000, 1000), 72449, 3, 0.6, 2.0);
+ np_ridge_uwater = NoiseParams(0, 1, v3f(1000, 1000, 1000), 85039, 5, 0.6, 2.0);
+ np_mountain = NoiseParams(-0.6, 1, v3f(250, 350, 250), 5333, 5, 0.63, 2.0);
+ np_ridge = NoiseParams(0, 1, v3f(100, 100, 100), 6467, 4, 0.75, 2.0);
+ np_cave1 = NoiseParams(0, 12, v3f(100, 100, 100), 52534, 4, 0.5, 2.0);
+ np_cave2 = NoiseParams(0, 12, v3f(100, 100, 100), 10325, 4, 0.5, 2.0);
}
void MapgenV7Params::writeParams(Settings *settings) const
{
- settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, (u32)-1);
+ settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, U32_MAX);
settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base);
settings->setNoiseParams("mgv7_np_terrain_alt", np_terrain_alt);
bool MapgenV7::getMountainTerrainAtPoint(s16 x, s16 y, s16 z)
{
float mnt_h_n = NoisePerlin2D(&noise_mount_height->np, x, z, seed);
+ float density_gradient = -((float)y / mnt_h_n);
float mnt_n = NoisePerlin3D(&noise_mountain->np, x, y, z, seed);
- return mnt_n * mnt_h_n >= (float)y;
+
+ return mnt_n + density_gradient >= 0.0;
}
bool MapgenV7::getMountainTerrainFromMap(int idx_xyz, int idx_xz, s16 y)
{
float mounthn = noise_mount_height->result[idx_xz];
+ float density_gradient = -((float)y / mounthn);
float mountn = noise_mountain->result[idx_xyz];
- return mountn * mounthn >= (float)y;
+
+ return mountn + density_gradient >= 0.0;
}
MapNode n_water(c_water_source);
v3s16 em = vm->m_area.getExtent();
- s16 surface_min_y = MAP_GENERATION_LIMIT;
- s16 surface_max_y = -MAP_GENERATION_LIMIT;
+ s16 surface_min_y = MAX_MAP_GENERATION_LIMIT;
+ s16 surface_max_y = -MAX_MAP_GENERATION_LIMIT;
u32 index = 0;
for (s16 z = node_min.Z; z <= node_max.Z; z++)
// If there is air or water above enable top/filler placement, otherwise force
// nplaced to stone level by setting a number exceeding any possible filler depth.
- u16 nplaced = (air_above || water_above) ? 0 : (u16)-1;
+ u16 nplaced = (air_above || water_above) ? 0 : U16_MAX;
for (s16 y = node_max.Y; y >= node_min.Y; y--) {
content_t c = vm->m_data[vi].getContent();
// This is done by aborting the cycle of top/filler placement
// immediately by forcing nplaced to stone level.
if (c_below == CONTENT_AIR || c_below == c_water_source)
- nplaced = (u16)-1;
+ nplaced = U16_MAX;
if (nplaced < depth_top) {
vm->m_data[vi] = MapNode(biome->c_top);
air_above = true;
water_above = false;
} else { // Possible various nodes overgenerated from neighbouring mapchunks
- nplaced = (u16)-1; // Disable top/filler placement
+ nplaced = U16_MAX; // Disable top/filler placement
air_above = false;
water_above = false;
}
cave.makeCave(node_min, node_max, max_stone_y);
}
}
-