Attached Files |
0001-Modified-layout_dis-to-a-max-1-door-per-room-wall.patch [^] (4,274 bytes) 2013-04-24 02:50 [Show Content] [Hide Content]From 8a9414e6ee2866d6e80b95f7b04c22437c68984e Mon Sep 17 00:00:00 2001
From: infiniplex <infiniplex@hotmail.com>
Date: Tue, 23 Apr 2013 18:28:06 -0600
Subject: [PATCH 1/2] Modified layout_dis to a max 1 door per room wall
---
crawl-ref/source/dat/des/builder/layout.des | 83 +++++++++++++++++++++--------
1 file changed, 61 insertions(+), 22 deletions(-)
diff --git a/crawl-ref/source/dat/des/builder/layout.des b/crawl-ref/source/dat/des/builder/layout.des
index 9488bda..0e53b1e 100644
--- a/crawl-ref/source/dat/des/builder/layout.des
+++ b/crawl-ref/source/dat/des/builder/layout.des
@@ -1192,7 +1192,7 @@ TAGS: overwritable layout allow_dup unrand
{{
local subdivide_threshold = 12
- -- Create the alternate version? (based on techniques used in layout_honeycomb)
+ -- Create the alternate version?
local alt = crawl.x_chance_in_y(2,3)
function room(x1, y1, x2, y2)
@@ -1252,6 +1252,52 @@ TAGS: overwritable layout allow_dup unrand
end
end
+ function is_empty_wall_x(x, y)
+ -- check in -X direction for irregularities before corner
+ local x1 = x
+ while mapgrd[x1][y + 1] == '.' and mapgrd[x1][y - 1] == '.' do
+ if mapgrd[x1][y] ~= 'x' then
+ return false
+ end
+ x1 = x1 - 1
+ end
+
+ -- check in +X direction for irregularities before corner
+ local x1 = x
+ while mapgrd[x1][y + 1] == '.' and mapgrd[x1][y - 1] == '.' do
+ if mapgrd[x1][y] ~= 'x' then
+ return false
+ end
+ x1 = x1 + 1
+ end
+
+ -- otherwise, good
+ return true
+ end
+
+ function is_empty_wall_y(x, y)
+ -- check in -Y direction for irregularities before corner
+ local y1 = y
+ while mapgrd[x + 1][y1] == '.' and mapgrd[x - 1][y1] == '.' do
+ if mapgrd[x][y1] ~= 'x' then
+ return false
+ end
+ y1 = y1 - 1
+ end
+
+ -- check in +Y direction for irregularities before corner
+ local y1 = y
+ while mapgrd[x + 1][y1] == '.' and mapgrd[x - 1][y1] == '.' do
+ if mapgrd[x][y1] ~= 'x' then
+ return false
+ end
+ y1 = y1 + 1
+ end
+
+ -- otherwise, good
+ return true
+ end
+
local gxm, gym = dgn.max_bounds()
extend_map{width = gxm, height = gym, fill = 'x'}
@@ -1264,28 +1310,21 @@ TAGS: overwritable layout allow_dup unrand
local connection = crawl.random_element({[fill] = 1, ["+"] = 4})
-- Alternate version, connect rooms at the end.
- -- TODO: There is an identical loop in layout_homeycomb with different
- -- iteration count; move this to a library or C++.
if alt then
- for i = 1, crawl.random_range(400, 800) do
- local x = crawl.random_range(1, gxm - 2)
- local y = crawl.random_range(1, gym - 2)
-
- if mapgrd[x][y] == border then
- if mapgrd[x + 1][y] == border and
- mapgrd[x - 1][y] == border and
- mapgrd[x][y + 1] == fill and
- mapgrd[x][y - 1] == fill then
- mapgrd[x][y] = connection
- elseif mapgrd[x + 1][y] == fill and
- mapgrd[x - 1][y] == fill and
- mapgrd[x][y + 1] == border and
- mapgrd[x][y - 1] == border then
- mapgrd[x][y] = connection
- end
- end
- end
- zonify.map_fill_zones(_G, 1, 'x')
+ for i = 1, crawl.random_range(400, 800) do
+ local x = crawl.random_range(1, gxm - 2)
+ local y = crawl.random_range(1, gym - 2)
+ if mapgrd[x][y] == 'x' then
+ if mapgrd[x][y + 1] == '.' and mapgrd[x][y - 1] == '.'
+ and is_empty_wall_x(x, y) then
+ mapgrd[x][y] = '+'
+ elseif mapgrd[x + 1][y] == '.' and mapgrd[x - 1][y] == '.'
+ and is_empty_wall_y(x, y) then
+ mapgrd[x][y] = '+'
+ end
+ end
+ end
+ zonify.map_fill_zones(_G, 1, 'x')
end
}}
# Enforce minimum floor size - this is important with the alt version
--
1.8.1.2
0002-Forbid-layout_dis-placing-adjacent-statues.patch [^] (1,562 bytes) 2013-04-24 02:51 [Show Content] [Hide Content]From 13738bf0f333c5b89b5c301d9f150edd7df6e251 Mon Sep 17 00:00:00 2001
From: infiniplex <infiniplex@hotmail.com>
Date: Tue, 23 Apr 2013 18:31:12 -0600
Subject: [PATCH 2/2] Forbid layout_dis placing adjacent statues
---
crawl-ref/source/dat/des/builder/layout.des | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/crawl-ref/source/dat/des/builder/layout.des b/crawl-ref/source/dat/des/builder/layout.des
index 0e53b1e..1ddd409 100644
--- a/crawl-ref/source/dat/des/builder/layout.des
+++ b/crawl-ref/source/dat/des/builder/layout.des
@@ -1204,10 +1204,15 @@ TAGS: overwritable layout allow_dup unrand
-- decorative statues
local x3 = crawl.random_range(x1+2, x2-2)
local y3 = crawl.random_range(y1+2, y2-2)
- mapgrd[x3][y3] = 'G'
- mapgrd[x1+x2-x3][y3] = 'G'
- mapgrd[x3][y1+y2-y3] = 'G'
- mapgrd[x1+x2-x3][y1+y2-y3] = 'G'
+ local x4 = x1+x2-x3
+ local y4 = y1+y2-y3
+
+ if math.abs(x3 - x4) ~= 1 and math.abs(y3 - y4) ~= 1 then
+ mapgrd[x3][y3] = 'G'
+ mapgrd[x4][y3] = 'G'
+ mapgrd[x3][y4] = 'G'
+ mapgrd[x4][y4] = 'G'
+ end
end
if (x1+x2) % 2 == 0 and (y1+y2) % 2 == 0
@@ -1333,6 +1338,8 @@ validate {{
}}
COLOUR: G : cyan
TILE: G = dngn_statue_iron_golem
+MAP
+ENDMAP
# Dummy layouts that just call C++ functions that do all the work.
NAME: layout_basic
--
1.8.1.2
|