]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapgen_v7.cpp
Network: Remove large parts of deprecated legacy code (#6404)
[minetest.git] / src / mapgen_v7.cpp
index e63c648bc012a4ec18f8c8060bba2ea8491e4863..53f385b5396a8ab8f6e2cd6a24084cafbb881404 100644 (file)
@@ -128,22 +128,22 @@ MapgenV7::~MapgenV7()
 }
 
 
-MapgenV7Params::MapgenV7Params()
+MapgenV7Params::MapgenV7Params():
+       np_terrain_base      (4,    70,   v3f(600,  600,  600),  82341, 5, 0.6,  2.0),
+       np_terrain_alt       (4,    25,   v3f(600,  600,  600),  5934,  5, 0.6,  2.0),
+       np_terrain_persist   (0.6,  0.1,  v3f(2000, 2000, 2000), 539,   3, 0.6,  2.0),
+       np_height_select     (-8,   16,   v3f(500,  500,  500),  4213,  6, 0.7,  2.0),
+       np_filler_depth      (0,    1.2,  v3f(150,  150,  150),  261,   3, 0.7,  2.0),
+       np_mount_height      (256,  112,  v3f(1000, 1000, 1000), 72449, 3, 0.6,  2.0),
+       np_ridge_uwater      (0,    1,    v3f(1000, 1000, 1000), 85039, 5, 0.6,  2.0),
+       np_floatland_base    (-0.6, 1.5,  v3f(600,  600,  600),  114,   5, 0.6,  2.0),
+       np_float_base_height (48,   24,   v3f(300,  300,  300),  907,   4, 0.7,  2.0),
+       np_mountain          (-0.6, 1,    v3f(250,  350,  250),  5333,  5, 0.63, 2.0),
+       np_ridge             (0,    1,    v3f(100,  100,  100),  6467,  4, 0.75, 2.0),
+       np_cavern            (0,    1,    v3f(384,  128,  384),  723,   5, 0.63, 2.0),
+       np_cave1             (0,    12,   v3f(61,   61,   61),   52534, 3, 0.5,  2.0),
+       np_cave2             (0,    12,   v3f(67,   67,   67),   10325, 3, 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(-8,   16,   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_floatland_base    = NoiseParams(-0.6, 1.5,  v3f(600,  600,  600),  114,   5, 0.6,  2.0);
-       np_float_base_height = NoiseParams(48,   24,   v3f(300,  300,  300),  907,   4, 0.7,  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_cavern            = NoiseParams(0,    1,    v3f(384,  128,  384),  723,   5, 0.63, 2.0);
-       np_cave1             = NoiseParams(0,    12,   v3f(61,   61,   61),   52534, 3, 0.5,  2.0);
-       np_cave2             = NoiseParams(0,    12,   v3f(67,   67,   67),   10325, 3, 0.5,  2.0);
 }
 
 
@@ -238,21 +238,22 @@ int MapgenV7::getSpawnLevelAtPoint(v2s16 p)
        // If mountains are disabled, terrain level is base terrain level.
        // Avoids mid-air spawn where mountain terrain would have been.
        if (!(spflags & MGV7_MOUNTAINS)) {
-               if (y <= water_level || y > max_spawn_y)
+               if (y < water_level || y > max_spawn_y)
                        return MAX_MAP_GENERATION_LIMIT;  // Unsuitable spawn point
-               else
-                       // + 1 to not be half-buried in a potential node-deep biome 'dust'
-                       return y + 1;
+
+               // y + 2 because y is surface level and due to biome 'dust'
+               return y + 2;
        }
 
        // Search upwards for first node without mountain terrain
        int iters = 256;
        while (iters > 0 && y <= max_spawn_y) {
-               if (!getMountainTerrainAtPoint(p.X, y + 1, p.Y)) {  // If air above
+               if (!getMountainTerrainAtPoint(p.X, y + 1, p.Y)) {
                        if (y <= water_level || y > max_spawn_y)
                                return MAX_MAP_GENERATION_LIMIT;  // Unsuitable spawn point
-                       else
-                               return y + 1;
+
+                       // y + 1 due to biome 'dust'
+                       return y + 1;
                }
                y++;
                iters--;
@@ -308,7 +309,10 @@ void MapgenV7::makeChunk(BlockMakeData *data)
 
        // Init biome generator, place biome-specific nodes, and build biomemap
        biomegen->calcBiomeNoise(node_min);
-       MgStoneType stone_type = generateBiomes(biome_zero_level);
+
+       MgStoneType mgstone_type;
+       content_t biome_stone;
+       generateBiomes(&mgstone_type, &biome_stone, water_level - 1);
 
        // Generate caverns, tunnels and classic caves
        if (flags & MG_CAVES) {
@@ -328,7 +332,7 @@ void MapgenV7::makeChunk(BlockMakeData *data)
 
        // Generate dungeons
        if (flags & MG_DUNGEONS)
-               generateDungeons(stone_surface_max_y, stone_type);
+               generateDungeons(stone_surface_max_y, mgstone_type, biome_stone);
 
        // Generate the registered decorations
        if (flags & MG_DECORATIONS)