]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mapgen_v7.cpp
Added configurable ambient_occlusion_gamma. Default is 2.2 (same as previous hardcode...
[dragonfireclient.git] / src / mapgen_v7.cpp
index d72874d04c04b6d79a9ec18facd18ac62afa630f..a7a56f378b653e4ea2d9ffe075ff3ad11650aff6 100644 (file)
@@ -241,7 +241,7 @@ void MapgenV7::makeChunk(BlockMakeData *data)
        if (flags & MG_CAVES)
                generateCaves(stone_surface_max_y);
 
-       if (flags & MG_DUNGEONS) {
+       if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) {
                DungeonGen dgen(this, NULL);
                dgen.generate(blockseed, full_node_min, full_node_max);
        }
@@ -260,8 +260,7 @@ void MapgenV7::makeChunk(BlockMakeData *data)
        updateLiquid(&data->transforming_liquid, full_node_min, full_node_max);
 
        if (flags & MG_LIGHT)
-               calcLighting(node_min - v3s16(1, 0, 1) * MAP_BLOCKSIZE,
-                                        node_max + v3s16(1, 0, 1) * MAP_BLOCKSIZE);
+               calcLighting(node_min, node_max);
        //setLighting(node_min - v3s16(1, 0, 1) * MAP_BLOCKSIZE,
        //                      node_max + v3s16(1, 0, 1) * MAP_BLOCKSIZE, 0xFF);
 
@@ -350,7 +349,7 @@ float MapgenV7::baseTerrainLevelFromMap(int index)
 bool MapgenV7::getMountainTerrainAtPoint(int x, int y, int z)
 {
        float mnt_h_n = NoisePerlin2D(&noise_mount_height->np, x, z, seed);
-       float height_modifier = -((float)y / rangelim(mnt_h_n, 80.0, 150.0));
+       float height_modifier = -((float)y / mnt_h_n);
        float mnt_n = NoisePerlin3D(&noise_mountain->np, x, y, z, seed);
 
        return mnt_n + height_modifier >= 0.6;
@@ -360,7 +359,7 @@ bool MapgenV7::getMountainTerrainAtPoint(int x, int y, int z)
 bool MapgenV7::getMountainTerrainFromMap(int idx_xyz, int idx_xz, int y)
 {
        float mounthn = noise_mount_height->result[idx_xz];
-       float height_modifier = -((float)y / rangelim(mounthn, 80.0, 150.0));
+       float height_modifier = -((float)y / mounthn);
        return (noise_mountain->result[idx_xyz] + height_modifier >= 0.6);
 }
 
@@ -405,7 +404,7 @@ int MapgenV7::generateTerrain()
        int ymax = generateBaseTerrain();
 
        if (spflags & MGV7_MOUNTAINS)
-               generateMountainTerrain();
+               ymax = generateMountainTerrain(ymax);
 
        if (spflags & MGV7_RIDGES)
                generateRidgeTerrain();
@@ -453,10 +452,10 @@ int MapgenV7::generateBaseTerrain()
 }
 
 
-void MapgenV7::generateMountainTerrain()
+int MapgenV7::generateMountainTerrain(int ymax)
 {
        if (node_max.Y <= water_level)
-               return;
+               return ymax;
 
        MapNode n_stone(c_stone);
        u32 j = 0;
@@ -466,14 +465,21 @@ void MapgenV7::generateMountainTerrain()
                u32 vi = vm->m_area.index(node_min.X, y, z);
                for (s16 x = node_min.X; x <= node_max.X; x++) {
                        int index = (z - node_min.Z) * csize.X + (x - node_min.X);
+                       content_t c = vm->m_data[vi].getContent();
 
-                       if (getMountainTerrainFromMap(j, index, y))
+                       if (getMountainTerrainFromMap(j, index, y)
+                                       && (c == CONTENT_AIR || c == c_water_source)) {
                                vm->m_data[vi] = n_stone;
+                               if (y > ymax)
+                                       ymax = y;
+                       }
 
                        vi++;
                        j++;
                }
        }
+
+       return ymax;
 }