]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/mapgen_v5.h
Conf.example: Update using auto-generation
[dragonfireclient.git] / src / mapgen_v5.h
index 703addf65265a1570265dffea06e870733802e9d..44b0a09e7b148836215c7d89559ac335b86bf6ae 100644 (file)
@@ -1,6 +1,7 @@
 /*
 Minetest
-Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
+Copyright (C) 2014-2017 paramat
+Copyright (C) 2014-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
 
 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
@@ -17,98 +18,57 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef MAPGEN_V5_HEADER
-#define MAPGEN_V5_HEADER
+#pragma once
 
 #include "mapgen.h"
 
-/////////////////// Mapgen V5 flags
-//#define MGV5_   0x01
+///////// Mapgen V5 flags
+#define MGV5_CAVERNS 0x01
 
 class BiomeManager;
 
 extern FlagDesc flagdesc_mapgen_v5[];
 
+struct MapgenV5Params : public MapgenParams
+{
+       u32 spflags = MGV5_CAVERNS;
+       float cave_width = 0.125f;
+       s16 large_cave_depth = -256;
+       s16 lava_depth = -256;
+       s16 cavern_limit = -256;
+       s16 cavern_taper = 256;
+       float cavern_threshold = 0.7f;
 
-struct MapgenV5Params : public MapgenSpecificParams {
-       u32 spflags;
        NoiseParams np_filler_depth;
        NoiseParams np_factor;
        NoiseParams np_height;
+       NoiseParams np_ground;
        NoiseParams np_cave1;
        NoiseParams np_cave2;
-       NoiseParams np_ground;
+       NoiseParams np_cavern;
 
        MapgenV5Params();
-       ~MapgenV5Params() {}
+       ~MapgenV5Params() = default;
 
-       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:
+       s16 large_cave_depth;
        Noise *noise_factor;
        Noise *noise_height;
-       Noise *noise_cave1;
-       Noise *noise_cave2;
        Noise *noise_ground;
-       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(int max_stone_y);
-       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