Permalink
Browse files
Mapgen flags: Add 'biomes' global mapgen flag (#7355 )
Previously the only way to disable biomes was to 'clear' the registered
biomes in a mod, but this method causes large amounts of unnecessary
processing:
1. Calculation of 4 2D noises.
2. Looping through all nodes of a mapchunk replacing nodes with identical
nodes.
The new flag disables those operations.
Loading branch information...
@@ -1282,7 +1282,7 @@ mapgen_limit (Map generation limit) int 31000 0 31000
# and junglegrass, in all other mapgens this flag controls all decorations.
# Flags that are not enabled are not modified from the default.
# Flags starting with 'no' are used to explicitly disable them.
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations caves,dungeons,light,decorations,nocaves,nodungeons,nolight,nodecorations
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations,biomes caves,dungeons,light,decorations,biomes, nocaves,nodungeons,nolight,nodecorations,nobiomes
# Whether dungeons occasionally project from the terrain.
projecting_dungeons (Projecting dungeons) bool true
@@ -56,7 +56,8 @@ FlagDesc flagdesc_mapgen[] = {
{" dungeons" , MG_DUNGEONS},
{" light" , MG_LIGHT},
{" decorations" , MG_DECORATIONS},
{NULL , 0 }
{" biomes" , MG_BIOMES},
{NULL , 0 }
};
FlagDesc flagdesc_gennotify[] = {
@@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MG_FLAT 0x08 // Deprecated. Moved into mgv6 flags
#define MG_LIGHT 0x10
#define MG_DECORATIONS 0x20
#define MG_BIOMES 0x40
typedef u8 biome_t ; // copy from mg_biome.h to avoid an unnecessary include
@@ -122,7 +123,7 @@ struct MapgenParams {
u64 seed = 0 ;
s16 water_level = 1 ;
s16 mapgen_limit = MAX_MAP_GENERATION_LIMIT;
u32 flags = MG_CAVES | MG_LIGHT | MG_DECORATIONS;
u32 flags = MG_CAVES | MG_LIGHT | MG_DECORATIONS | MG_BIOMES ;
BiomeParams *bparams = nullptr ;
@@ -247,8 +247,10 @@ void MapgenCarpathian::makeChunk(BlockMakeData *data)
updateHeightmap (node_min, node_max);
// Init biome generator, place biome-specific nodes, and build biomemap
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
if (flags & MG_BIOMES) {
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
}
// Generate tunnels, caverns and large randomwalk caves
if (flags & MG_CAVES) {
@@ -284,7 +286,8 @@ void MapgenCarpathian::makeChunk(BlockMakeData *data)
m_emerge->oremgr ->placeAllOres (this , blockseed, node_min, node_max);
// Sprinkle some dust on top after everything else was generated
dustTopNodes ();
if (flags & MG_BIOMES)
dustTopNodes ();
// Update liquids
updateLiquid (&data->transforming_liquid , full_node_min, full_node_max);
@@ -195,8 +195,10 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
updateHeightmap (node_min, node_max);
// Init biome generator, place biome-specific nodes, and build biomemap
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
if (flags & MG_BIOMES) {
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
}
if (flags & MG_CAVES) {
// Generate tunnels
@@ -217,7 +219,8 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
m_emerge->oremgr ->placeAllOres (this , blockseed, node_min, node_max);
// Sprinkle some dust on top after everything else was generated
dustTopNodes ();
if (flags & MG_BIOMES)
dustTopNodes ();
// printf("makeChunk: %dms\n", t.stop());
@@ -206,8 +206,10 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
updateHeightmap (node_min, node_max);
// Init biome generator, place biome-specific nodes, and build biomemap
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
if (flags & MG_BIOMES) {
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
}
if (flags & MG_CAVES) {
// Generate tunnels
@@ -228,7 +230,8 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
m_emerge->oremgr ->placeAllOres (this , blockseed, node_min, node_max);
// Sprinkle some dust on top after everything else was generated
dustTopNodes ();
if (flags & MG_BIOMES)
dustTopNodes ();
// printf("makeChunk: %dms\n", t.stop());
@@ -206,8 +206,10 @@ void MapgenV5::makeChunk(BlockMakeData *data)
updateHeightmap (node_min, node_max);
// Init biome generator, place biome-specific nodes, and build biomemap
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
if (flags & MG_BIOMES) {
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
}
// Generate tunnels, caverns and large randomwalk caves
if (flags & MG_CAVES) {
@@ -243,7 +245,8 @@ void MapgenV5::makeChunk(BlockMakeData *data)
m_emerge->oremgr ->placeAllOres (this , blockseed, node_min, node_max);
// Sprinkle some dust on top after everything else was generated
dustTopNodes ();
if (flags & MG_BIOMES)
dustTopNodes ();
// printf("makeChunk: %dms\n", t.stop());
@@ -326,8 +326,10 @@ void MapgenV7::makeChunk(BlockMakeData *data)
updateHeightmap (node_min, node_max);
// Init biome generator, place biome-specific nodes, and build biomemap
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
if (flags & MG_BIOMES) {
biomegen->calcBiomeNoise (node_min);
generateBiomes ();
}
// Generate tunnels, caverns and large randomwalk caves
if (flags & MG_CAVES) {
@@ -363,7 +365,8 @@ void MapgenV7::makeChunk(BlockMakeData *data)
m_emerge->oremgr ->placeAllOres (this , blockseed, node_min, node_max);
// Sprinkle some dust on top after everything else was generated
dustTopNodes ();
if (flags & MG_BIOMES)
dustTopNodes ();
// Update liquids
updateLiquid (&data->transforming_liquid , full_node_min, full_node_max);
@@ -231,7 +231,8 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
updateHeightmap (node_min, node_max);
// Place biome-specific nodes and build biomemap
generateBiomes ();
if (flags & MG_BIOMES)
generateBiomes ();
// Generate tunnels, caverns and large randomwalk caves
if (flags & MG_CAVES) {
@@ -265,7 +266,8 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
m_emerge->oremgr ->placeAllOres (this , blockseed, node_min, node_max);
// Sprinkle some dust on top after everything else was generated
dustTopNodes ();
if (flags & MG_BIOMES)
dustTopNodes ();
updateLiquid (&data->transforming_liquid , full_node_min, full_node_max);
@@ -192,7 +192,12 @@ BiomeGenOriginal::BiomeGenOriginal(BiomeManager *biomemgr,
heatmap = noise_heat->result ;
humidmap = noise_humidity->result ;
biomemap = new biome_t [m_csize.X * m_csize.Z ];
// Initialise with the ID of the default biome so that cavegen can get
// biomes when biome generation (which calculates the biomemap IDs) is
// disabled.
memset (biomemap, 0 , sizeof (biome_t ) * m_csize.X * m_csize.Z );
}
BiomeGenOriginal::~BiomeGenOriginal ()
Toggle all file notes
0 comments on commit
0b23253