Vaults with the "layout" tag:
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5096 c06c8d41-db1a-0410-9941-cceddc491573
2C6B6QRTOK2ZMK2ZOF3EPSFUZTKG5B3IZXWBWIUYC4ZOVGQ2OV2QC NVSFIV2ZKP44XHCSCXG6OZVGL67OIFINC34J2EMKTA4KULCERUEAC 3PY3L3A4QRW3Z5Y7SHO4TMVOOP2VNCO27X2MX4DTOP2SADLBQUOAC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC D6AJOTSOJNLJBBLQC2RAQOTPJJQENNBBVNRP45CZKDUHLLZLBFFQC B7MSPF6X2RLGWN4M6ZZF3WSOPKGYPTTD7LIJVST7DXN27DG6JHNAC C22455VGUQOSUX2OORA32LROFQ7NNYDMD2ZDTTUZSAQLXK4AD6QAC ECJNCUSSE63BKED3EAYIXQCI62I76QGNHCSFO3CDWPRZF3JQP44QC PISXY4NKSKL5KDJWAHD7CTXWTQDH3NFWQSFAHUAI3VVATWKXRODQC KCHX2F3JFEWOZT3WMJVZAAQUU2QSZ5Q7RDCD7WUJ7VE65J52JFUQC MSQI3TH6T62JAXQGLL52QZCWAMC372TGB6ZNNRDGUGMJKBNNV2VAC W45PMU4HNPSAMMEBJ4XH4MTHLPVIASZT4FXTBPID5LFXKIMNUBKAC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC ZWYVZW5QFM5I2F6BLMNDDTV7FROJUHOO3O2BCBG7WSCKMKXUEMTQC UBQTNLYGD3SNWMUNGWUPX7EXEGQXOXCFCPWIVWBFE7ID7DJLPFWAC _replace_area(10, (35 - width2), (GXM - 10), (35 + width2),DNGN_ROCK_WALL, DNGN_FLOOR);_replace_area((40 - width2), 10, (40 + width2), (GYM - 10),DNGN_ROCK_WALL, DNGN_FLOOR);
bool success = _build_vaults(level_number, vault);_ensure_vault_placed(success);
spec_room sr;// circle of standing stones (well, kind of)sr.x1 = 10;sr.x2 = (GXM - 10);sr.y1 = 10;sr.y2 = (GYM - 10);_octa_room(sr, 14, DNGN_FLOOR);_replace_area(23, 23, 26, 26, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(23, 47, 26, 50, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(55, 23, 58, 26, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(55, 47, 58, 50, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(39, 20, 43, 23, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(39, 50, 43, 53, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(20, 30, 23, 33, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(20, 40, 23, 43, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(58, 30, 61, 33, DNGN_FLOOR, DNGN_STONE_WALL);_replace_area(58, 40, 61, 43, DNGN_FLOOR, DNGN_STONE_WALL);grd[35][32] = DNGN_STONE_WALL;grd[46][32] = DNGN_STONE_WALL;grd[35][40] = DNGN_STONE_WALL;grd[46][40] = DNGN_STONE_WALL;
################################################################################ layout.des: All large layout vaults go here. These are defined by having# both ORIENT: encompass and TAGS: layout. These are not true# vaults, in that the dungeon builder can add other vaults on# top of them.################################################################################lua {{function fill_area(x1, y1, x2, y2, feature)for x = x1, x2 dofor y = y1, y2 dodgn.grid(x, y, feature)endendendfunction octa_room(x1, y1, x2, y2, oblique, floor)local ob_temp = obliquelocal rock_wall = dgn.feature_number("rock_wall")local shallow_water = dgn.feature_number("shallow_water")for x = x1, x2 dofor y = y1 + ob_temp, y2 - ob_temp doif dgn.grid(x, y) == rock_wall thendgn.grid(x, y, floor)endif dgn.grid(x, y) == floor and floor == shallow_water thendgn.grid(x, y, shallow_water)endendif x > x2 - oblique thenob_temp = ob_temp + 1elseif ob_temp > 0 thenob_temp = ob_temp - 1endendendfunction pillars(center_x, center_y, num, flip_x, big_radius,pillar_radius, pillar_routine, fill)for i = 0, num - 1 dolocal angle = i * 2 * math.pi / numlocal x = math.floor(math.cos(angle) * big_radius * flip_x + 0.5)local y = math.floor(math.sin(angle) * big_radius + 0.5)pillar_routine(center_x + x, center_y + y, pillar_radius, fill)endend-- begin pillar functionsfunction pillar_square(center_x, center_y, radius, fill)for x = -radius, radius dofor y = -radius, radius dodgn.grid(center_x + x, center_y + y, fill)endendendfunction pillar_rounded_square(center_x, center_y, radius, fill)for x = -radius, radius dofor y = -radius, radius doif math.abs(x) ~= radius or math.abs(y) ~= radius thendgn.grid(center_x + x, center_y + y, fill)endendendendfunction pillar_circle(center_x, center_y, radius, fill)for x = -radius, radius dofor y = -radius, radius doif x * x + y * y < radius * radius thendgn.grid(center_x + x, center_y + y, fill)endendendend-- end pillar functionsfunction select_from_weighted_table(tb)local value = nillocal rollsize = 0for temp_val, temp_weight in pairs (tb) doif rollsize == 0 thenvalue = temp_valrollsize = temp_weightelserollsize = rollsize + temp_weightif crawl.random2(rollsize) < temp_weight thenvalue = temp_valendendendreturn valueend-- Randomly selects a grid with feature 'search' and sets it to 'replace'function replace_random(search, replace)local gxm, gym = dgn.max_bounds()local feature = nil, x, ywhile feature ~= search dox = crawl.random2(gxm)y = crawl.random2(gym)feature = dgn.grid(x, y)enddgn.grid(x, y, replace)endfunction valid(x, y)local gxm, gym = dgn.max_bounds()return (x >= 0 and y >= 0 and x < gxm and y < gym)end-- Walks from x, y along dx,dy until it finds 'search'function replace_first(x, y, dx, dy, search, replace)local feature = dgn.grid(x, y)while feature ~= search and valid(x,y) dox = x + dxy = y + dyfeature = dgn.grid(x, y)endif valid(x, y) thendgn.grid(x, y, replace)return trueelsereturn falseendend}}############################################################### layout_cross## This replaces dungeon.cc:_plan_2(). It creates a large cross# of varying width.#NAME: layout_crossORIENT: encompassTAGS: layout allow_dup{{local width = 5 - crawl.random2(5)local height = 5 - crawl.random2(5)local gxm, gym = dgn.max_bounds()local wall = dgn.feature_number("rock_wall")local floor = dgn.feature_number("floor")-- Include a small possibility of adding windows around the cross.-- This layout can get used with spotty_level, so don't make this-- chance too large as lava/water prevents that from happening.local window = crawl.one_chance_in(20)if window or crawl.one_chance_in(20) thenif crawl.coinflip() thenwall = dgn.feature_number("lava")elsewall = dgn.feature_number("deep_water")endend-- fill with rockfill_area(0, 0, gxm-1, gym-1, wall)-- create windowif window thenlocal clear = dgn.feature_number("clear_rock_wall")fill_area(10, gym/2 - height - 1, gxm - 10, gym/2 - height - 1, clear)fill_area(10, gym/2 + height + 1, gxm - 10, gym/2 + height + 1, clear)fill_area(gxm/2 - width - 1, 10, gxm/2 - width - 1, gym - 10, clear)fill_area(gxm/2 + width + 1, 10, gxm/2 + width + 1, gym - 10, clear)end-- create a crossfill_area(10, gym/2 - height, gxm - 10, gym/2 + height, floor)fill_area(gxm/2 - width, 10, gxm/2 + width, gym - 10, floor)-- TODO enne - add lua function for spotty()}}MAP.ENDMAP############################################################### layout_big_octagon## This replaces dungeon.cc:_plan_6(). It has an octagonal# room with some number of pillars in the middle. The stairs# are generally all grouped together.#NAME: layout_big_octagonORIENT: encompassTAGS: layout allow_dup{{local gxm, gym = dgn.max_bounds()local wall = dgn.feature_number("rock_wall")local floor = dgn.feature_number("floor")local oblique = 10 + crawl.random2(20)-- Step 1: Create octagonfill_area(0, 0, gxm - 1, gym - 1, wall)octa_room(10, 10, gxm - 10, gym - 10, oblique, floor)-- Step 2: Add pillars-- pillar types and relative weightslocal pillar_fill = {["rock_wall"] = 15,["green_crystal_wall"] = 5,["metal_wall"] = 4,["clear_rock_wall"] = 3,["deep_water"] = 2,["lava"] = 1,}local fill = dgn.feature_number(select_from_weighted_table(pillar_fill))-- Potential pillar drawing routineslocal pillar_func = {pillar_circle, pillar_square, pillar_rounded_square}-- Pillar size params-- NOTE: Be careful about tweaking the ranges here. Pillars that are-- too large, close, or large in number can entirely surround the center.local type = crawl.random2(#pillar_func) + 1local num = 3 + crawl.random2(9)local pillar_radius = 1 + crawl.random2(3)local circle_radius = 2 + crawl.random2(6) + pillar_radius * 2 + num / 2-- beautification hack: no "circle" pillars of radius 1if type == 1 and pillar_radius == 1 thenfill = dgn.feature_number("stone_arch")end-- Finally, make the pillarspillars(gxm/2, gym/2, num, 1, circle_radius, pillar_radius,pillar_func[type], fill)-- Step 3: Create stairs-- Potential stair locations-- 0) random-- 1) inside-- 2) up-- 3) right-- 4) down-- 5) leftlocal up_loc = crawl.random2(6)local down_loc = crawl.random2(6)while up_loc == down_loc dodown_loc = crawl.random2(6)endlocal up_stairs = {dgn.feature_number("stone_stairs_up_i"),dgn.feature_number("stone_stairs_up_ii"),dgn.feature_number("stone_stairs_up_iii"),}local down_stairs = {dgn.feature_number("stone_stairs_down_i"),dgn.feature_number("stone_stairs_down_ii"),dgn.feature_number("stone_stairs_down_iii"),}local full_stair_set = {[up_loc] = up_stairs, [down_loc] = down_stairs}for loc, stair_list in pairs (full_stair_set) dofor i = 1, #stair_list dolocal st = stair_list[i]local ret = trueif loc == 0 thenreplace_random(floor, stair_list[i])elseif loc == 1 thendgn.grid(gxm/2 + i - 2, gym/2 + 1 - math.abs(i - 2), st)elseif loc == 2 thenret = replace_first(gxm/2 + i - 2, 0, 0, 1, floor, st)elseif loc == 3 thenret = replace_first(gxm - 1, gym/2 + i - 2, -1, 0, floor, st)elseif loc == 4 thenret = replace_first(gxm/2 + i - 2, gym - 1, 0, -1, floor, st)elseif loc == 5 thenret = replace_first(0, gym/2 + i - 2, 1, 0, floor, st)endassert(ret)endend}}MAP.ENDMAP
"hive.des", "lab.des", "lair.des", "large.des", "mini.des", "orc.des","pan.des", "portal.des", "temple.des", "vaults.des", "crypt.des", "zot.des"
"hive.des", "lab.des", "lair.des", "large.des", "layout.des", "mini.des","orc.des", "pan.des", "portal.des", "temple.des", "vaults.des", "crypt.des","zot.des"