]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mapgen.cpp
Fix MinGW build
[dragonfireclient.git] / src / mapgen.cpp
index a79789b06165252ad5cbcd3f278cb945f5bf63d2..2be0c1dd2e8b75c2a204394c45a083023bb1327e 100644 (file)
@@ -35,7 +35,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "treegen.h"
 #include "mapgen_v6.h"
 #include "mapgen_v7.h"
+#include "serialization.h"
 #include "util/serialize.h"
+#include "filesys.h"
 
 FlagDesc flagdesc_mapgen[] = {
        {"trees",          MG_TREES},
@@ -44,6 +46,7 @@ FlagDesc flagdesc_mapgen[] = {
        {"v6_jungles",     MGV6_JUNGLES},
        {"v6_biome_blend", MGV6_BIOME_BLEND},
        {"flat",           MG_FLAT},
+       {"nolight",        MG_NOLIGHT},
        {NULL,             0}
 };
 
@@ -90,18 +93,17 @@ void Ore::resolveNodeNames(INodeDefManager *ndef) {
                if (ore == CONTENT_IGNORE) {
                        errorstream << "Ore::resolveNodeNames: ore node '"
                                << ore_name << "' not defined";
-                       ore     = CONTENT_AIR;
-                       wherein = CONTENT_AIR;
+                       ore = CONTENT_AIR;
+                       wherein.push_back(CONTENT_AIR);
+                       return;
                }
        }
 
-       if (wherein == CONTENT_IGNORE) {
-               wherein = ndef->getId(wherein_name);
-               if (wherein == CONTENT_IGNORE) {
-                       errorstream << "Ore::resolveNodeNames: wherein node '"
-                               << wherein_name << "' not defined";
-                       ore     = CONTENT_AIR;
-                       wherein = CONTENT_AIR;
+       for (size_t i=0; i != wherein_names.size(); i++) {
+               std::string name = wherein_names[i];
+               content_t c = ndef->getId(name);
+               if (c != CONTENT_IGNORE) {
+                       wherein.push_back(c);
                }
        }
 }
@@ -160,8 +162,9 @@ void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed,
                                continue;
 
                        u32 i = vm->m_area.index(x0 + x1, y0 + y1, z0 + z1);
-                       if (vm->m_data[i].getContent() == wherein)
-                               vm->m_data[i] = n_ore;
+                       for (size_t ii = 0; ii < wherein.size(); ii++)
+                               if (vm->m_data[i].getContent() == wherein[ii])
+                                       vm->m_data[i] = n_ore;
                }
        }
 }
@@ -198,8 +201,9 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed,
                        if (!vm->m_area.contains(i))
                                continue;
 
-                       if (vm->m_data[i].getContent() == wherein)
-                               vm->m_data[i] = n_ore;
+                       for (size_t ii = 0; ii < wherein.size(); ii++)
+                               if (vm->m_data[i].getContent() == wherein[ii])
+                                       vm->m_data[i] = n_ore;
                }
        }
 }
@@ -236,6 +240,8 @@ Decoration::~Decoration() {
 
 
 void Decoration::resolveNodeNames(INodeDefManager *ndef) {
+       this->ndef = ndef;
+       
        if (c_place_on == CONTENT_IGNORE)
                c_place_on = ndef->getId(place_on_name);
 }
@@ -290,7 +296,7 @@ void Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
                                continue;
 
                        int height = getHeight();
-                       int max_y = nmax.Y + MAP_BLOCKSIZE;
+                       int max_y = nmax.Y;// + MAP_BLOCKSIZE - 1;
                        if (y + 1 + height > max_y) {
                                continue;
 #if 0
@@ -311,7 +317,7 @@ void Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
                                }
                        }
 
-                       generate(mg, &ps, max_y, 0, v3s16(x, y, z));
+                       generate(mg, &ps, max_y, v3s16(x, y, z));
                }
        }
 }
@@ -376,7 +382,7 @@ void Decoration::placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
 void DecoSimple::resolveNodeNames(INodeDefManager *ndef) {
        Decoration::resolveNodeNames(ndef);
        
-       if (c_deco == CONTENT_IGNORE) {
+       if (c_deco == CONTENT_IGNORE && !decolist_names.size()) {
                c_deco = ndef->getId(deco_name);
                if (c_deco == CONTENT_IGNORE) {
                        errorstream << "DecoSimple::resolveNodeNames: decoration node '"
@@ -388,7 +394,7 @@ void DecoSimple::resolveNodeNames(INodeDefManager *ndef) {
                c_spawnby = ndef->getId(spawnby_name);
                if (c_spawnby == CONTENT_IGNORE) {
                        errorstream << "DecoSimple::resolveNodeNames: spawnby node '"
-                               << deco_name << "' not defined" << std::endl;
+                               << spawnby_name << "' not defined" << std::endl;
                        nspawnby = -1;
                        c_spawnby = CONTENT_AIR;
                }
@@ -409,8 +415,7 @@ void DecoSimple::resolveNodeNames(INodeDefManager *ndef) {
 }
 
 
-void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y,
-                                               s16 start_y, v3s16 p) {
+void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p) {
        ManualMapVoxelManipulator *vm = mg->vm;
 
        u32 vi = vm->m_area.index(p);
@@ -451,7 +456,7 @@ void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y,
        height = MYMIN(height, max_y - p.Y);
        
        v3s16 em = vm->m_area.getExtent();
-       for (int i = start_y; i < height; i++) {
+       for (int i = 0; i < height; i++) {
                vm->m_area.add_y(em, vi, 1);
                
                content_t c = vm->m_data[vi].getContent();
@@ -477,16 +482,18 @@ std::string DecoSimple::getName() {
 
 
 DecoSchematic::DecoSchematic() {
-       node_names = NULL;
-       schematic  = NULL;
-       flags      = 0;
-       size       = v3s16(0, 0, 0);
+       node_names  = NULL;
+       schematic   = NULL;
+       slice_probs = NULL;
+       flags       = 0;
+       size        = v3s16(0, 0, 0);
 }
 
 
 DecoSchematic::~DecoSchematic() {
        delete node_names;
        delete []schematic;
+       delete []slice_probs;
 }
 
 
@@ -503,12 +510,20 @@ void DecoSchematic::resolveNodeNames(INodeDefManager *ndef) {
        }
        
        for (size_t i = 0; i != node_names->size(); i++) {
-               content_t c = ndef->getId(node_names->at(i));
+               std::string name = node_names->at(i);
+               
+               std::map<std::string, std::string>::iterator it;
+               it = replacements.find(name);
+               if (it != replacements.end())
+                       name = it->second;
+               
+               content_t c = ndef->getId(name);
                if (c == CONTENT_IGNORE) {
                        errorstream << "DecoSchematic::resolveNodeNames: node '"
-                               << node_names->at(i) << "' not defined" << std::endl;
+                               << name << "' not defined" << std::endl;
                        c = CONTENT_AIR;
                }
+               
                c_nodes.push_back(c);
        }
                
@@ -520,8 +535,7 @@ void DecoSchematic::resolveNodeNames(INodeDefManager *ndef) {
 }
 
 
-void DecoSchematic::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y,
-                                                       s16 start_y, v3s16 p) {
+void DecoSchematic::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p) {
        ManualMapVoxelManipulator *vm = mg->vm;
 
        if (flags & DECO_PLACE_CENTER_X)
@@ -536,25 +550,10 @@ void DecoSchematic::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y,
                c_place_on != CONTENT_IGNORE)
                return;
        
-       u32 i = 0;
-       for (s16 z = 0; z != size.Z; z++)
-       for (s16 y = 0; y != size.Y; y++) {
-               vi = vm->m_area.index(p.X, p.Y + y, p.Z + z);
-               for (s16 x = 0; x != size.X; x++, i++, vi++) {
-                       if (!vm->m_area.contains(vi))
-                               continue;
-                               
-                       content_t c = vm->m_data[vi].getContent();
-                       if (c != CONTENT_AIR && c != CONTENT_IGNORE)
-                               continue;
-                               
-                       if (schematic[i].param1 && myrand_range(1, 256) > schematic[i].param1)
-                               continue;
-                       
-                       vm->m_data[vi] = schematic[i];
-                       vm->m_data[vi].param1 = 0;
-               }
-       }
+       Rotation rot = (rotation == ROTATE_RAND) ?
+               (Rotation)pr->range(ROTATE_0, ROTATE_270) : rotation;
+       
+       blitToVManip(p, vm, rot, false);
 }
 
 
@@ -568,35 +567,104 @@ std::string DecoSchematic::getName() {
 }
 
 
+void DecoSchematic::blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm,
+                                                               Rotation rot, bool force_placement) {
+       int xstride = 1;
+       int ystride = size.X;
+       int zstride = size.X * size.Y;
+
+       s16 sx = size.X;
+       s16 sy = size.Y;
+       s16 sz = size.Z;
+
+       int i_start, i_step_x, i_step_z;
+       switch (rot) {
+               case ROTATE_90:
+                       i_start  = sx - 1;
+                       i_step_x = zstride;
+                       i_step_z = -xstride;
+                       SWAP(s16, sx, sz);
+                       break;
+               case ROTATE_180:
+                       i_start  = zstride * (sz - 1) + sx - 1;
+                       i_step_x = -xstride;
+                       i_step_z = -zstride;
+                       break;
+               case ROTATE_270:
+                       i_start  = zstride * (sz - 1);
+                       i_step_x = -zstride;
+                       i_step_z = xstride;
+                       SWAP(s16, sx, sz);
+                       break;
+               default:
+                       i_start  = 0;
+                       i_step_x = xstride;
+                       i_step_z = zstride;
+       }
+
+       s16 y_map = p.Y;
+       for (s16 y = 0; y != sy; y++) {
+               if (slice_probs[y] != MTSCHEM_PROB_ALWAYS &&
+                       myrand_range(1, 255) > slice_probs[y])
+                       continue;
+
+               for (s16 z = 0; z != sz; z++) {
+                       u32 i = z * i_step_z + y * ystride + i_start;
+                       for (s16 x = 0; x != sx; x++, i += i_step_x) {
+                               u32 vi = vm->m_area.index(p.X + x, y_map, p.Z + z);
+                               if (!vm->m_area.contains(vi))
+                                       continue;
+
+                               if (schematic[i].getContent() == CONTENT_IGNORE)
+                                       continue;
+
+                               if (schematic[i].param1 == MTSCHEM_PROB_NEVER)
+                                       continue;
+
+                               if (!force_placement) {
+                                       content_t c = vm->m_data[vi].getContent();
+                                       if (c != CONTENT_AIR && c != CONTENT_IGNORE)
+                                               continue;
+                               }
+
+                               if (schematic[i].param1 != MTSCHEM_PROB_ALWAYS &&
+                                       myrand_range(1, 255) > schematic[i].param1)
+                                       continue;
+
+                               vm->m_data[vi] = schematic[i];
+                               vm->m_data[vi].param1 = 0;
+
+                               if (rot)
+                                       vm->m_data[vi].rotateAlongYAxis(ndef, rot);
+                       }
+               }
+               y_map++;
+       }
+}
+
+
 void DecoSchematic::placeStructure(Map *map, v3s16 p) {
        assert(schematic != NULL);
        ManualMapVoxelManipulator *vm = new ManualMapVoxelManipulator(map);
 
+       Rotation rot = (rotation == ROTATE_RAND) ?
+               (Rotation)myrand_range(ROTATE_0, ROTATE_270) : rotation;
+       
+       v3s16 s = (rot == ROTATE_90 || rot == ROTATE_270) ?
+                               v3s16(size.Z, size.Y, size.X) : size;
+
        if (flags & DECO_PLACE_CENTER_X)
-               p.X -= (size.X + 1) / 2;
+               p.X -= (s.X + 1) / 2;
        if (flags & DECO_PLACE_CENTER_Y)
-               p.Y -= (size.Y + 1) / 2;
+               p.Y -= (s.Y + 1) / 2;
        if (flags & DECO_PLACE_CENTER_Z)
-               p.Z -= (size.Z + 1) / 2;
+               p.Z -= (s.Z + 1) / 2;
                
        v3s16 bp1 = getNodeBlockPos(p);
-       v3s16 bp2 = getNodeBlockPos(p + size - v3s16(1,1,1));
+       v3s16 bp2 = getNodeBlockPos(p + s - v3s16(1,1,1));
        vm->initialEmerge(bp1, bp2);
-
-       u32 i = 0;
-       for (s16 z = 0; z != size.Z; z++)
-       for (s16 y = 0; y != size.Y; y++) {
-               u32 vi = vm->m_area.index(p.X, p.Y + y, p.Z + z);
-               for (s16 x = 0; x != size.X; x++, i++, vi++) {
-                       if (!vm->m_area.contains(vi))
-                               continue;
-                       if (schematic[i].param1 && myrand_range(1, 256) > schematic[i].param1)
-                               continue;
-                       
-                       vm->m_data[vi] = schematic[i];
-                       vm->m_data[vi].param1 = 0;
-               }
-       }
+       
+       blitToVManip(p, vm, rot, true);
        
        std::map<v3s16, MapBlock *> lighting_modified_blocks;
        std::map<v3s16, MapBlock *> modified_blocks;
@@ -618,23 +686,37 @@ void DecoSchematic::placeStructure(Map *map, v3s16 p) {
 
 
 bool DecoSchematic::loadSchematicFile() {
+       content_t cignore = CONTENT_IGNORE;
+       bool have_cignore = false;
+       
        std::ifstream is(filename.c_str(), std::ios_base::binary);
 
        u32 signature = readU32(is);
-       if (signature != 'MTSM') {
+       if (signature != MTSCHEM_FILE_SIGNATURE) {
                errorstream << "loadSchematicFile: invalid schematic "
                        "file" << std::endl;
                return false;
        }
        
        u16 version = readU16(is);
-       if (version != 1) {
+       if (version > MTSCHEM_FILE_VER_HIGHEST_READ) {
                errorstream << "loadSchematicFile: unsupported schematic "
                        "file version" << std::endl;
                return false;
        }
 
        size = readV3S16(is);
+
+       delete []slice_probs;
+       slice_probs = new u8[size.Y];
+       if (version >= 3) {
+               for (int y = 0; y != size.Y; y++)
+                       slice_probs[y] = readU8(is);
+       } else {
+               for (int y = 0; y != size.Y; y++)
+                       slice_probs[y] = MTSCHEM_PROB_ALWAYS;
+       }
+
        int nodecount = size.X * size.Y * size.Z;
        
        u16 nidmapcount = readU16(is);
@@ -642,14 +724,28 @@ bool DecoSchematic::loadSchematicFile() {
        node_names = new std::vector<std::string>;
        for (int i = 0; i != nidmapcount; i++) {
                std::string name = deSerializeString(is);
+               if (name == "ignore") {
+                       name = "air";
+                       cignore = i;
+                       have_cignore = true;
+               }
                node_names->push_back(name);
        }
 
-       delete schematic;
+       delete []schematic;
        schematic = new MapNode[nodecount];
-       MapNode::deSerializeBulk(is, SER_FMT_VER_HIGHEST, schematic,
+       MapNode::deSerializeBulk(is, SER_FMT_VER_HIGHEST_READ, schematic,
                                nodecount, 2, 2, true);
-                               
+       
+       if (version == 1) { // fix up the probability values
+               for (int i = 0; i != nodecount; i++) {
+                       if (schematic[i].param1 == 0)
+                               schematic[i].param1 = MTSCHEM_PROB_ALWAYS;
+                       if (have_cignore && schematic[i].getContent() == cignore)
+                               schematic[i].param1 = MTSCHEM_PROB_NEVER;
+               }
+       }
+       
        return true;
 }
 
@@ -659,10 +755,12 @@ bool DecoSchematic::loadSchematicFile() {
 
        All values are stored in big-endian byte order.
        [u32] signature: 'MTSM'
-       [u16] version: 1
+       [u16] version: 3
        [u16] size X
        [u16] size Y
        [u16] size Z
+       For each Y:
+               [u8] slice probability value
        [Name-ID table] Name ID Mapping Table
                [u16] name-id count
                For each name-id mapping:
@@ -676,26 +774,35 @@ bool DecoSchematic::loadSchematicFile() {
        For each node in schematic:
                [u8] param2
        }
+       
+       Version changes:
+       1 - Initial version
+       2 - Fixed messy never/always place; 0 probability is now never, 0xFF is always
 */
 void DecoSchematic::saveSchematicFile(INodeDefManager *ndef) {
-       std::ofstream os(filename.c_str(), std::ios_base::binary);
+       std::ostringstream ss(std::ios_base::binary);
+
+       writeU32(ss, MTSCHEM_FILE_SIGNATURE);         // signature
+       writeU16(ss, MTSCHEM_FILE_VER_HIGHEST_WRITE); // version
+       writeV3S16(ss, size);                         // schematic size
+
+       for (int y = 0; y != size.Y; y++)             // Y slice probabilities
+               writeU8(ss, slice_probs[y]);
 
-       writeU32(os, 'MTSM'); // signature
-       writeU16(os, 1);      // version
-       writeV3S16(os, size); // schematic size
-       
        std::vector<content_t> usednodes;
        int nodecount = size.X * size.Y * size.Z;
        build_nnlist_and_update_ids(schematic, nodecount, &usednodes);
        
        u16 numids = usednodes.size();
-       writeU16(os, numids); // name count
+       writeU16(ss, numids); // name count
        for (int i = 0; i != numids; i++)
-               os << serializeString(ndef->get(usednodes[i]).name); // node names
+               ss << serializeString(ndef->get(usednodes[i]).name); // node names
                
        // compressed bulk node data
-       MapNode::serializeBulk(os, SER_FMT_VER_HIGHEST, schematic,
+       MapNode::serializeBulk(ss, SER_FMT_VER_HIGHEST_WRITE, schematic,
                                nodecount, 2, 2, true);
+
+       fs::safeWriteToFile(filename, ss.str());
 }
 
 
@@ -731,6 +838,11 @@ bool DecoSchematic::getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2) {
        vm->initialEmerge(bp1, bp2);
        
        size = p2 - p1 + 1;
+
+       slice_probs = new u8[size.Y];
+       for (s16 y = 0; y != size.Y; y++)
+               slice_probs[y] = MTSCHEM_PROB_ALWAYS;
+
        schematic = new MapNode[size.X * size.Y * size.Z];
        
        u32 i = 0;
@@ -739,7 +851,7 @@ bool DecoSchematic::getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2) {
                u32 vi = vm->m_area.index(p1.X, y, z);
                for (s16 x = p1.X; x <= p2.X; x++, i++, vi++) {
                        schematic[i] = vm->m_data[vi];
-                       schematic[i].param1 = 0;
+                       schematic[i].param1 = MTSCHEM_PROB_ALWAYS;
                }
        }
 
@@ -748,12 +860,26 @@ bool DecoSchematic::getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2) {
 }
 
 
-void DecoSchematic::applyProbabilities(std::vector<std::pair<v3s16, u8> > *plist, v3s16 p0) {
+void DecoSchematic::applyProbabilities(v3s16 p0,
+       std::vector<std::pair<v3s16, u8> > *plist,
+       std::vector<std::pair<s16, u8> > *splist) {
+
        for (size_t i = 0; i != plist->size(); i++) {
                v3s16 p = (*plist)[i].first - p0;
                int index = p.Z * (size.Y * size.X) + p.Y * size.X + p.X;
-               if (index < size.Z * size.Y * size.X)
-                       schematic[index].param1 = (*plist)[i].second;
+               if (index < size.Z * size.Y * size.X) {
+                       u8 prob = (*plist)[i].second;
+                       schematic[index].param1 = prob;
+                       
+                       // trim unnecessary node names from schematic
+                       if (prob == MTSCHEM_PROB_NEVER)
+                               schematic[index].setContent(CONTENT_AIR);
+               }
+       }
+
+       for (size_t i = 0; i != splist->size(); i++) {
+               s16 y = (*splist)[i].first - p0.Y;
+               slice_probs[y] = (*splist)[i].second;
        }
 }
 
@@ -815,9 +941,16 @@ void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax) {
        //TimeTaker t("Mapgen::updateHeightmap", NULL, PRECISION_MICRO);
        int index = 0;
        for (s16 z = nmin.Z; z <= nmax.Z; z++) {
-               for (s16 x = nmin.X; x <= nmax.X; x++) {
+               for (s16 x = nmin.X; x <= nmax.X; x++, index++) {
                        s16 y = findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y);
-                       heightmap[index++] = y;
+
+                       // if the values found are out of range, trust the old heightmap
+                       if (y == nmax.Y && heightmap[index] > nmax.Y)
+                               continue;
+                       if (y == nmin.Y - 1 && heightmap[index] < nmin.Y)
+                               continue;
+                               
+                       heightmap[index] = y;
                }
        }
        //printf("updateHeightmap: %dus\n", t.stop());
@@ -825,8 +958,10 @@ void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax) {
 
 
 void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nmax) {
-       bool isliquid, wasliquid;
+       bool isliquid, wasliquid, rare;
        v3s16 em  = vm->m_area.getExtent();
+       rare = g_settings->getBool("liquid_finite");
+       int rarecnt = 0;
 
        for (s16 z = nmin.Z; z <= nmax.Z; z++) {
                for (s16 x = nmin.X; x <= nmax.X; x++) {
@@ -836,8 +971,8 @@ void Mapgen::updateLiquid(UniqueQueue<v3s16> *trans_liquid, v3s16 nmin, v3s16 nm
                        for (s16 y = nmax.Y; y >= nmin.Y; y--) {
                                isliquid = ndef->get(vm->m_data[i]).isLiquid();
 
-                               // there was a change between liquid and nonliquid, add to queue
-                               if (isliquid != wasliquid)
+                               // there was a change between liquid and nonliquid, add to queue. no need to add every with liquid_finite
+                               if (isliquid != wasliquid && (!rare || !(rarecnt++ % 36)))
                                        trans_liquid->push_back(v3s16(x, y, z));
 
                                wasliquid = isliquid;
@@ -932,12 +1067,12 @@ void Mapgen::calcLighting(v3s16 nmin, v3s16 nmax) {
 
                                u8 light = n.param1 & 0x0F;
                                if (light) {
-                                       lightSpread(a, v3s16(x,     y,     z + 1), light);
-                                       lightSpread(a, v3s16(x,     y + 1, z    ), light);
-                                       lightSpread(a, v3s16(x + 1, y,     z    ), light);
-                                       lightSpread(a, v3s16(x,     y,     z - 1), light);
-                                       lightSpread(a, v3s16(x,     y - 1, z    ), light);
-                                       lightSpread(a, v3s16(x - 1, y,     z    ), light);
+                                       lightSpread(a, v3s16(x,     y,     z + 1), light - 1);
+                                       lightSpread(a, v3s16(x,     y + 1, z    ), light - 1);
+                                       lightSpread(a, v3s16(x + 1, y,     z    ), light - 1);
+                                       lightSpread(a, v3s16(x,     y,     z - 1), light - 1);
+                                       lightSpread(a, v3s16(x,     y - 1, z    ), light - 1);
+                                       lightSpread(a, v3s16(x - 1, y,     z    ), light - 1);
                                }
                        }
                }
@@ -1014,9 +1149,12 @@ bool MapgenV7Params::readParams(Settings *settings) {
        bool success = 
                settings->getNoiseParams("mgv7_np_terrain_base",    np_terrain_base)    &&
                settings->getNoiseParams("mgv7_np_terrain_alt",     np_terrain_alt)     &&
-               settings->getNoiseParams("mgv7_np_terrain_mod",     np_terrain_mod)     &&
                settings->getNoiseParams("mgv7_np_terrain_persist", np_terrain_persist) &&
                settings->getNoiseParams("mgv7_np_height_select",   np_height_select)   &&
+               settings->getNoiseParams("mgv7_np_filler_depth",    np_filler_depth)    &&
+               settings->getNoiseParams("mgv7_np_mount_height",    np_mount_height)    &&
+               settings->getNoiseParams("mgv7_np_ridge_uwater",    np_ridge_uwater)    &&
+               settings->getNoiseParams("mgv7_np_mountain",        np_mountain)        &&
                settings->getNoiseParams("mgv7_np_ridge",           np_ridge);
        return success;
 }
@@ -1025,38 +1163,11 @@ bool MapgenV7Params::readParams(Settings *settings) {
 void MapgenV7Params::writeParams(Settings *settings) {
        settings->setNoiseParams("mgv7_np_terrain_base",    np_terrain_base);
        settings->setNoiseParams("mgv7_np_terrain_alt",     np_terrain_alt);
-       settings->setNoiseParams("mgv7_np_terrain_mod",     np_terrain_mod);
        settings->setNoiseParams("mgv7_np_terrain_persist", np_terrain_persist);
        settings->setNoiseParams("mgv7_np_height_select",   np_height_select);
+       settings->setNoiseParams("mgv7_np_filler_depth",    np_filler_depth);
+       settings->setNoiseParams("mgv7_np_mount_height",    np_mount_height);
+       settings->setNoiseParams("mgv7_np_ridge_uwater",    np_ridge_uwater);
+       settings->setNoiseParams("mgv7_np_mountain",        np_mountain);
        settings->setNoiseParams("mgv7_np_ridge",           np_ridge);
 }
-
-
-/////////////////////////////////// legacy static functions for farmesh
-
-s16 Mapgen::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision) {
-       //just need to return something
-       s16 level = 5;
-       return level;
-}
-
-
-bool Mapgen::get_have_beach(u64 seed, v2s16 p2d) {
-       double sandnoise = noise2d_perlin(
-                               0.2+(float)p2d.X/250, 0.7+(float)p2d.Y/250,
-                               seed+59420, 3, 0.50);
-       return (sandnoise > 0.15);
-}
-
-
-double Mapgen::tree_amount_2d(u64 seed, v2s16 p) {
-       double noise = noise2d_perlin(
-                       0.5+(float)p.X/125, 0.5+(float)p.Y/125,
-                       seed+2, 4, 0.66);
-       double zeroval = -0.39;
-       if(noise < zeroval)
-               return 0;
-       else
-               return 0.04 * (noise-zeroval) / (1.0-zeroval);
-}