More Gehennom filler level variance
This commit is contained in:
+98
-12
@@ -82,16 +82,90 @@ end
|
|||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
|
function rnd_halign()
|
||||||
|
local aligns = { "half-left", "center", "half-right" };
|
||||||
|
return aligns[math.random(1, #aligns)];
|
||||||
|
end
|
||||||
|
|
||||||
|
function rnd_valign()
|
||||||
|
local aligns = { "top", "center", "bottom" };
|
||||||
|
return aligns[math.random(1, #aligns)];
|
||||||
|
end
|
||||||
|
|
||||||
|
-- the prefab maps must have contents-function, or populatemaze()
|
||||||
|
-- puts the stuff only inside the prefab map.
|
||||||
|
local hell_prefabs = {
|
||||||
|
function ()
|
||||||
|
des.map({ halign = rnd_halign(), valign = "center", map = [[
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......
|
||||||
|
......]], contents = function() end });
|
||||||
|
end,
|
||||||
|
function ()
|
||||||
|
des.map({ halign = rnd_halign(), valign = "center", map = [[
|
||||||
|
xxxxxx.....xxxxxx
|
||||||
|
xxxx.........xxxx
|
||||||
|
xx.............xx
|
||||||
|
xx.............xx
|
||||||
|
x...............x
|
||||||
|
x...............x
|
||||||
|
.................
|
||||||
|
.................
|
||||||
|
.................
|
||||||
|
.................
|
||||||
|
.................
|
||||||
|
x...............x
|
||||||
|
x...............x
|
||||||
|
xx.............xx
|
||||||
|
xx.............xx
|
||||||
|
xxxx.........xxxx
|
||||||
|
xxxxxx.....xxxxxx
|
||||||
|
]], contents = function() end });
|
||||||
|
end,
|
||||||
|
function ()
|
||||||
|
des.map({ halign = "center", valign = "center", map = [[
|
||||||
|
..............................................................
|
||||||
|
..............................................................
|
||||||
|
..............................................................
|
||||||
|
..............................................................
|
||||||
|
..............................................................]], contents = function() end });
|
||||||
|
end,
|
||||||
|
function ()
|
||||||
|
des.map({ halign = rnd_halign(), valign = rnd_valign(), lit = true, map = [[
|
||||||
|
x.....x
|
||||||
|
.......
|
||||||
|
.......
|
||||||
|
.......
|
||||||
|
.......
|
||||||
|
.......
|
||||||
|
x.....x]], contents = function() end });
|
||||||
|
end,
|
||||||
|
};
|
||||||
|
|
||||||
|
function rnd_hell_prefab()
|
||||||
|
local pf = math.random(1, #hell_prefabs);
|
||||||
|
hell_prefabs[pf]();
|
||||||
|
end
|
||||||
|
|
||||||
-- TODO: cold hells? (ice & water instead of lava. sometimes floor = ice)
|
-- TODO: cold hells? (ice & water instead of lava. sometimes floor = ice)
|
||||||
-- TODO: more hell_tweaks:
|
|
||||||
-- - replacing walls with iron bars
|
|
||||||
-- - random prefab areas
|
|
||||||
-- - replace all walls (in a full level width/height) in a small area
|
|
||||||
|
|
||||||
hells = {
|
hells = {
|
||||||
-- 1: "mines" style with lava
|
-- 1: "mines" style with lava
|
||||||
function ()
|
function ()
|
||||||
des.level_init({ style = "solidfill", fg = " " });
|
des.level_init({ style = "solidfill", fg = " ", lit = 0 });
|
||||||
des.level_flags("mazelevel", "noflip");
|
des.level_flags("mazelevel", "noflip");
|
||||||
des.level_init({ style="mines", fg=".", smoothed=true ,joined=true, lit=0, walled=true });
|
des.level_init({ style="mines", fg=".", smoothed=true ,joined=true, lit=0, walled=true });
|
||||||
des.replace_terrain({ fromterrain = " ", toterrain = "L" });
|
des.replace_terrain({ fromterrain = " ", toterrain = "L" });
|
||||||
@@ -102,37 +176,50 @@ hells = {
|
|||||||
|
|
||||||
-- 2: mazes like original, with some hell_tweaks
|
-- 2: mazes like original, with some hell_tweaks
|
||||||
function ()
|
function ()
|
||||||
|
des.level_init({ style = "solidfill", fg = " ", lit = 0 });
|
||||||
des.level_flags("mazelevel", "noflip");
|
des.level_flags("mazelevel", "noflip");
|
||||||
des.level_init({ style = "mazegrid", bg = "-" });
|
des.level_init({ style = "mazegrid", bg = "-" });
|
||||||
des.mazewalk(01,10,"east");
|
des.mazewalk({ coord = {01,10}, dir = "east", stocked = false});
|
||||||
local tmpbounds = selection.match("-");
|
local tmpbounds = selection.match("-");
|
||||||
local bnds = tmpbounds:bounds();
|
local bnds = tmpbounds:bounds();
|
||||||
local protected_area = selection.fillrect(bnds.lx, bnds.ly + 1, bnds.hx - 2, bnds.hy - 1);
|
local protected_area = selection.fillrect(bnds.lx, bnds.ly + 1, bnds.hx - 2, bnds.hy - 1);
|
||||||
hell_tweaks(protected_area:negate());
|
hell_tweaks(protected_area:negate());
|
||||||
|
if (percent(25)) then
|
||||||
|
rnd_hell_prefab();
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- 3: mazes, style 1: wall thick = 1, random wid corr
|
-- 3: mazes, style 1: wall thick = 1, random wid corr
|
||||||
function ()
|
function ()
|
||||||
des.level_init({ style = "solidfill", fg = " " });
|
des.level_init({ style = "solidfill", fg = " ", lit = 0 });
|
||||||
des.level_flags("mazelevel", "noflip");
|
des.level_flags("mazelevel", "noflip");
|
||||||
des.level_init({ style = "maze", wallthick = 1 });
|
des.level_init({ style = "maze", wallthick = 1 });
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- 4: mazes, style 2: replace wall with iron bars of lava
|
-- 4: mazes, style 2: replace wall with iron bars or lava
|
||||||
function ()
|
function ()
|
||||||
des.level_init({ style = "solidfill", fg = " " });
|
local cwid = math.random(4);
|
||||||
|
des.level_init({ style = "solidfill", fg = " ", lit = 0 });
|
||||||
des.level_flags("mazelevel", "noflip");
|
des.level_flags("mazelevel", "noflip");
|
||||||
des.level_init({ style = "maze", wallthick = 1 });
|
des.level_init({ style = "maze", wallthick = 1, corrwid = cwid });
|
||||||
local outside_walls = selection.match(" ");
|
local outside_walls = selection.match(" ");
|
||||||
local wallterrain = { "F", "L" };
|
local wallterrain = { "F", "L" };
|
||||||
shuffle(wallterrain);
|
shuffle(wallterrain);
|
||||||
des.replace_terrain({ mapfragment = "w", toterrain = wallterrain[1] });
|
des.replace_terrain({ mapfragment = "w", toterrain = wallterrain[1] });
|
||||||
|
if (cwid == 1) then
|
||||||
|
if (wallterrain[1] == "F" and percent(80)) then
|
||||||
|
-- replace some horizontal iron bars walls with floor
|
||||||
|
des.replace_terrain({ mapfragment = ".\nF\n.", toterrain = ".", chance = 25 * math.random(4) });
|
||||||
|
elseif (percent(25)) then
|
||||||
|
rnd_hell_prefab();
|
||||||
|
end
|
||||||
|
end
|
||||||
des.terrain(outside_walls, " "); -- return the outside back to solid wall
|
des.terrain(outside_walls, " "); -- return the outside back to solid wall
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- 5: mazes, thick walls, occasionally lava instead of walls
|
-- 5: mazes, thick walls, occasionally lava instead of walls
|
||||||
function ()
|
function ()
|
||||||
des.level_init({ style = "solidfill", fg = " " });
|
des.level_init({ style = "solidfill", fg = " ", lit = 0 });
|
||||||
des.level_flags("mazelevel", "noflip");
|
des.level_flags("mazelevel", "noflip");
|
||||||
des.level_init({ style = "maze", wallthick = 1 + math.random(2), corrwid = math.random(2) });
|
des.level_init({ style = "maze", wallthick = 1 + math.random(2), corrwid = math.random(2) });
|
||||||
if (percent(50)) then
|
if (percent(50)) then
|
||||||
@@ -151,5 +238,4 @@ hells[hellno]();
|
|||||||
des.stair("up")
|
des.stair("up")
|
||||||
des.stair("down")
|
des.stair("down")
|
||||||
|
|
||||||
des.region(selection.area(00,00,77,21),"unlit");
|
|
||||||
populatemaze();
|
populatemaze();
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ the map are not relative to it.
|
|||||||
| halign | Horizontal alignment on a rough 3x3 grid.
|
| halign | Horizontal alignment on a rough 3x3 grid.
|
||||||
| valign | Vertical alignment on a rough 3x3 grid.
|
| valign | Vertical alignment on a rough 3x3 grid.
|
||||||
| map | Multi-line string describing the map. See <<_map_characters>>
|
| map | Multi-line string describing the map. See <<_map_characters>>
|
||||||
|
| lit | Boolean. Are the map grids lit? Default is false.
|
||||||
| contents | A function called with one parameter, a table with "width" and "height", the map width and height. All coordinates in the function will be relative to the map.
|
| contents | A function called with one parameter, a table with "width" and "height", the map width and height. All coordinates in the function will be relative to the map.
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -6494,6 +6494,7 @@ TODO: gc.coder->croom needs to be updated
|
|||||||
boolean has_contents = FALSE;
|
boolean has_contents = FALSE;
|
||||||
int tryct = 0;
|
int tryct = 0;
|
||||||
int ox, oy;
|
int ox, oy;
|
||||||
|
boolean lit = FALSE;
|
||||||
struct selectionvar *sel;
|
struct selectionvar *sel;
|
||||||
|
|
||||||
create_des_coder();
|
create_des_coder();
|
||||||
@@ -6512,6 +6513,7 @@ TODO: gc.coder->croom needs to be updated
|
|||||||
tb = t_or_b2i[get_table_option(L, "valign", "none", top_or_bot)];
|
tb = t_or_b2i[get_table_option(L, "valign", "none", top_or_bot)];
|
||||||
get_table_xy_or_coord(L, &x, &y);
|
get_table_xy_or_coord(L, &x, &y);
|
||||||
tmpstr = get_table_str(L, "map");
|
tmpstr = get_table_str(L, "map");
|
||||||
|
lit = (boolean) get_table_boolean_opt(L, "lit", FALSE);
|
||||||
lua_getfield(L, 1, "contents");
|
lua_getfield(L, 1, "contents");
|
||||||
if (lua_type(L, -1) == LUA_TFUNCTION) {
|
if (lua_type(L, -1) == LUA_TFUNCTION) {
|
||||||
lua_remove(L, -2);
|
lua_remove(L, -2);
|
||||||
@@ -6677,7 +6679,7 @@ TODO: gc.coder->croom needs to be updated
|
|||||||
continue;
|
continue;
|
||||||
selection_setpoint(x, y, sel, 1);
|
selection_setpoint(x, y, sel, 1);
|
||||||
levl[x][y].typ = mptyp;
|
levl[x][y].typ = mptyp;
|
||||||
levl[x][y].lit = FALSE;
|
levl[x][y].lit = lit;
|
||||||
/* clear out levl: load_common_data may set them */
|
/* clear out levl: load_common_data may set them */
|
||||||
levl[x][y].flags = 0;
|
levl[x][y].flags = 0;
|
||||||
levl[x][y].horizontal = 0;
|
levl[x][y].horizontal = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user