Skip to content

Commit dc9e451

Browse files
committedJul 21, 2017
Mgv7: Add option to repeat surface biomes in floatlands
1 parent 49920cf commit dc9e451

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed
 

‎builtin/settingtypes.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1151,11 +1151,11 @@ mgv6_np_apple_trees (Apple trees noise) noise_params 0, 1, (100, 100, 100), 3429
11511151
[***Mapgen v7]
11521152

11531153
# Map generation attributes specific to Mapgen v7.
1154-
# The 'ridges' flag enables the rivers.
1155-
# Floatlands are currently experimental and subject to change.
1154+
# 'ridges' enables the rivers.
1155+
# 'biomerepeat' causes surface biomes to repeat in the floatlands.
11561156
# Flags that are not specified in the flag string are not modified from the default.
11571157
# Flags starting with 'no' are used to explicitly disable them.
1158-
mgv7_spflags (Mapgen v7 specific flags) flags mountains,ridges,nofloatlands,caverns mountains,ridges,floatlands,caverns,nomountains,noridges,nofloatlands,nocaverns
1158+
mgv7_spflags (Mapgen v7 specific flags) flags mountains,ridges,nofloatlands,caverns,biomerepeat mountains,ridges,floatlands,caverns,biomerepeat,nomountains,noridges,nofloatlands,nocaverns,nobiomerepeat
11591159

11601160
# Controls width of tunnels, a smaller value creates wider tunnels.
11611161
mgv7_cave_width (Cave width) float 0.09

‎minetest.conf.example

+4-4
Original file line numberDiff line numberDiff line change
@@ -1390,12 +1390,12 @@
13901390
#### Mapgen v7
13911391

13921392
# Map generation attributes specific to Mapgen v7.
1393-
# The 'ridges' flag enables the rivers.
1394-
# Floatlands are currently experimental and subject to change.
1393+
# 'ridges' enables the rivers.
1394+
# 'biomerepeat' causes surface biomes to repeat in the floatlands.
13951395
# Flags that are not specified in the flag string are not modified from the default.
13961396
# Flags starting with 'no' are used to explicitly disable them.
1397-
# type: flags possible values: mountains, ridges, floatlands, caverns, nomountains, noridges, nofloatlands, nocaverns
1398-
# mgv7_spflags = mountains,ridges,nofloatlands,caverns
1397+
# type: flags possible values: mountains, ridges, floatlands, caverns, biomerepeat, nomountains, noridges, nofloatlands, nocaverns, nobiomerepeat
1398+
# mgv7_spflags = mountains,ridges,nofloatlands,caverns,biomerepeat
13991399

14001400
# Controls width of tunnels, a smaller value creates wider tunnels.
14011401
# type: float

‎src/mapgen_v7.cpp

+14-7
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
4040

4141

4242
FlagDesc flagdesc_mapgen_v7[] = {
43-
{"mountains", MGV7_MOUNTAINS},
44-
{"ridges", MGV7_RIDGES},
45-
{"floatlands", MGV7_FLOATLANDS},
46-
{"caverns", MGV7_CAVERNS},
47-
{NULL, 0}
43+
{"mountains", MGV7_MOUNTAINS},
44+
{"ridges", MGV7_RIDGES},
45+
{"floatlands", MGV7_FLOATLANDS},
46+
{"caverns", MGV7_CAVERNS},
47+
{"biomerepeat", MGV7_BIOMEREPEAT},
48+
{NULL, 0}
4849
};
4950

5051

@@ -285,6 +286,12 @@ void MapgenV7::makeChunk(BlockMakeData *data)
285286

286287
blockseed = getBlockSeed2(full_node_min, seed);
287288

289+
// Get zero level for biomes and decorations
290+
// Optionally repeat surface biomes in floatlands
291+
s16 biome_zero_level = ((spflags & MGV7_FLOATLANDS) &&
292+
(spflags & MGV7_BIOMEREPEAT) && node_max.Y >= shadow_limit) ?
293+
floatland_level - 1 : water_level - 1;
294+
288295
// Generate base and mountain terrain
289296
// An initial heightmap is no longer created here for use in generateRidgeTerrain()
290297
s16 stone_surface_max_y = generateTerrain();
@@ -298,7 +305,7 @@ void MapgenV7::makeChunk(BlockMakeData *data)
298305

299306
// Init biome generator, place biome-specific nodes, and build biomemap
300307
biomegen->calcBiomeNoise(node_min);
301-
MgStoneType stone_type = generateBiomes(water_level - 1);
308+
MgStoneType stone_type = generateBiomes(biome_zero_level);
302309

303310
// Generate caverns, tunnels and classic caves
304311
if (flags & MG_CAVES) {
@@ -323,7 +330,7 @@ void MapgenV7::makeChunk(BlockMakeData *data)
323330
// Generate the registered decorations
324331
if (flags & MG_DECORATIONS)
325332
m_emerge->decomgr->placeAllDecos(this, blockseed,
326-
node_min, node_max, water_level - 1);
333+
node_min, node_max, biome_zero_level);
327334

328335
// Generate the registered ores
329336
m_emerge->oremgr->placeAllOres(this, blockseed,

‎src/mapgen_v7.h

+8-6
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2323

2424
#include "mapgen.h"
2525

26-
//////////// Mapgen V7 flags
27-
#define MGV7_MOUNTAINS 0x01
28-
#define MGV7_RIDGES 0x02
29-
#define MGV7_FLOATLANDS 0x04
30-
#define MGV7_CAVERNS 0x08
26+
/////////////// Mapgen V7 flags
27+
#define MGV7_MOUNTAINS 0x01
28+
#define MGV7_RIDGES 0x02
29+
#define MGV7_FLOATLANDS 0x04
30+
#define MGV7_CAVERNS 0x08
31+
#define MGV7_BIOMEREPEAT 0x10
3132

3233
class BiomeManager;
3334

3435
extern FlagDesc flagdesc_mapgen_v7[];
3536

3637

3738
struct MapgenV7Params : public MapgenParams {
38-
u32 spflags = MGV7_MOUNTAINS | MGV7_RIDGES | MGV7_CAVERNS;
39+
u32 spflags = MGV7_MOUNTAINS | MGV7_RIDGES |
40+
MGV7_CAVERNS | MGV7_BIOMEREPEAT;
3941
float cave_width = 0.09f;
4042
s16 large_cave_depth = -33;
4143
s16 lava_depth = -256;

0 commit comments

Comments
 (0)
Please sign in to comment.