Attached Files |
0001-Move-Gehenna-building-generation-to-theme.lua.patch [^] (5,150 bytes) 2014-07-07 20:36 [Show Content] [Hide Content]From e7c8b850fa580791471833b1522b2ed913aeb968 Mon Sep 17 00:00:00 2001
From: infiniplex <infiniplex@hotmail.com>
Date: Mon, 7 Jul 2014 11:35:28 -0600
Subject: [PATCH 1/2] Move Gehenna building generation to theme.lua
---
crawl-ref/source/dat/des/builder/layout_pools.des | 36 +-------------------
crawl-ref/source/dat/dlua/layout/theme.lua | 41 +++++++++++++++++++++++
2 files changed, 42 insertions(+), 35 deletions(-)
diff --git a/crawl-ref/source/dat/des/builder/layout_pools.des b/crawl-ref/source/dat/des/builder/layout_pools.des
index 3afdd4b..e7591e7 100644
--- a/crawl-ref/source/dat/des/builder/layout_pools.des
+++ b/crawl-ref/source/dat/des/builder/layout_pools.des
@@ -71,41 +71,7 @@
contents = pool_contents }
-- add some random rooms
- local border = 4
- local gxm, gym = dgn.max_bounds()
- local right = gxm - 1 - border
- local bottom = gym - 1 - border
- local size_max = 6 + 4 * depth_fraction
- local separation_min = crawl.random_range(1, border - depth_fraction*2)
-
- local room_count_min = (150 + depth_fraction * 850) / size_max
- local room_count_max = (300 + depth_fraction * 1700) / size_max
- for i = 1, crawl.random_range(room_count_min, room_count_max) do
- local size = crawl.random_range(4, size_max)
- local min_x = crawl.random_range(border, right - size)
- local min_y = crawl.random_range(border, bottom - size)
- local max_x = min_x + size
- local max_y = min_y + size
-
- local cell_count = size * size
- local wall_count = e.count_feature_in_box {x1 = min_x, x2 = max_x,
- y1 = min_y, y2 = max_y,
- feat = "xv" }
- local blocked = e.find_in_area {x1 = min_x - separation_min,
- x2 = max_x + separation_min,
- y1 = min_y - separation_min,
- y2 = max_y + separation_min,
- find = "c", find_vault = true }
- if not blocked and wall_count < cell_count
- and wall_count >= cell_count * 0.5 then
- local door_count = crawl.random_range(1, 3)
- e.make_round_box {x1 = min_x, x2 = max_x,
- y1 = min_y, y2 = max_y,
- floor = '.', wall = 'c',
- door_count = door_count, veto_gates=true,
- veto_if_no_doors=true }
- end
- end
+ theme.add_gehenna_buildings(e)
-- clean up the map
e.widen_paths { find = "v", percent = 90 }
diff --git a/crawl-ref/source/dat/dlua/layout/theme.lua b/crawl-ref/source/dat/dlua/layout/theme.lua
index 514b609..5dd8d16 100644
--- a/crawl-ref/source/dat/dlua/layout/theme.lua
+++ b/crawl-ref/source/dat/dlua/layout/theme.lua
@@ -82,3 +82,44 @@ function theme.room_material(wall_type)
}
end
+
+-- Get a random weighted material for rooms in room layouts
+function theme.add_gehenna_buildings(e)
+
+ local depth_fraction = you.depth_fraction()
+ local border = 4
+ local gxm, gym = dgn.max_bounds()
+ local right = gxm - 1 - border
+ local bottom = gym - 1 - border
+ local size_max = 6 + 4 * depth_fraction
+ local separation_min = crawl.random_range(1, border - depth_fraction*2)
+
+ local room_count_min = (150 + depth_fraction * 850) / size_max
+ local room_count_max = (300 + depth_fraction * 1700) / size_max
+ for i = 1, crawl.random_range(room_count_min, room_count_max) do
+ local size = crawl.random_range(4, size_max)
+ local min_x = crawl.random_range(border, right - size)
+ local min_y = crawl.random_range(border, bottom - size)
+ local max_x = min_x + size
+ local max_y = min_y + size
+
+ local cell_count = size * size
+ local wall_count = e.count_feature_in_box {x1 = min_x, x2 = max_x,
+ y1 = min_y, y2 = max_y,
+ feat = "xv" }
+ local blocked = e.find_in_area {x1 = min_x - separation_min,
+ x2 = max_x + separation_min,
+ y1 = min_y - separation_min,
+ y2 = max_y + separation_min,
+ find = "c", find_vault = true }
+ if not blocked and wall_count < cell_count
+ and wall_count >= cell_count * 0.5 then
+ local door_count = crawl.random_range(1, 3)
+ e.make_round_box {x1 = min_x, x2 = max_x,
+ y1 = min_y, y2 = max_y,
+ floor = '.', wall = 'c',
+ door_count = door_count, veto_gates=true,
+ veto_if_no_doors=true }
+ end
+ end
+end
--
1.8.1.2
0002-Rework-layout_gehenna_lava_caves.patch [^] (3,323 bytes) 2014-07-07 20:37 [Show Content] [Hide Content]From f1eb180f6958cd8034759321af0375d6b7c98ef4 Mon Sep 17 00:00:00 2001
From: infiniplex <infiniplex@hotmail.com>
Date: Mon, 7 Jul 2014 12:25:50 -0600
Subject: [PATCH 2/2] Rework layout_gehenna_lava_caves
---
crawl-ref/source/dat/des/builder/layout_caves.des | 42 ++++++++++++++++++-----
1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/crawl-ref/source/dat/des/builder/layout_caves.des b/crawl-ref/source/dat/des/builder/layout_caves.des
index 04e409e..1032423 100644
--- a/crawl-ref/source/dat/des/builder/layout_caves.des
+++ b/crawl-ref/source/dat/des/builder/layout_caves.des
@@ -504,7 +504,8 @@ ENDMAP
##############################################################
# layout_gehenna_lava_caves
#
-# TODO: Add round buildings, depth convergence.
+# Basically perlin noise, with rock and lava at the extreme
+# values. The middle values become the paths.
#
NAME: layout_gehenna_lava_caves
DEPTH: Geh
@@ -516,7 +517,16 @@ TAGS: overwritable layout allow_dup unrand layout_type_narrow_caves
local gxm,gym = dgn.max_bounds()
extend_map { width = gxm, height = gym, fill = 'x' }
- local scale = util.random_range_real(.3,1.8)
+
+ -- choose some parameters based on depth
+ local depth_fraction = you.depth_fraction()
+ local scale = 1.6 - crawl.random_real() * 0.3 - depth_fraction * 0.4
+ local padding = crawl.random_range(6, 10)
+ local wall_break = 0.05 + crawl.random_real() * 0.05 + depth_fraction * 0.1
+ local lava_break = 0.15 + crawl.random_real() * 0.1 + depth_fraction * 0.15
+ local open_break = 0.55 + crawl.random_real() * 0.05 + depth_fraction * 0.15
+
+ -- set up the main perlin noise function
local perlin1 = procedural.simplex3d { scale = scale }
if crawl.coinflip() then
perlin1 = procedural.distort {
@@ -527,23 +537,39 @@ TAGS: overwritable layout allow_dup unrand layout_type_narrow_caves
}
end
- local padding = crawl.random_range(5,12)
+ -- set up the edges for the map
+ local boundary = 8
+ local min_hard = boundary
+ local min_padded = boundary + padding
+ local max_padded_x = gxm - 1 - boundary - padding
+ local max_hard_x = gxm - 1 - boundary
+ local max_padded_y = gym - 1 - boundary - padding
+ local max_hard_y = gym - 1 - boundary
+ -- render the map
for x = 1,gxm-2,1 do
for y = 1,gym-2,1 do
- local val = perlin1(x,y) * procedural.boundary_map(x,1,padding,gxm-2-padding,gxm-2) * procedural.boundary_map(y,1,padding,gym-2-padding,gym-2)
- if val < 0.1 then
+ local val = perlin1(x, y)
+ * procedural.boundary_map(x, min_hard, min_padded,
+ max_padded_x, max_hard_x)
+ * procedural.boundary_map(y, min_hard, min_padded,
+ max_padded_y, max_hard_y)
+ if val < wall_break then
mapgrd[x][y] = "x"
- elseif val < 0.25 then
+ elseif val < lava_break then
mapgrd[x][y] = "l"
- elseif val < 0.6 then
+ elseif val < open_break then
mapgrd[x][y] = "."
+ else
+ -- leave as 'x'
end
end
end
+ -- assorted fixups
+ theme.add_gehenna_buildings(_G)
zonify.map_fill_zones(_G, 1, 'l')
-
+ zonify.map_fill_lava_zones(_G, 1, 'x')
}}
MAP
ENDMAP
--
1.8.1.2
layout_gehenna_lava_caves.png [^] (27,041 bytes) 2014-07-07 20:37
|