From ae929ce2fdcfcfc95cffece35f3d38ea4d96dd9f Mon Sep 17 00:00:00 2001 From: paramat Date: Mon, 23 Jan 2017 08:07:34 +0000 Subject: Dungeons: Add nodebox stairs to desert and sandstone dungeons Desert and sandstone dungeons have 2 node wide corridors. Previously, nodebox stairs were disabled because dungeon generation code did not support nodebox stairs wider than 1 node, now it does. Add 'stair desert stone' content id to MappgenBasic. Requires 'mapgen stair desert stone' to be added to Minetest Game. --- src/mapgen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index fd4f5858f..e42fc7467 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -604,6 +604,7 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer c_cobble = ndef->getId("mapgen_cobble"); c_stair_cobble = ndef->getId("mapgen_stair_cobble"); c_mossycobble = ndef->getId("mapgen_mossycobble"); + c_stair_desert_stone = ndef->getId("mapgen_stair_desert_stone"); c_sandstonebrick = ndef->getId("mapgen_sandstonebrick"); c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick"); @@ -867,7 +868,7 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type) case MGSTONE_DESERT_STONE: dp.c_wall = c_desert_stone; dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = c_desert_stone; + dp.c_stair = c_stair_desert_stone; dp.diagonal_dirs = true; dp.holesize = v3s16(2, 3, 2); @@ -877,7 +878,7 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type) case MGSTONE_SANDSTONE: dp.c_wall = c_sandstonebrick; dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = c_sandstonebrick; + dp.c_stair = c_stair_sandstonebrick; dp.diagonal_dirs = false; dp.holesize = v3s16(2, 2, 2); -- cgit v1.2.3 From 2d03cfd24c89c66e5ace4f335dae42f7c2c84f6b Mon Sep 17 00:00:00 2001 From: paramat Date: Sat, 4 Feb 2017 04:04:03 +0000 Subject: MapgenBasic node resolver: Various fixes Add a fallback node for stair_desert_stone to avoid ignore placed in Minimal subgame desert dungeons. Don't allow river_water_source to fallback to water_source as river water needs to be non-renewable and have a short flow range. Make stair_sandstonebrick fall back to sandstonebrick instead of sandstone. Re-order some lines. Add a comment. --- src/mapgen.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index e42fc7467..00ae917a1 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -587,23 +587,23 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer //// Look up some commonly used content c_stone = ndef->getId("mapgen_stone"); - c_water_source = ndef->getId("mapgen_water_source"); c_desert_stone = ndef->getId("mapgen_desert_stone"); c_sandstone = ndef->getId("mapgen_sandstone"); + c_water_source = ndef->getId("mapgen_water_source"); c_river_water_source = ndef->getId("mapgen_river_water_source"); // Fall back to more basic content if not defined + // river_water_source cannot fallback to water_source because river water + // needs to be non-renewable and have a short flow range. if (c_desert_stone == CONTENT_IGNORE) c_desert_stone = c_stone; if (c_sandstone == CONTENT_IGNORE) c_sandstone = c_stone; - if (c_river_water_source == CONTENT_IGNORE) - c_river_water_source = c_water_source; //// Content used for dungeon generation c_cobble = ndef->getId("mapgen_cobble"); - c_stair_cobble = ndef->getId("mapgen_stair_cobble"); c_mossycobble = ndef->getId("mapgen_mossycobble"); + c_stair_cobble = ndef->getId("mapgen_stair_cobble"); c_stair_desert_stone = ndef->getId("mapgen_stair_desert_stone"); c_sandstonebrick = ndef->getId("mapgen_sandstonebrick"); c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick"); @@ -613,10 +613,12 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer c_mossycobble = c_cobble; if (c_stair_cobble == CONTENT_IGNORE) c_stair_cobble = c_cobble; + if (c_stair_desert_stone == CONTENT_IGNORE) + c_stair_desert_stone = c_desert_stone; if (c_sandstonebrick == CONTENT_IGNORE) c_sandstonebrick = c_sandstone; if (c_stair_sandstonebrick == CONTENT_IGNORE) - c_stair_sandstonebrick = c_sandstone; + c_stair_sandstonebrick = c_sandstonebrick; } -- cgit v1.2.3 From a901a56859e5beaec6a542eae037dc0b736a20e3 Mon Sep 17 00:00:00 2001 From: paramat Date: Tue, 21 Feb 2017 01:56:34 +0000 Subject: Dungeongen: Add and improve parameters Add: Bool for 'only_in_ground'. Min and max corridor length. Min and max room size with X, Y, Z components. Min and max large room size with X, Y, Z components. 'only_in_ground = false' allows core mapgens to create structures in air and water using dungeongen. Corridor length parameters replace a fixed random range. Room size parameters replace the former system where one parameter 'roomsize' was added to fixed random ranges. All parameters are set for no change to current dungeon behaviour. Remove some now-redundant and long-unused code. --- src/mapgen.cpp | 80 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 33 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 00ae917a1..e1e3ccd25 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -845,47 +845,61 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type) DungeonParams dp; - dp.seed = seed; - dp.c_water = c_water_source; - dp.c_river_water = c_river_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 = nparams_dungeon_density; - dp.np_alt_wall = nparams_dungeon_alt_wall; + dp.seed = seed; + dp.c_water = c_water_source; + dp.c_river_water = c_river_water_source; + + dp.only_in_ground = true; + dp.corridor_len_min = 1; + dp.corridor_len_max = 13; + 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 = nparams_dungeon_density; + dp.np_alt_wall = nparams_dungeon_alt_wall; switch (stone_type) { default: case MGSTONE_STONE: - dp.c_wall = c_cobble; - dp.c_alt_wall = c_mossycobble; - dp.c_stair = c_stair_cobble; - - dp.diagonal_dirs = false; - dp.holesize = v3s16(1, 2, 1); - dp.roomsize = v3s16(0, 0, 0); - dp.notifytype = GENNOTIFY_DUNGEON; + dp.c_wall = c_cobble; + dp.c_alt_wall = c_mossycobble; + dp.c_stair = c_stair_cobble; + + dp.diagonal_dirs = false; + dp.holesize = v3s16(1, 2, 1); + dp.room_size_min = v3s16(4, 4, 4); + dp.room_size_max = v3s16(8, 6, 8); + dp.room_size_large_min = v3s16(8, 8, 8); + dp.room_size_large_max = v3s16(16, 16, 16); + dp.notifytype = GENNOTIFY_DUNGEON; break; case MGSTONE_DESERT_STONE: - dp.c_wall = c_desert_stone; - dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = c_stair_desert_stone; - - dp.diagonal_dirs = true; - dp.holesize = v3s16(2, 3, 2); - dp.roomsize = v3s16(2, 5, 2); - dp.notifytype = GENNOTIFY_TEMPLE; + dp.c_wall = c_desert_stone; + dp.c_alt_wall = CONTENT_IGNORE; + dp.c_stair = c_stair_desert_stone; + + dp.diagonal_dirs = true; + dp.holesize = v3s16(2, 3, 2); + dp.room_size_min = v3s16(6, 9, 6); + dp.room_size_max = v3s16(10, 11, 10); + dp.room_size_large_min = v3s16(10, 13, 10); + dp.room_size_large_max = v3s16(18, 21, 18); + dp.notifytype = GENNOTIFY_TEMPLE; break; case MGSTONE_SANDSTONE: - dp.c_wall = c_sandstonebrick; - dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = c_stair_sandstonebrick; - - dp.diagonal_dirs = false; - dp.holesize = v3s16(2, 2, 2); - dp.roomsize = v3s16(2, 0, 2); - dp.notifytype = GENNOTIFY_DUNGEON; + dp.c_wall = c_sandstonebrick; + dp.c_alt_wall = CONTENT_IGNORE; + dp.c_stair = c_stair_sandstonebrick; + + dp.diagonal_dirs = false; + dp.holesize = v3s16(2, 2, 2); + dp.room_size_min = v3s16(6, 4, 6); + dp.room_size_max = v3s16(10, 6, 10); + dp.room_size_large_min = v3s16(10, 8, 10); + dp.room_size_large_max = v3s16(18, 16, 18); + dp.notifytype = GENNOTIFY_DUNGEON; break; } -- cgit v1.2.3 From e10e5fd16c2bd55b9b106edc6cedd07530cf103d Mon Sep 17 00:00:00 2001 From: paramat Date: Sat, 4 Mar 2017 05:10:10 +0000 Subject: Dungeons: Use 'block' instead of 'brick' for nodebox stairs Affects only sandstone dungeons. Nodebox stairs made from 'sandstone_block' look better because every step is undivided. --- src/mapgen.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index e1e3ccd25..a0b9990b7 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -601,12 +601,12 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer c_sandstone = c_stone; //// Content used for dungeon generation - c_cobble = ndef->getId("mapgen_cobble"); - c_mossycobble = ndef->getId("mapgen_mossycobble"); - c_stair_cobble = ndef->getId("mapgen_stair_cobble"); - c_stair_desert_stone = ndef->getId("mapgen_stair_desert_stone"); - c_sandstonebrick = ndef->getId("mapgen_sandstonebrick"); - c_stair_sandstonebrick = ndef->getId("mapgen_stair_sandstonebrick"); + c_cobble = ndef->getId("mapgen_cobble"); + c_mossycobble = ndef->getId("mapgen_mossycobble"); + c_stair_cobble = ndef->getId("mapgen_stair_cobble"); + c_stair_desert_stone = ndef->getId("mapgen_stair_desert_stone"); + c_sandstonebrick = ndef->getId("mapgen_sandstonebrick"); + c_stair_sandstone_block = ndef->getId("mapgen_stair_sandstone_block"); // Fall back to more basic content if not defined if (c_mossycobble == CONTENT_IGNORE) @@ -617,8 +617,8 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer c_stair_desert_stone = c_desert_stone; if (c_sandstonebrick == CONTENT_IGNORE) c_sandstonebrick = c_sandstone; - if (c_stair_sandstonebrick == CONTENT_IGNORE) - c_stair_sandstonebrick = c_sandstonebrick; + if (c_stair_sandstone_block == CONTENT_IGNORE) + c_stair_sandstone_block = c_sandstonebrick; } @@ -891,7 +891,7 @@ void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type) case MGSTONE_SANDSTONE: dp.c_wall = c_sandstonebrick; dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = c_stair_sandstonebrick; + dp.c_stair = c_stair_sandstone_block; dp.diagonal_dirs = false; dp.holesize = v3s16(2, 2, 2); -- cgit v1.2.3 From ec0c4d33db9e0b7b3e541757e34c04c08c3b48c9 Mon Sep 17 00:00:00 2001 From: paramat Date: Thu, 23 Mar 2017 00:18:59 +0000 Subject: Map generation limit: Make per-world The setting limits map generation but affects nothing else. Add 'mapgen_limit' to global mapgen parameters. Move 'blockpos_over_mapgen_limit()' to the only place it is called from: map.cpp. Allow teleportation to any part of the world even if over the set mapgen limit. Simplify the reading of this limit in mgvalleys. Remove the 'map_generation_limit' setting. --- src/mapgen.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index a0b9990b7..6f3ea7cb0 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -97,11 +97,12 @@ STATIC_ASSERT( Mapgen::Mapgen() { - generating = false; - id = -1; - seed = 0; - water_level = 0; - flags = 0; + generating = false; + id = -1; + seed = 0; + water_level = 0; + mapgen_limit = 0; + flags = 0; vm = NULL; ndef = NULL; @@ -114,11 +115,12 @@ Mapgen::Mapgen() Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge) : gennotify(emerge->gen_notify_on, &emerge->gen_notify_on_deco_ids) { - generating = false; - id = mapgenid; - water_level = params->water_level; - flags = params->flags; - csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE); + generating = false; + id = mapgenid; + water_level = params->water_level; + mapgen_limit = params->mapgen_limit; + flags = params->flags; + csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE); /* We are losing half our entropy by doing this, but it is necessary to @@ -1005,6 +1007,7 @@ void MapgenParams::readParams(const Settings *settings) this->mgtype = Mapgen::getMapgenType(mg_name); settings->getS16NoEx("water_level", water_level); + settings->getS16NoEx("mapgen_limit", mapgen_limit); settings->getS16NoEx("chunksize", chunksize); settings->getFlagStrNoEx("mg_flags", flags, flagdesc_mapgen); @@ -1022,6 +1025,7 @@ void MapgenParams::writeParams(Settings *settings) const settings->set("mg_name", Mapgen::getMapgenName(mgtype)); settings->setU64("seed", seed); settings->setS16("water_level", water_level); + settings->setS16("mapgen_limit", mapgen_limit); settings->setS16("chunksize", chunksize); settings->setFlagStr("mg_flags", flags, flagdesc_mapgen, U32_MAX); -- cgit v1.2.3 From 773efc19b1d05e573d5bc811c0175d192f7c12c5 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 1 Apr 2017 10:18:13 +0200 Subject: mapgen: Fix segfault when selecting invalid mapgen (#5491) --- src/mapgen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 6f3ea7cb0..b6e8c0fd1 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1003,8 +1003,11 @@ void MapgenParams::readParams(const Settings *settings) } std::string mg_name; - if (settings->getNoEx("mg_name", mg_name)) - this->mgtype = Mapgen::getMapgenType(mg_name); + if (settings->getNoEx("mg_name", mg_name)) { + mgtype = Mapgen::getMapgenType(mg_name); + if (mgtype == MAPGEN_INVALID) + mgtype = MAPGEN_DEFAULT; + } settings->getS16NoEx("water_level", water_level); settings->getS16NoEx("mapgen_limit", mapgen_limit); -- cgit v1.2.3 From 859141a0ce38fbd606d95ae7a2f0999acf2fbe84 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 12 Mar 2017 13:26:09 +0000 Subject: Cavegen/Mgv5/Mgv7: Add optional giant caverns Add to MapgenBasic for use by multiple mapgens. Add to mgv5 and mgv7, enabled by default. Similar to mgvalleys caverns but half the scale. Parameters for upper y limit, distance caverns taper to full size, and noise threshold (full cavern size). As with mgvalleys caverns are generated first and classic caves are disabled in any mapchunk containing a cavern, to avoid excessive spreading volumes of liquids. This also avoids floating blobs of liquid where a large classic cave has overgenerated out into a neighbouring previously-generated mapchunk. --- src/mapgen.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index b6e8c0fd1..c63c426fa 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -840,6 +840,18 @@ void MapgenBasic::generateCaves(s16 max_stone_y, s16 large_cave_depth) } +bool MapgenBasic::generateCaverns(s16 max_stone_y) +{ + if (node_min.Y > max_stone_y || node_min.Y > cavern_limit) + return false; + + CavernsNoise caverns_noise(ndef, csize, &np_cavern, + seed, cavern_limit, cavern_taper, cavern_threshold); + + return caverns_noise.generateCaverns(vm, node_min, node_max); +} + + void MapgenBasic::generateDungeons(s16 max_stone_y, MgStoneType stone_type) { if (max_stone_y < node_min.Y) -- cgit v1.2.3 From b8a4c95971bff050f6fad8ce740c3be949a321a6 Mon Sep 17 00:00:00 2001 From: Paramat Date: Tue, 4 Apr 2017 06:51:58 +0100 Subject: MapgenBasic: Add lava source as commonly used content (#5512) Future mapgens are likely to use this for magma and volcanos. Remove the getting of lava source content id in mgvalleys. --- src/mapgen.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index c63c426fa..bd0e94ac7 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -593,6 +593,7 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer c_sandstone = ndef->getId("mapgen_sandstone"); c_water_source = ndef->getId("mapgen_water_source"); c_river_water_source = ndef->getId("mapgen_river_water_source"); + c_lava_source = ndef->getId("mapgen_lava_source"); // Fall back to more basic content if not defined // river_water_source cannot fallback to water_source because river water -- cgit v1.2.3 From 210a339dce754a6cb03d4ef82f5bacc80b63262b Mon Sep 17 00:00:00 2001 From: paramat Date: Thu, 25 May 2017 18:53:47 +0100 Subject: Mapgen files: Update and correct copyright credits --- src/mapgen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index bd0e94ac7..6fd2ac580 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1,7 +1,8 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-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 -- cgit v1.2.3 From 1c69476d9f10540088ead63c8bcae91f46bc84d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Thu, 1 Jun 2017 23:18:24 +0200 Subject: Show singlenode mapgen to menu (#5868) Fix #5867 --- src/mapgen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 6fd2ac580..dfe413a71 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -85,7 +85,7 @@ static MapgenDesc g_reg_mapgens[] = { {"flat", true}, {"fractal", true}, {"valleys", true}, - {"singlenode", false}, + {"singlenode", true}, }; STATIC_ASSERT( -- cgit v1.2.3 From c6d54411056da2dd563015c9f90c4c5c0863bc71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 3 Jun 2017 19:57:02 +0200 Subject: Properly remove SAO when worldedges are overtaken (#5889) * LuaEntitySAO: Remove beyond outermost mapchunk edges Based on a commit by, and with help from, nerzhul. Add 2 functions to class Mapgen: A function to calculate actual mapgen edges, called from the Mapgen constructor. A function called indirectly from content_sao.cpp per entity step to check SAO position is within mapgen edges. * Calculate borders from params not mapgen, which is not available everytime --- src/mapgen.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'src/mapgen.cpp') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index dfe413a71..1f7f98621 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -317,7 +317,6 @@ void Mapgen::updateHeightmap(v3s16 nmin, v3s16 nmax) heightmap[index] = y; } } - //printf("updateHeightmap: %dus\n", t.stop()); } inline bool Mapgen::isLiquidHorizontallyFlowable(u32 vi, v3s16 em) @@ -1049,3 +1048,54 @@ void MapgenParams::writeParams(Settings *settings) const if (bparams) bparams->writeParams(settings); } + +// Calculate edges of outermost generated mapchunks (less than +// 'mapgen_limit'), and corresponding exact limits for SAO entities. +void MapgenParams::calcMapgenEdges() +{ + // Central chunk offset, in blocks + s16 ccoff_b = -chunksize / 2; + + // Chunksize, in nodes + s32 csize_n = chunksize * MAP_BLOCKSIZE; + + // Minp/maxp of central chunk, in nodes + s16 ccmin = ccoff_b * MAP_BLOCKSIZE; + s16 ccmax = ccmin + csize_n - 1; + // Fullminp/fullmaxp of central chunk, in nodes + s16 ccfmin = ccmin - MAP_BLOCKSIZE; + s16 ccfmax = ccmax + MAP_BLOCKSIZE; + // Effective mapgen limit, in blocks + // Uses same calculation as ServerMap::blockpos_over_mapgen_limit(v3s16 p) + s16 mapgen_limit_b = rangelim(mapgen_limit, + 0, MAX_MAP_GENERATION_LIMIT) / MAP_BLOCKSIZE; + // Effective mapgen limits, in nodes + s16 mapgen_limit_min = -mapgen_limit_b * MAP_BLOCKSIZE; + s16 mapgen_limit_max = (mapgen_limit_b + 1) * MAP_BLOCKSIZE - 1; + // Number of complete chunks from central chunk fullminp/fullmaxp + // to effective mapgen limits. + s16 numcmin = MYMAX((ccfmin - mapgen_limit_min) / csize_n, 0); + s16 numcmax = MYMAX((mapgen_limit_max - ccfmax) / csize_n, 0); + // Mapgen edges, in nodes + // These values may be useful later as additional class members + s16 mapgen_edge_min = ccmin - numcmin * csize_n; + s16 mapgen_edge_max = ccmax + numcmax * csize_n; + // SAO position limits, in Irrlicht units + m_sao_limit_min = mapgen_edge_min * BS - 3.0f; + m_sao_limit_max = mapgen_edge_max * BS + 3.0f; +} + + +bool MapgenParams::saoPosOverLimit(const v3f &p) +{ + if (!m_sao_limit_calculated) { + calcMapgenEdges(); + m_sao_limit_calculated = true; + } + return p.X < m_sao_limit_min || + p.X > m_sao_limit_max || + p.Y < m_sao_limit_min || + p.Y > m_sao_limit_max || + p.Z < m_sao_limit_min || + p.Z > m_sao_limit_max; +} -- cgit v1.2.3