From 4434498367929f5fe67d7bf8a12e594d51b632ce Mon Sep 17 00:00:00 2001 From: paramat Date: Tue, 10 Nov 2015 06:50:22 +0000 Subject: [PATCH] Mgv6: Move global mapgen flag 'flat' into mgv6 spflags Add mgv6 spflag 'flat' Global flag is kept for backwards compatibility but is now undocumented --- builtin/settingtypes.txt | 6 +++--- minetest.conf.example | 6 +++--- src/mapgen_v6.cpp | 9 +++++---- src/mapgen_v6.h | 1 + 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 8ac6ab6d..25849e0c 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -829,10 +829,10 @@ max_block_generate_distance (Max block generate distance) int 6 map_generation_limit (Map generation limit) int 31000 0 31000 # Global map generation attributes. +# The 'trees' flag only has effect in mgv6. # Flags that are not specified in the flag string are not modified from the default. # Flags starting with "no" are used to explicitly disable them. -# 'trees' and 'flat' flags only have effect in mgv6. -mg_flags (Mapgen flags) flags trees,caves,dungeons,light trees,caves,dungeons,light,flat,notrees,nocaves,nodungeons,nolight,noflat +mg_flags (Mapgen flags) flags trees,caves,dungeons,light trees,caves,dungeons,light,notrees,nocaves,nodungeons,nolight [**Advanced] @@ -889,7 +889,7 @@ mgv5_np_cave2 (Mapgen v5 cave2 noise parameters) noise_params 0, 12, (50, 50, 50 # When snowbiomes are enabled jungles are enabled and the jungles flag is ignored. # Flags that are not specified in the flag string are not modified from the default. # Flags starting with "no" are used to explicitly disable them. -mgv6_spflags (Mapgen v6 flags) flags jungles,biomeblend,mudflow,snowbiomes jungles,biomeblend,mudflow,snowbiomes,nojungles,nobiomeblend,nomudflow,nosnowbiomes +mgv6_spflags (Mapgen v6 flags) flags jungles,biomeblend,mudflow,snowbiomes jungles,biomeblend,mudflow,snowbiomes,flat,nojungles,nobiomeblend,nomudflow,nosnowbiomes,noflat # Controls size of deserts and beaches in Mapgen v6. # When snowbiomes are enabled 'mgv6_freq_desert' is ignored. diff --git a/minetest.conf.example b/minetest.conf.example index 10b090be..e5adc0e1 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -1021,10 +1021,10 @@ # map_generation_limit = 31000 # Global map generation attributes. +# The 'trees' flag only has effect in mgv6. # Flags that are not specified in the flag string are not modified from the default. # Flags starting with "no" are used to explicitly disable them. -# 'trees' and 'flat' flags only have effect in mgv6. -# type: flags possible values: trees, caves, dungeons, light, flat, notrees, nocaves, nodungeons, nolight, noflat +# type: flags possible values: trees, caves, dungeons, light, notrees, nocaves, nodungeons, nolight # mg_flags = trees,caves,dungeons,light ### Advanced @@ -1093,7 +1093,7 @@ # When snowbiomes are enabled jungles are enabled and the jungles flag is ignored. # Flags that are not specified in the flag string are not modified from the default. # Flags starting with "no" are used to explicitly disable them. -# type: flags possible values: jungles, biomeblend, mudflow, snowbiomes, nojungles, nobiomeblend, nomudflow, nosnowbiomes +# type: flags possible values: jungles, biomeblend, mudflow, snowbiomes, flat, nojungles, nobiomeblend, nomudflow, nosnowbiomes, noflat # mgv6_spflags = jungles,biomeblend,mudflow,snowbiomes # Controls size of deserts and beaches in Mapgen v6. diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 82ed6c4d..3f3ccba4 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -42,6 +42,7 @@ FlagDesc flagdesc_mapgen_v6[] = { {"biomeblend", MGV6_BIOMEBLEND}, {"mudflow", MGV6_MUDFLOW}, {"snowbiomes", MGV6_SNOWBIOMES}, + {"flat", MGV6_FLAT}, {NULL, 0} }; @@ -263,7 +264,7 @@ float MapgenV6::baseTerrainLevel(float terrain_base, float terrain_higher, float MapgenV6::baseTerrainLevelFromNoise(v2s16 p) { - if (flags & MG_FLAT) + if ((spflags & MGV6_FLAT) || (flags & MG_FLAT)) return water_level; float terrain_base = NoisePerlin2D_PO(&noise_terrain_base->np, @@ -289,7 +290,7 @@ float MapgenV6::baseTerrainLevelFromMap(v2s16 p) float MapgenV6::baseTerrainLevelFromMap(int index) { - if (flags & MG_FLAT) + if ((spflags & MGV6_FLAT) || (flags & MG_FLAT)) return water_level; float terrain_base = noise_terrain_base->result[index]; @@ -386,7 +387,7 @@ bool MapgenV6::getHaveAppleTree(v2s16 p) float MapgenV6::getMudAmount(int index) { - if (flags & MG_FLAT) + if ((spflags & MGV6_FLAT) || (flags & MG_FLAT)) return MGV6_AVERAGE_MUD_AMOUNT; /*return ((float)AVERAGE_MUD_AMOUNT + 2.0 * noise2d_perlin( @@ -603,7 +604,7 @@ void MapgenV6::calculateNoise() int fx = full_node_min.X; int fz = full_node_min.Z; - if (!(flags & MG_FLAT)) { + if (!((spflags & MGV6_FLAT) || (flags & MG_FLAT))) { noise_terrain_base->perlinMap2D_PO(x, 0.5, z, 0.5); noise_terrain_higher->perlinMap2D_PO(x, 0.5, z, 0.5); noise_steepness->perlinMap2D_PO(x, 0.5, z, 0.5); diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h index 685fdad7..dec92ab4 100644 --- a/src/mapgen_v6.h +++ b/src/mapgen_v6.h @@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MGV6_BIOMEBLEND 0x02 #define MGV6_MUDFLOW 0x04 #define MGV6_SNOWBIOMES 0x08 +#define MGV6_FLAT 0x10 extern FlagDesc flagdesc_mapgen_v6[];