X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fmapgen_v6.h;h=9c879421761099895432e1d5a636bc7634fae7ab;hb=67f97f8d3274e0e96a8f541a05a39f81dfec1a20;hp=662aed2ce8ec67af9ad730b59b0769e091f22f17;hpb=67228160aed84e0ef07a863ac0127931f8d58b05;p=oweals%2Fminetest.git diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h index 662aed2ce..9c8794217 100644 --- a/src/mapgen_v6.h +++ b/src/mapgen_v6.h @@ -1,6 +1,8 @@ /* Minetest -Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2014-2017 paramat 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,91 +19,78 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MAPGENV6_HEADER -#define MAPGENV6_HEADER +#pragma once #include "mapgen.h" +#include "noise.h" -#define AVERAGE_MUD_AMOUNT 4 -#define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1 +#define MGV6_AVERAGE_MUD_AMOUNT 4 +#define MGV6_DESERT_STONE_BASE -32 +#define MGV6_ICE_BASE 0 +#define MGV6_FREQ_HOT 0.4 +#define MGV6_FREQ_SNOW -0.4 +#define MGV6_FREQ_TAIGA 0.5 +#define MGV6_FREQ_JUNGLE 0.5 -enum BiomeType +//////////// Mapgen V6 flags +#define MGV6_JUNGLES 0x01 +#define MGV6_BIOMEBLEND 0x02 +#define MGV6_MUDFLOW 0x04 +#define MGV6_SNOWBIOMES 0x08 +#define MGV6_FLAT 0x10 +#define MGV6_TREES 0x20 + + +extern FlagDesc flagdesc_mapgen_v6[]; + + +enum BiomeV6Type { BT_NORMAL, - BT_DESERT + BT_DESERT, + BT_JUNGLE, + BT_TUNDRA, + BT_TAIGA, }; -extern NoiseParams nparams_v6_def_terrain_base; -extern NoiseParams nparams_v6_def_terrain_higher; -extern NoiseParams nparams_v6_def_steepness; -extern NoiseParams nparams_v6_def_height_select; -extern NoiseParams nparams_v6_def_mud; -extern NoiseParams nparams_v6_def_beach; -extern NoiseParams nparams_v6_def_biome; -extern NoiseParams nparams_v6_def_cave; -extern NoiseParams nparams_v6_def_humidity; -extern NoiseParams nparams_v6_def_trees; -extern NoiseParams nparams_v6_def_apple_trees; - -struct Cave { - s16 min_tunnel_diameter; - s16 max_tunnel_diameter; - int dswitchint; - u16 tunnel_routepoints; - int part_max_length_rs; - bool large_cave_is_flat; - bool flooded; -}; struct MapgenV6Params : public MapgenParams { - float freq_desert; - float freq_beach; - NoiseParams *np_terrain_base; - NoiseParams *np_terrain_higher; - NoiseParams *np_steepness; - NoiseParams *np_height_select; - NoiseParams *np_mud; - NoiseParams *np_beach; - NoiseParams *np_biome; - NoiseParams *np_cave; - NoiseParams *np_humidity; - NoiseParams *np_trees; - NoiseParams *np_apple_trees; - - MapgenV6Params() { - freq_desert = 0.45; - freq_beach = 0.15; - np_terrain_base = &nparams_v6_def_terrain_base; - np_terrain_higher = &nparams_v6_def_terrain_higher; - np_steepness = &nparams_v6_def_steepness; - np_height_select = &nparams_v6_def_height_select; - np_mud = &nparams_v6_def_mud; - np_beach = &nparams_v6_def_beach; - np_biome = &nparams_v6_def_biome; - np_cave = &nparams_v6_def_cave; - np_humidity = &nparams_v6_def_humidity; - np_trees = &nparams_v6_def_trees; - np_apple_trees = &nparams_v6_def_apple_trees; - - } - - bool readParams(Settings *settings); - void writeParams(Settings *settings); + u32 spflags = MGV6_JUNGLES | MGV6_SNOWBIOMES | MGV6_TREES | + MGV6_BIOMEBLEND | MGV6_MUDFLOW; + float freq_desert = 0.45f; + float freq_beach = 0.15f; + NoiseParams np_terrain_base; + NoiseParams np_terrain_higher; + NoiseParams np_steepness; + NoiseParams np_height_select; + NoiseParams np_mud; + NoiseParams np_beach; + NoiseParams np_biome; + NoiseParams np_cave; + NoiseParams np_humidity; + NoiseParams np_trees; + NoiseParams np_apple_trees; + + MapgenV6Params(); + ~MapgenV6Params() = default; + + void readParams(const Settings *settings); + void writeParams(Settings *settings) const; }; + class MapgenV6 : public Mapgen { public: + EmergeManager *m_emerge; + int ystride; - v3s16 csize; - u32 flags; + u32 spflags; - u32 blockseed; v3s16 node_min; v3s16 node_max; v3s16 full_node_min; v3s16 full_node_max; v3s16 central_area_size; - int volume_nodes; Noise *noise_terrain_base; Noise *noise_terrain_higher; @@ -110,13 +99,14 @@ public: Noise *noise_mud; Noise *noise_beach; Noise *noise_biome; + Noise *noise_humidity; NoiseParams *np_cave; NoiseParams *np_humidity; NoiseParams *np_trees; NoiseParams *np_apple_trees; float freq_desert; float freq_beach; - + content_t c_stone; content_t c_dirt; content_t c_dirt_with_grass; @@ -124,27 +114,37 @@ public: content_t c_water_source; content_t c_lava_source; content_t c_gravel; - content_t c_cobble; - content_t c_desert_sand; content_t c_desert_stone; + content_t c_desert_sand; + content_t c_dirt_with_snow; + content_t c_snow; + content_t c_snowblock; + content_t c_ice; - MapgenV6(int mapgenid, MapgenV6Params *params); + content_t c_cobble; + content_t c_mossycobble; + content_t c_stair_cobble; + content_t c_stair_desert_stone; + + MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge); ~MapgenV6(); - + + virtual MapgenType getType() const { return MAPGEN_V6; } + void makeChunk(BlockMakeData *data); int getGroundLevelAtPoint(v2s16 p); + int getSpawnLevelAtPoint(v2s16 p); float baseTerrainLevel(float terrain_base, float terrain_higher, - float steepness, float height_select); + float steepness, float height_select); virtual float baseTerrainLevelFromNoise(v2s16 p); virtual float baseTerrainLevelFromMap(v2s16 p); virtual float baseTerrainLevelFromMap(int index); - s16 find_ground_level(v2s16 p2d); s16 find_stone_level(v2s16 p2d); bool block_is_underground(u64 seed, v3s16 blockpos); s16 find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision); - + float getHumidity(v2s16 p); float getTreeAmount(v2s16 p); bool getHaveAppleTree(v2s16 p); @@ -152,31 +152,18 @@ public: virtual float getMudAmount(int index); bool getHaveBeach(v2s16 p); bool getHaveBeach(int index); - BiomeType getBiome(v2s16 p); - BiomeType getBiome(int index, v2s16 p); - + BiomeV6Type getBiome(v2s16 p); + BiomeV6Type getBiome(int index, v2s16 p); + u32 get_blockseed(u64 seed, v3s16 p); - + virtual void calculateNoise(); int generateGround(); void addMud(); void flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos); - void addDirtGravelBlobs(); + void moveMud(u32 remove_index, u32 place_index, + u32 above_remove_index, v2s16 pos, v3s16 em); void growGrass(); - void placeTrees(); - virtual void defineCave(Cave &cave, PseudoRandom ps, - v3s16 node_min, bool large_cave); - void generateCaves(int max_stone_y); + void placeTreesAndJungleGrass(); + virtual void generateCaves(int max_stone_y); }; - -struct MapgenFactoryV6 : public MapgenFactory { - Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) { - return new MapgenV6(mgid, (MapgenV6Params *)params); - }; - - MapgenParams *createMapgenParams() { - return new MapgenV6Params(); - }; -}; - -#endif