Mgvalleys: Make river depth variation and humidity drop optional (#7532)
[oweals/minetest.git] / src / mapgen / mg_biome.cpp
index a6ee411798fe644931f309f248d96b517d53870c..7f717011c307a2fdf8fc1f5694a797581ef611e8 100644 (file)
@@ -142,7 +142,7 @@ Biome *BiomeManager::getBiomeFromNoiseOriginal(float heat, float humidity, v3s16
                }
        }
 
-       mysrand(pos.Y + (heat + humidity) / 2);
+       mysrand(pos.Y + (heat + humidity) * 0.9f);
        if (biome_closest_blend && dist_min_blend <= dist_min &&
                        myrand_range(0, biome_closest_blend->vertical_blend) >=
                        pos.Y - biome_closest_blend->max_pos.Y)
@@ -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 'BIOME_NONE' so that cavegen can get the
+       // fallback biome when biome generation (which calculates the biomemap IDs)
+       // is disabled.
+       memset(biomemap, 0, sizeof(biome_t) * m_csize.X * m_csize.Z);
 }
 
 BiomeGenOriginal::~BiomeGenOriginal()
@@ -302,7 +307,7 @@ Biome *BiomeGenOriginal::calcBiomeFromNoise(float heat, float humidity, v3s16 po
        // Carefully tune pseudorandom seed variation to avoid single node dither
        // and create larger scale blending patterns similar to horizontal biome
        // blend.
-       mysrand(pos.Y + (heat + humidity) / 2);
+       mysrand(pos.Y + (heat + humidity) * 0.9f);
 
        if (biome_closest_blend && dist_min_blend <= dist_min &&
                        myrand_range(0, biome_closest_blend->vertical_blend) >=