]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapgen_v5.h
Clean up getTime helpers
[minetest.git] / src / mapgen_v5.h
index 1949bf5db459ffe20d73d6ae6a8122c274cc1344..1cdb33683b9050f1d05c345f65ca3b66021bb4ba 100644 (file)
@@ -1,6 +1,7 @@
 /*
 Minetest
-Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
+Copyright (C) 2010-2015 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
+Copyright (C) 2010-2015 paramat, Matt Gregory
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -22,96 +23,54 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "mapgen.h"
 
-/////////////////// Mapgen V5 flags
-#define MGV5_BLOBS 0x01
+#define MGV5_LARGE_CAVE_DEPTH -256
 
-extern FlagDesc flagdesc_mapgen_v5[];
+///////// Mapgen V5 flags
+#define MGV5_CAVERNS 0x01
+
+class BiomeManager;
 
+extern FlagDesc flagdesc_mapgen_v5[];
 
-struct MapgenV5Params : public MapgenSpecificParams {
+struct MapgenV5Params : public MapgenParams
+{
        u32 spflags;
+       float cave_width;
+       s16 cavern_limit;
+       s16 cavern_taper;
+       float cavern_threshold;
+
        NoiseParams np_filler_depth;
        NoiseParams np_factor;
        NoiseParams np_height;
+       NoiseParams np_ground;
        NoiseParams np_cave1;
        NoiseParams np_cave2;
-       NoiseParams np_ground;
-       NoiseParams np_crumble;
-       NoiseParams np_wetness;
+       NoiseParams np_cavern;
 
        MapgenV5Params();
        ~MapgenV5Params() {}
 
-       void readParams(Settings *settings);
-       void writeParams(Settings *settings);
+       void readParams(const Settings *settings);
+       void writeParams(Settings *settings) const;
 };
 
-
-class MapgenV5 : public Mapgen {
+class MapgenV5 : public MapgenBasic
+{
 public:
-       EmergeManager *m_emerge;
-       BiomeManager *bmgr;
+       MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge);
+       ~MapgenV5();
 
-       int ystride;
-       int zstride;
-       u32 spflags;
+       virtual MapgenType getType() const { return MAPGEN_V5; }
 
-       v3s16 node_min;
-       v3s16 node_max;
-       v3s16 full_node_min;
-       v3s16 full_node_max;
+       virtual void makeChunk(BlockMakeData *data);
+       int getSpawnLevelAtPoint(v2s16 p);
+       int generateBaseTerrain();
 
-       Noise *noise_filler_depth;
+private:
        Noise *noise_factor;
        Noise *noise_height;
-       Noise *noise_cave1;
-       Noise *noise_cave2;
        Noise *noise_ground;
-       Noise *noise_crumble;
-       Noise *noise_wetness;
-       Noise *noise_heat;
-       Noise *noise_humidity;
-
-       content_t c_stone;
-       content_t c_dirt;
-       content_t c_dirt_with_grass;
-       content_t c_sand;
-       content_t c_water_source;
-       content_t c_lava_source;
-       content_t c_ice;
-       content_t c_gravel;
-       content_t c_cobble;
-       content_t c_desert_sand;
-       content_t c_desert_stone;
-       content_t c_mossycobble;
-       content_t c_sandbrick;
-       content_t c_stair_cobble;
-       content_t c_stair_sandstone;
-
-       MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge);
-       ~MapgenV5();
-
-       virtual void makeChunk(BlockMakeData *data);
-       int getGroundLevelAtPoint(v2s16 p);
-       void calculateNoise();
-       int generateBaseTerrain();
-       void generateBiomes();
-       void generateCaves();
-       void generateBlobs();
-       void dustTopNodes();
-};
-
-
-struct MapgenFactoryV5 : public MapgenFactory {
-       Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
-       {
-               return new MapgenV5(mgid, params, emerge);
-       };
-
-       MapgenSpecificParams *createMapgenParams()
-       {
-               return new MapgenV5Params();
-       };
 };
 
 #endif