From bf25837617541eee0317e1231abca65233edeb8e Mon Sep 17 00:00:00 2001 From: kwolekr Date: Tue, 10 May 2016 00:10:59 -0400 Subject: Cavegen: Rename CaveV6 to CavesV6 - Add comment explaining why it exists - Remove unused 'flooded' variable - Rename shadowed variable - Fix some code style --- src/mapgen_v6.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mapgen_v6.cpp') diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index c389b2ed4..d143f12e9 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -1067,7 +1067,7 @@ void MapgenV6::generateCaves(int max_stone_y) for (u32 i = 0; i < caves_count + bruises_count; i++) { bool large_cave = (i >= caves_count); - CaveV6 cave(this, &ps, &ps2, large_cave); + CavesV6 cave(this, &ps, &ps2, large_cave); cave.makeCave(node_min, node_max, max_stone_y); } -- cgit v1.2.3 From a605d690921670008d605d067f1cf8cd1619def7 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Tue, 10 May 2016 13:21:13 -0400 Subject: Cavegen: Remove CavesV6 dependency on Mapgen --- src/mapgen_v6.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mapgen_v6.cpp') diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index d143f12e9..65acfaf93 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -1066,9 +1066,10 @@ void MapgenV6::generateCaves(int max_stone_y) } for (u32 i = 0; i < caves_count + bruises_count; i++) { - bool large_cave = (i >= caves_count); - CavesV6 cave(this, &ps, &ps2, large_cave); + CavesV6 cave(ndef, &gennotify, water_level, c_water_source, c_lava_source); - cave.makeCave(node_min, node_max, max_stone_y); + bool large_cave = (i >= caves_count); + cave.makeCave(vm, node_min, node_max, &ps, &ps2, + large_cave, max_stone_y, heightmap); } } -- cgit v1.2.3 From c8fd232678698b8be469b3792e7acc9418231a38 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sun, 22 May 2016 16:50:43 -0400 Subject: Dungeongen: Remove dependency on Mapgen --- src/mapgen_v6.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/mapgen_v6.cpp') diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 65acfaf93..103120b6a 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -559,6 +559,8 @@ void MapgenV6::makeChunk(BlockMakeData *data) if ((flags & MG_DUNGEONS) && (stone_surface_max_y >= node_min.Y)) { DungeonParams dp; + dp.seed = seed; + dp.np_rarity = nparams_dungeon_rarity; dp.np_density = nparams_dungeon_density; dp.np_wetness = nparams_dungeon_wetness; @@ -585,8 +587,8 @@ void MapgenV6::makeChunk(BlockMakeData *data) dp.notifytype = GENNOTIFY_DUNGEON; } - DungeonGen dgen(this, &dp); - dgen.generate(blockseed, full_node_min, full_node_max); + DungeonGen dgen(ndef, &gennotify, &dp); + dgen.generate(vm, blockseed, full_node_min, full_node_max); } // Add top and bottom side of water to transforming_liquid queue -- cgit v1.2.3 From 04fb10914c0d03ee77dafe610f336f23c58949ab Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 12 Jun 2016 03:11:26 +0100 Subject: Dungeons: Generalise use, add capabilities, various modifications - Generalise node names to c_wall and c_alt_wall - Remove 'mossratio' and instead disable alt_wall loop if c_alt_wall == CONTENT_IGNORE - Use one generalised 3D noise for alternative wall nodes and in mgv6 create moss distribution similar to the previous - Rename rarity noise to density noise and enable the option of multiple dungeons per chunk determined by the value. Recreate previous distribution - Add parameters for min and max rooms per dungeon - Add dungeon y limits - Integrate river water properly Generalisation is needed now that we have sandstone and desert stone dungeons by default and can choose any node for alternative structure. The current code is based around cobble dungeons with mossycobble alternative nodes, the 2 noises controlling the alternative nodes are based on wetness. Enabling multiple dungeons per chunk with definable number of rooms allows the option of very dense and complex underground structures that could interconnect to create megastructures. Y limits are added to be consistent with other mapgen elements, and enable locaton of dungeon or megastructure realms as part of our 'stacked realms' philosophy. --- src/mapgen_v6.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/mapgen_v6.cpp') diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index 103120b6a..caa64827e 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -560,28 +560,30 @@ void MapgenV6::makeChunk(BlockMakeData *data) DungeonParams dp; dp.seed = seed; + dp.c_water = c_water_source; + dp.c_river_water = c_water_source; + dp.rooms_min = 2; + dp.rooms_max = 16; + dp.y_min = -MAX_MAP_GENERATION_LIMIT; + dp.y_max = MAX_MAP_GENERATION_LIMIT; + dp.np_density = NoiseParams(0.9, 0.5, v3f(500.0, 500.0, 500.0), 0, 2, 0.8, 2.0); + dp.np_alt_wall = NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0); - dp.np_rarity = nparams_dungeon_rarity; - dp.np_density = nparams_dungeon_density; - dp.np_wetness = nparams_dungeon_wetness; - dp.c_water = c_water_source; if (getBiome(0, v2s16(node_min.X, node_min.Z)) == BT_DESERT) { - dp.c_cobble = c_desert_stone; - dp.c_moss = c_desert_stone; - dp.c_stair = c_desert_stone; + dp.c_wall = c_desert_stone; + dp.c_alt_wall = CONTENT_IGNORE; + dp.c_stair = c_desert_stone; dp.diagonal_dirs = true; - dp.mossratio = 0.0; dp.holesize = v3s16(2, 3, 2); dp.roomsize = v3s16(2, 5, 2); dp.notifytype = GENNOTIFY_TEMPLE; } else { - dp.c_cobble = c_cobble; - dp.c_moss = c_mossycobble; - dp.c_stair = c_stair_cobble; + dp.c_wall = c_cobble; + dp.c_alt_wall = c_mossycobble; + dp.c_stair = c_stair_cobble; dp.diagonal_dirs = false; - dp.mossratio = 3.0; dp.holesize = v3s16(1, 2, 1); dp.roomsize = v3s16(0, 0, 0); dp.notifytype = GENNOTIFY_DUNGEON; -- cgit v1.2.3 From 3c63c3044d5e4ca36c2649c530f31622581d90fd Mon Sep 17 00:00:00 2001 From: kwolekr Date: Fri, 24 Jun 2016 18:15:56 -0400 Subject: Add MapSettingsManager and new mapgen setting script API functions This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed. --- src/mapgen_v6.cpp | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src/mapgen_v6.cpp') diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index caa64827e..e4444963f 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -53,7 +53,7 @@ FlagDesc flagdesc_mapgen_v6[] = { ///////////////////////////////////////////////////////////////////////////// -MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge) +MapgenV6::MapgenV6(int mapgenid, MapgenV6Params *params, EmergeManager *emerge) : Mapgen(mapgenid, params, emerge) { this->m_emerge = emerge; @@ -61,26 +61,25 @@ MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge) this->heightmap = new s16[csize.X * csize.Z]; - MapgenV6Params *sp = (MapgenV6Params *)params->sparams; - this->spflags = sp->spflags; - this->freq_desert = sp->freq_desert; - this->freq_beach = sp->freq_beach; + this->spflags = params->spflags; + this->freq_desert = params->freq_desert; + this->freq_beach = params->freq_beach; - np_cave = &sp->np_cave; - np_humidity = &sp->np_humidity; - np_trees = &sp->np_trees; - np_apple_trees = &sp->np_apple_trees; + np_cave = ¶ms->np_cave; + np_humidity = ¶ms->np_humidity; + np_trees = ¶ms->np_trees; + np_apple_trees = ¶ms->np_apple_trees; //// Create noise objects - noise_terrain_base = new Noise(&sp->np_terrain_base, seed, csize.X, csize.Y); - noise_terrain_higher = new Noise(&sp->np_terrain_higher, seed, csize.X, csize.Y); - noise_steepness = new Noise(&sp->np_steepness, seed, csize.X, csize.Y); - noise_height_select = new Noise(&sp->np_height_select, seed, csize.X, csize.Y); - noise_mud = new Noise(&sp->np_mud, seed, csize.X, csize.Y); - noise_beach = new Noise(&sp->np_beach, seed, csize.X, csize.Y); - noise_biome = new Noise(&sp->np_biome, seed, + noise_terrain_base = new Noise(¶ms->np_terrain_base, seed, csize.X, csize.Y); + noise_terrain_higher = new Noise(¶ms->np_terrain_higher, seed, csize.X, csize.Y); + noise_steepness = new Noise(¶ms->np_steepness, seed, csize.X, csize.Y); + noise_height_select = new Noise(¶ms->np_height_select, seed, csize.X, csize.Y); + noise_mud = new Noise(¶ms->np_mud, seed, csize.X, csize.Y); + noise_beach = new Noise(¶ms->np_beach, seed, csize.X, csize.Y); + noise_biome = new Noise(¶ms->np_biome, seed, csize.X + 2 * MAP_BLOCKSIZE, csize.Y + 2 * MAP_BLOCKSIZE); - noise_humidity = new Noise(&sp->np_humidity, seed, + noise_humidity = new Noise(¶ms->np_humidity, seed, csize.X + 2 * MAP_BLOCKSIZE, csize.Y + 2 * MAP_BLOCKSIZE); //// Resolve nodes to be used -- cgit v1.2.3 From ea12da939fdb0a8fd13de885d104af3031ffc3ac Mon Sep 17 00:00:00 2001 From: paramat Date: Fri, 29 Jul 2016 03:44:58 +0100 Subject: Mapgen: Remove unused 'flat' and 'trees' flags from mg_flags When the 'flat' and 'trees' flags were moved into mgv6_spflags they were left in mg_flags in an attempt to support old mgv6 worlds. However their appearence in mg_flags causes confusion, also, later, old-world support was found to be broken for mgv6 worlds with 'notrees'. This commit cleans up the mess and comes a month after a thread warning of the change, and explaining the required action, was posted in the news subforum. Only old mgv6 worlds with 'flat' or 'notrees' are affected, a small minority of worlds, the required action being correctly setting these flags in mgv6_spflags. Disable a section of the 'map settings manager' unit test which is to be changed as it is causing problems for pull requests. --- src/mapgen_v6.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mapgen_v6.cpp') diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index e4444963f..79617a830 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -268,7 +268,7 @@ float MapgenV6::baseTerrainLevel(float terrain_base, float terrain_higher, float MapgenV6::baseTerrainLevelFromNoise(v2s16 p) { - if ((spflags & MGV6_FLAT) || (flags & MG_FLAT)) + if (spflags & MGV6_FLAT) return water_level; float terrain_base = NoisePerlin2D_PO(&noise_terrain_base->np, @@ -294,7 +294,7 @@ float MapgenV6::baseTerrainLevelFromMap(v2s16 p) float MapgenV6::baseTerrainLevelFromMap(int index) { - if ((spflags & MGV6_FLAT) || (flags & MG_FLAT)) + if (spflags & MGV6_FLAT) return water_level; float terrain_base = noise_terrain_base->result[index]; @@ -402,7 +402,7 @@ bool MapgenV6::getHaveAppleTree(v2s16 p) float MapgenV6::getMudAmount(int index) { - if ((spflags & MGV6_FLAT) || (flags & MG_FLAT)) + if (spflags & MGV6_FLAT) return MGV6_AVERAGE_MUD_AMOUNT; /*return ((float)AVERAGE_MUD_AMOUNT + 2.0 * noise2d_perlin( @@ -599,7 +599,7 @@ void MapgenV6::makeChunk(BlockMakeData *data) growGrass(); // Generate some trees, and add grass, if a jungle - if ((spflags & MGV6_TREES) || (flags & MG_TREES)) + if (spflags & MGV6_TREES) placeTreesAndJungleGrass(); // Generate the registered decorations @@ -626,7 +626,7 @@ void MapgenV6::calculateNoise() int fx = full_node_min.X; int fz = full_node_min.Z; - if (!((spflags & MGV6_FLAT) || (flags & MG_FLAT))) { + if (!(spflags & MGV6_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); -- cgit v1.2.3