/*
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
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_BLOBS 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_crumble;
- NoiseParams np_wetness;
+ NoiseParams np_cavern;
MapgenV5Params();
- ~MapgenV5Params() {}
-
- void readParams(Settings *settings);
- void writeParams(Settings *settings);
-};
+ ~MapgenV5Params() = default;
+ void readParams(const Settings *settings);
+ void writeParams(Settings *settings) const;
+};
-class MapgenV5 : public Mapgen {
+class MapgenV5 : public MapgenBasic
+{
public:
- EmergeManager *emerge;
- BiomeManager *bmgr;
-
- int ystride;
- int zstride;
- u32 flags;
- u32 spflags;
-
- u32 blockseed;
- v3s16 node_min;
- v3s16 node_max;
- v3s16 full_node_min;
- v3s16 full_node_max;
-
- Noise *noise_filler_depth;
- 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(int mapgenid, MapgenV5Params *params, EmergeManager *emerge);
~MapgenV5();
-
- virtual void makeChunk(BlockMakeData *data);
- void calculateNoise();
- void generateBaseTerrain();
- void generateBlobs();
- void generateBiomes();
- void dustTopNodes();
-};
+ virtual MapgenType getType() const { return MAPGEN_V5; }
-struct MapgenFactoryV5 : public MapgenFactory {
- Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
- return new MapgenV5(mgid, params, emerge);
- };
-
- MapgenSpecificParams *createMapgenParams() {
- return new MapgenV5Params();
- };
-};
+ virtual void makeChunk(BlockMakeData *data);
+ int getSpawnLevelAtPoint(v2s16 p);
+ int generateBaseTerrain();
-#endif
+private:
+ s16 large_cave_depth;
+ Noise *noise_factor;
+ Noise *noise_height;
+ Noise *noise_ground;
+};