Attached Files:
|
0001-Improved-algorithm-to-place-multiple-doors-on-long-w.patch [^] (7,933 bytes) 2014-08-08 05:29 [Show Content] [Hide Content]From 5a30ac30eae2f113ed5a06aa6752db144b9c7d4f Mon Sep 17 00:00:00 2001
From: infiniplex <infiniplex@hotmail.com>
Date: Thu, 7 Aug 2014 21:19:13 -0600
Subject: [PATCH] Improved algorithm to place multiple doors on long walls
---
crawl-ref/source/dat/des/builder/layout.des | 7 ++-----
crawl-ref/source/dat/des/builder/layout_city.des | 9 +++++----
.../dat/des/builder/layout_overlapping_boxes.des | 2 +-
crawl-ref/source/dat/des/builder/layout_pools.des | 9 +++++----
crawl-ref/source/l_dgnbld.cc | 23 +++++++++++-----------
5 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/crawl-ref/source/dat/des/builder/layout.des b/crawl-ref/source/dat/des/builder/layout.des
index ad2af7f..ab9ef0a 100644
--- a/crawl-ref/source/dat/des/builder/layout.des
+++ b/crawl-ref/source/dat/des/builder/layout.des
@@ -1456,18 +1456,15 @@ TAGS: no_rotate no_vmirror no_hmirror
local gxm, gym = dgn.max_bounds()
extend_map{width = gxm, height = gym, fill = 'x'}
- fill_area{fill = 'x'}
+ fill_area { fill = 'x' }
fill_area { x1=8, y1=8, x2=gxm-9, y2=gym-9, fill="." }
fill(7, 7, gxm-8, gym-8, 0)
- local border,fill = 'x','.'
- local connection = crawl.random_element({[fill] = 1, ["+"] = 4})
-
-- Alternate version, connect rooms at the end.
if alt then
connect_adjacent_rooms { max = crawl.random_range(500, 750),
- min = 250, replace = '+', check_empty = true }
+ min = 250, replace = '+' }
zonify.map_fill_zones(_G, 1, 'x')
end
}}
diff --git a/crawl-ref/source/dat/des/builder/layout_city.des b/crawl-ref/source/dat/des/builder/layout_city.des
index 883f4a4..e6c6b69 100644
--- a/crawl-ref/source/dat/des/builder/layout_city.des
+++ b/crawl-ref/source/dat/des/builder/layout_city.des
@@ -223,9 +223,10 @@ TAGS: overwritable layout allow_dup unrand layout_type_city
end
-- Create doors
- connect_adjacent_rooms { replace = "+", min = 100, max = 400, check_empty = true }
+ connect_adjacent_rooms { replace = "+", min = 100, max = 400 }
-- Create a small number of extra doors (allowing more than one door on some wall)
- connect_adjacent_rooms { replace = "+", min = 0, max = 10 }
+ connect_adjacent_rooms { replace = "+", min = 0, max = 400,
+ check_distance = 3 }
-- Fill disconnects
zonify.map_fill_zones(_G, 1, 'x')
@@ -517,8 +518,8 @@ TAGS: unrand no_rotate no_hmirror no_vmirror
end
-- the map is already connected in a tree, but more doors is nice
- connect_adjacent_rooms { max = crawl.random_range(100, 250),
- min = 50, replace = '+', check_empty = true }
+ connect_adjacent_rooms { min = 200, max = 500, replace = '+',
+ check_distance = crawl.random_range(5, 8) }
}}
MAP
ENDMAP
diff --git a/crawl-ref/source/dat/des/builder/layout_overlapping_boxes.des b/crawl-ref/source/dat/des/builder/layout_overlapping_boxes.des
index 105b74b..90a7a3d 100644
--- a/crawl-ref/source/dat/des/builder/layout_overlapping_boxes.des
+++ b/crawl-ref/source/dat/des/builder/layout_overlapping_boxes.des
@@ -54,7 +54,7 @@ TAGS: no_rotate no_vmirror no_hmirror
end
connect_adjacent_rooms { wall = "x", floor = ".", replace = '+',
- max = 1000, check_empty = true }
+ max = 1000 }
zonify.map_fill_zones(_G, 1, 'x')
}}
# Enforce minimum floor size
diff --git a/crawl-ref/source/dat/des/builder/layout_pools.des b/crawl-ref/source/dat/des/builder/layout_pools.des
index 4c32605..86de08d 100644
--- a/crawl-ref/source/dat/des/builder/layout_pools.des
+++ b/crawl-ref/source/dat/des/builder/layout_pools.des
@@ -148,6 +148,9 @@ ENDMAP
# directly beside each other. They are sometimes connected
# by doors and sometimes just by holes in the wall.
#
+# TODO: Bigger pools and more doors on Depths to reduce
+# connectivity failures when adding vaults
+#
NAME: layout_honeycomb
DEPTH: Snake:1-4, Depths, Tar
WEIGHT: 10 (Snake), 15 (Depths), 10 (Tar)
@@ -176,12 +179,10 @@ TAGS: no_rotate no_vmirror no_hmirror
pool_size = 25 + crawl.random2(25),
border = 'x' }
connect_adjacent_rooms { wall = "x", floor = ".", replace = connection,
- min = 900, max = 1300, check_empty = true }
- connect_adjacent_rooms { wall = "x", floor = ".", replace = connection,
- min = 100, max = 200, check_empty = false }
+ min = 1000, max = 1500, check_distance = 3 }
zonify.map_fill_zones(_G, 1, 'x')
- if connection == '.' and you.in_branch("D") then
+ if connection == '.' and you.in_branch("Depths") then
theme.D.caves(_G)
else
theme.level_material(_G)
diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc
index f420fcc..7114ea4 100644
--- a/crawl-ref/source/l_dgnbld.cc
+++ b/crawl-ref/source/l_dgnbld.cc
@@ -312,7 +312,8 @@ static vector<char> _pool_fill_glyphs_from_table(lua_State *ls,
static bool _wall_is_empty(map_lines &lines,
int x, int y,
const char* wall, const char* floor,
- bool horiz = false)
+ bool horiz = false,
+ int max_check = 9999)
{
coord_def normal(horiz ? 0 : 1, horiz ? 1 : 0);
for (int d = 1; d >= -1; d-=2)
@@ -320,7 +321,7 @@ static bool _wall_is_empty(map_lines &lines,
coord_def length(horiz ? d : 0, horiz ? 0 : d);
int n = 1;
- while (true)
+ while (n <= max_check)
{
coord_def pos(x + length.x*n,y + length.y*n);
if (!lines.in_bounds(coord_def(pos.x + normal.x, pos.y + normal.y))
@@ -341,7 +342,7 @@ static bool _wall_is_empty(map_lines &lines,
}
}
- // hit the edge of the map, so this is good
+ // hit the end of the wall, so this is good
return true;
}
@@ -1433,7 +1434,7 @@ LUAFN(dgn_connect_adjacent_rooms)
TABLE_CHAR(ls, replace, '.');
TABLE_INT(ls, max, 1);
TABLE_INT(ls, min, max);
- TABLE_BOOL(ls, check_empty, false);
+ TABLE_INT(ls, check_distance, 9999);
int x1, y1, x2, y2;
if (!_coords(ls, lines, x1, y1, x2, y2))
@@ -1450,10 +1451,10 @@ LUAFN(dgn_connect_adjacent_rooms)
y2 = lines.height() - 2;
if (min < 0)
- return luaL_error(ls, "Invalid min connections: %i", min);
+ return luaL_error(ls, "Invalid min connections: %d", min);
if (max < min)
{
- return luaL_error(ls, "Invalid max connections: %i (min is %i)",
+ return luaL_error(ls, "Invalid max connections: %d (min is %d)",
max, min);
}
@@ -1474,17 +1475,15 @@ LUAFN(dgn_connect_adjacent_rooms)
{
if (strchr(floor, lines(x, y - 1))
&& strchr(floor, lines(x, y + 1))
- && (check_empty ? _wall_is_empty(lines, x, y, wall, floor, true)
- : (strchr(wall, lines(x - 1, y))
- && strchr(wall, lines(x + 1, y)))))
+ && (_wall_is_empty(lines, x, y, wall, floor,
+ true, check_distance)))
{
lines(*ri) = replace;
}
else if (strchr(floor, lines(x - 1, y))
&& strchr(floor, lines(x + 1, y))
- && (check_empty ? _wall_is_empty(lines, x, y, wall, floor, false)
- : (strchr(wall, lines(x, y - 1))
- && strchr(wall, lines(x, y + 1)))))
+ && (_wall_is_empty(lines, x, y, wall, floor,
+ false, check_distance)))
{
lines(*ri) = replace;
}
--
1.8.1.2
0001-Re-added-layout_onion_city-to-Elf-with-better-window.patch [^] (3,616 bytes) 2014-09-04 00:38 [Show Content] [Hide Content]From 31af729aea24afada02da56b9bec6fb05206855b Mon Sep 17 00:00:00 2001
From: infiniplex <infiniplex@hotmail.com>
Date: Wed, 3 Sep 2014 16:34:27 -0600
Subject: [PATCH] Re-added layout_onion_city to Elf with better windows
---
crawl-ref/source/dat/des/builder/layout_city.des | 63 +++++++++++++++++++++++-
1 file changed, 61 insertions(+), 2 deletions(-)
diff --git a/crawl-ref/source/dat/des/builder/layout_city.des b/crawl-ref/source/dat/des/builder/layout_city.des
index e6c6b69..4d3a724 100644
--- a/crawl-ref/source/dat/des/builder/layout_city.des
+++ b/crawl-ref/source/dat/des/builder/layout_city.des
@@ -351,8 +351,8 @@ ENDMAP
# A map with many boxes for rooms, mostly inside each other.
#
NAME: layout_onion_city
-DEPTH: Pan
-WEIGHT: 5
+DEPTH: Elf, Pan
+WEIGHT: 10 (Elf), 5 (Pan)
ORIENT: encompass
TAGS: overwritable layout allow_dup unrand layout_type_city
TAGS: unrand no_rotate no_hmirror no_vmirror
@@ -474,6 +474,60 @@ TAGS: unrand no_rotate no_hmirror no_vmirror
end
end
+ -- This function adds windows to walls near doors
+ function add_windows (x1, y1, x2, y2, window_chance)
+ for x = x1, x2 do
+ for y = y1, y2 do
+ if (mapgrd[x][y] == '+') then
+ local xmm = x - 2
+ local xm = x - 1
+ local xp = x + 1
+ local xpp = x + 2
+ local ymm = y - 2
+ local ym = y - 1
+ local yp = y + 1
+ local ypp = y + 2
+
+ if (mapgrd[xm][y] == '.' and mapgrd[xp][y] == '.') then
+ -- north window
+ if (mapgrd[xm][ym ] == '.' and
+ mapgrd[x ][ym ] == 'x' and mapgrd[xp][ym ] == '.' and
+ mapgrd[xm][ymm] == '.' and
+ mapgrd[x ][ymm] == 'x' and mapgrd[xp][ymm] == '.' and
+ crawl.random_real() < window_chance) then
+ mapgrd[x][ymm] = 'm'
+ end
+ -- south window
+ if (mapgrd[xm][yp ] == '.' and
+ mapgrd[x ][yp ] == 'x' and mapgrd[xp][yp ] == '.' and
+ mapgrd[xm][ypp] == '.' and
+ mapgrd[x ][ypp] == 'x' and mapgrd[xp][ypp] == '.' and
+ crawl.random_real() < window_chance) then
+ mapgrd[x][ypp] = 'm'
+ end
+ else
+ -- west window
+ if (mapgrd[xm ][ym] == '.' and
+ mapgrd[xm ][y ] == 'x' and mapgrd[xm ][yp] == '.' and
+ mapgrd[xmm][ym] == '.' and
+ mapgrd[xmm][y ] == 'x' and mapgrd[xmm][yp] == '.' and
+ crawl.random_real() < window_chance) then
+ mapgrd[xmm][y] = 'm'
+ end
+ -- easy window
+ if (mapgrd[xp ][ym] == '.' and
+ mapgrd[xp ][y ] == 'x' and mapgrd[xp ][yp] == '.' and
+ mapgrd[xpp][ym] == '.' and
+ mapgrd[xpp][y ] == 'x' and mapgrd[xpp][yp] == '.' and
+ crawl.random_real() < window_chance) then
+ mapgrd[xpp][y] = 'm'
+ end
+ end
+ end
+ end
+ end
+ end
+
local gxm, gym = dgn.max_bounds()
extend_map{width = gxm, height = gym, fill = 'x'}
@@ -520,6 +574,11 @@ TAGS: unrand no_rotate no_hmirror no_vmirror
-- the map is already connected in a tree, but more doors is nice
connect_adjacent_rooms { min = 200, max = 500, replace = '+',
check_distance = crawl.random_range(5, 8) }
+
+ -- add windows to Elf
+ if (you.in_branch("Elf")) then
+ add_windows (1, 1, gxm - 2, gym - 2, 0.2 + crawl.random_real() * 0.3)
+ end
}}
MAP
ENDMAP
--
1.8.1.2
onion-city-layouts-elf.png [^] (6,931 bytes) 2014-09-04 00:38
|