Unify all special level filling options

The existing system was a confusing mess of competing names (filled,
needfill, prefilled, etc) that had varying semantics, with prefilled
being the worst offender as it meant at least three different things in
various contexts. This commit unifies everything in the code under
"needfill", and everything in Lua under "filled", which defaults to 0
everywhere.

This also removes the second argument to fill_special_room; that
function now just checks the needfill of the room it's passed. As
before, a filled == 2 value is used for a special room to indicate that
the room should set the appropriate level flag, but shouldn't actually
be stocked with anything (for instance, King Arthur's throne room); the
difference is that this now comes directly from the lua script instead
of being manipulated within sp_lev.c.

The prefilled argument had one use case that is occasionally used in the
level files: if the level designer had specified an ordinary region with
prefilled = 1, it would become a room to control monster arrivals on a
level -- monsters that arrive within the bounds of a room are supposed
to stay there.
However, not all of the places where the comments indicated this was
being used were using it correctly; I tested this by letting a few
monsters fall through the knox portal (they're supposed to be
constrained to the entry room) and waiting a hundred turns, then going
through the portal; they were not constrained to the room and had
"wandered" through its walls.
Instead of trying to maintain this special case, I have added an
optional "arrival_room" boolean argument to des.region, which forces it
to create a room for the purposes of constraining monster arrival.

I have gone through and replaced occurrences of prefilled in lua files
with the appropriate filled option (or arrival, as needed). In some
cases, that resulted in questionable regions such as a filled ordinary
area in a non-themeroom (I just dropped the filled=1), or an area which
didn't do anything, not even lighting (which I deleted).
This commit is contained in:
copperwater
2020-05-19 00:13:41 -04:00
committed by Pasi Kallinen
parent f57588cef1
commit 0fef8fce9f
39 changed files with 146 additions and 141 deletions

View File

@@ -52,7 +52,7 @@ des.region(selection.area(35,16,36,17), "unlit")
des.region(selection.area(38,13,38,17), "unlit")
des.region(selection.area(40,13,41,14), "unlit")
des.region(selection.area(40,16,41,17), "unlit")
des.region({ region={43,13, 50,15}, lit=0, type="temple", prefilled=0 })
des.region({ region={43,13, 50,15}, lit=0, type="temple", filled=2 })
des.region(selection.area(52,13,52,15), "unlit")
-- Stairs
des.stair("up", 38,10)

View File

@@ -31,18 +31,18 @@ des.map([[
]]);
-- Dungeon Description
des.region(selection.area(00,00,75,19), "lit")
des.region({ region={25,04, 28,07}, lit=1, type="temple", prefilled=0 })
des.region({ region={25,09, 28,11}, lit=0, type="temple", prefilled=0 })
des.region({ region={25,13, 28,16}, lit=1, type="temple", prefilled=0 })
des.region({ region={25,04, 28,07}, lit=1, type="temple", filled=2 })
des.region({ region={25,09, 28,11}, lit=0, type="temple", filled=2 })
des.region({ region={25,13, 28,16}, lit=1, type="temple", filled=2 })
des.region(selection.area(30,04,30,16), "lit")
des.region(selection.area(32,04,32,16), "unlit")
des.region({ region={33,04, 53,04}, lit=0, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={33,04, 53,04}, lit=0, type="ordinary", irregular=1 })
des.region(selection.area(36,10,37,10), "unlit")
des.region(selection.area(39,09,39,11), "unlit")
des.region({ region={36,06, 42,08}, lit=0, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={36,12, 42,14}, lit=0, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={36,06, 42,08}, lit=0, type="ordinary", irregular=1 })
des.region({ region={36,12, 42,14}, lit=0, type="ordinary", irregular=1 })
des.region(selection.area(46,06,51,09), "unlit")
des.region({ region={46,11, 49,11}, lit=0, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={46,11, 49,11}, lit=0, type="ordinary", irregular=1 })
des.region(selection.area(48,13,51,14), "unlit")
-- Doors
des.door("closed",31,04)

View File

@@ -31,7 +31,7 @@ des.map([[
]]);
-- Dungeon Description
des.region(selection.area(00,00,75,19), "unlit")
des.region({ region={52,06, 73,15}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={52,06, 73,15}, lit=1, type="ordinary", irregular=1 })
-- Doors
des.door("locked",28,11)
-- Stairs

View File

@@ -37,14 +37,14 @@ des.map([[
]]);
-- Dungeon Description
des.region(selection.area(00,00,75,19), "unlit")
des.region({ region={13,01, 40,05}, lit=1, type="temple", prefilled=0, irregular=1 })
des.region({ region={13,01, 40,05}, lit=1, type="temple", filled=1, irregular=1 })
-- The occupied rooms.
des.region({ region={02,01, 08,03}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={01,11, 06,14}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={13,08, 18,10}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={05,17, 14,18}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={17,16, 23,18}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={35,16, 44,18}, lit=1, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={02,01, 08,03}, lit=1, type="ordinary", irregular=1 })
des.region({ region={01,11, 06,14}, lit=1, type="ordinary", irregular=1 })
des.region({ region={13,08, 18,10}, lit=1, type="ordinary", irregular=1 })
des.region({ region={05,17, 14,18}, lit=1, type="ordinary", irregular=1 })
des.region({ region={17,16, 23,18}, lit=1, type="ordinary", irregular=1 })
des.region({ region={35,16, 44,18}, lit=1, type="ordinary", irregular=1 })
-- Stairs
des.stair("down", 02,03)
-- Portal arrival point

View File

@@ -36,7 +36,7 @@ des.map([[
-- Dungeon Description
des.region(selection.area(00,00,49,15), "lit")
des.region(selection.area(04,04,45,11), "unlit")
des.region({ region={06,06,22,09}, lit=1, type="throne", prefilled=1 })
des.region({ region={06,06,22,09}, lit=1, type="throne", filled=2 })
des.region(selection.area(27,06,43,09), "lit")
-- Portal arrival point
des.levregion({ region = {20,14,20,14}, type="branch" })

View File

@@ -26,11 +26,11 @@ des.map([[
........................................
]]);
-- Dungeon Description
des.region({ region={00,00, 09,13}, lit=0, type="morgue", prefilled=0 })
des.region({ region={09,00, 30,01}, lit=0, type="morgue", prefilled=0 })
des.region({ region={09,12, 30,13}, lit=0, type="morgue", prefilled=0 })
des.region({ region={31,00, 39,13}, lit=0, type="morgue", prefilled=0 })
des.region({ region={11,03, 29,10}, lit=1, type="temple", prefilled=0, irregular=1 })
des.region({ region={00,00, 09,13}, lit=0, type="morgue", filled=1 })
des.region({ region={09,00, 30,01}, lit=0, type="morgue", filled=1 })
des.region({ region={09,12, 30,13}, lit=0, type="morgue", filled=1 })
des.region({ region={31,00, 39,13}, lit=0, type="morgue", filled=1 })
des.region({ region={11,03, 29,10}, lit=1, type="temple", filled=1, irregular=1 })
-- The altar inside the temple
des.altar({ x=20,y=07, align="noalign", type="shrine" })
des.monster({ id = "aligned priest", x=20, y=07, align="noalign", peaceful = 0 })

View File

@@ -37,7 +37,7 @@ des.map([[
]]);
-- Dungeon Description
des.region(selection.area(00,00,75,19), "lit")
des.region({ region={18,03, 26,07}, lit=1, type="throne", prefilled=1 })
des.region({ region={18,03, 26,07}, lit=1, type="throne", filled=2 })
-- Portal arrival zone
des.levregion({ region = {62,12,70,17}, type="branch" })
-- Stairs

View File

@@ -32,14 +32,14 @@ des.map([[
des.region(selection.area(00,00,75,19), "lit")
des.non_diggable(selection.area(00,00,75,19))
--
des.region({ region={01,01, 04,05}, lit=0, type="morgue", prefilled = 0 })
des.region({ region={15,03, 20,05}, lit=1, type="shop", prefilled = 0 })
des.region({ region={62,03, 71,04}, lit=1, type="shop", prefilled = 0 })
des.region({ region={01,17, 11,18}, lit=1, type="barracks", prefilled = 0 })
des.region({ region={12,09, 20,10}, lit=1, type="barracks", prefilled = 0 })
des.region({ region={53,11, 59,14}, lit=1, type="zoo", prefilled = 0 })
des.region({ region={63,14, 72,16}, lit=1, type="barracks", prefilled = 0 })
des.region({ region={32,14, 40,16}, lit=1, type="temple", prefilled = 0 })
des.region({ region={01,01, 04,05}, lit=0, type="morgue", filled=1 })
des.region({ region={15,03, 20,05}, lit=1, type="shop", filled=1 })
des.region({ region={62,03, 71,04}, lit=1, type="shop", filled=1 })
des.region({ region={01,17, 11,18}, lit=1, type="barracks", filled=1 })
des.region({ region={12,09, 20,10}, lit=1, type="barracks", filled=1 })
des.region({ region={53,11, 59,14}, lit=1, type="zoo", filled=1 })
des.region({ region={63,14, 72,16}, lit=1, type="barracks", filled=1 })
des.region({ region={32,14, 40,16}, lit=1, type="temple", filled=1 })
--
des.region({ region = {06,01,11,02}, type = "ordinary" })
des.region({ region = {24,01,29,02}, type = "ordinary" })

View File

@@ -36,7 +36,7 @@ des.map([[
]]);
-- Dungeon Description
des.region(selection.area(00,00,75,19), "lit")
des.region({ region={14,01, 20,03}, lit=0, type="morgue", prefilled=0 })
des.region({ region={14,01, 20,03}, lit=0, type="morgue", filled=1 })
des.region(selection.area(07,10,11,12), "unlit")
des.region(selection.area(04,16,08,18), "unlit")
des.region(selection.area(17,16,21,18), "unlit")

View File

@@ -36,18 +36,18 @@ des.replace_terrain({ region = {34, 1,68,19}, fromterrain="}", toterrain=".", ch
-- Dungeon Description
des.region(selection.area(00,00,75,20), "lit")
des.region({ region={37,04,65,16}, lit=0, type="ordinary", prefilled=1, irregular=1,
des.region({ region={37,04,65,16}, lit=0, type="ordinary", irregular=1,
contents = function()
des.door({ state="secret", wall="random" })
end
})
des.region({ region={39,06,63,14}, lit=0, type="ordinary", prefilled=1, irregular=1,
des.region({ region={39,06,63,14}, lit=0, type="ordinary", irregular=1,
contents = function()
des.door({ state="secret", wall="random" })
end
})
des.region({ region={41,08,46,12}, lit=1, type="ordinary", prefilled=1, irregular=1,
des.region({ region={41,08,46,12}, lit=1, type="ordinary", irregular=1,
contents = function()
local walls = { "north", "south", "west" }
local widx = math.random(1, #walls)
@@ -55,7 +55,7 @@ des.region({ region={41,08,46,12}, lit=1, type="ordinary", prefilled=1, irregula
end
})
des.region({ region={56,08,61,12}, lit=1, type="ordinary", prefilled=1, irregular=1,
des.region({ region={56,08,61,12}, lit=1, type="ordinary", irregular=1,
contents = function()
local walls = { "north", "south", "east" }
local widx = math.random(1, #walls)
@@ -66,7 +66,7 @@ des.region({ region={56,08,61,12}, lit=1, type="ordinary", prefilled=1, irregula
des.region(selection.area(48,08,54,08), "unlit")
des.region(selection.area(48,12,54,12), "unlit")
des.region({ region={48,10,54,10}, lit=0, type="ordinary", prefilled=1, irregular=1,
des.region({ region={48,10,54,10}, lit=0, type="ordinary", irregular=1,
contents = function()
des.door({ state="secret", wall="random" })
end

View File

@@ -44,7 +44,7 @@ des.replace_terrain({ region={13,5, 33,15}, fromterrain="C", toterrain=".", chan
des.region(selection.area(00,00,75,19), "lit")
des.region(selection.area(35,00,49,03), "unlit")
des.region(selection.area(43,12,49,16), "unlit")
des.region({ region={19,11,33,15}, lit=0, type="ordinary", prefilled=0, irregular=1 })
des.region({ region={19,11,33,15}, lit=0, type="ordinary", irregular=1 })
des.region(selection.area(30,10,31,10), "unlit")
-- Stairs
des.stair("down", 30,10)

View File

@@ -76,9 +76,9 @@ place:set(51,9);
-- Where the player will land on arrival
des.teleport_region({ region = {29,15,45,15}, exclude = {30,15,44,15} })
-- Lit courts
des.region({ region={01,05,16,14},lit=1,type="ordinary",prefilled=1,irregular=1 })
des.region({ region={31,01,44,10},lit=1,type="ordinary",prefilled=1,irregular=1 })
des.region({ region={61,05,74,14},lit=1,type="ordinary",prefilled=1,irregular=1 })
des.region({ region={01,05,16,14},lit=1,type="ordinary",irregular=1 })
des.region({ region={31,01,44,10},lit=1,type="ordinary",irregular=1 })
des.region({ region={61,05,74,14},lit=1,type="ordinary",irregular=1 })
-- A Sanctum for each alignment
-- The shrines' alignments are shuffled for
-- each game

View File

@@ -230,7 +230,7 @@ des.region(selection.area(00,00,62,16),"unlit")
des.region(selection.area(00,05,05,11),"lit")
des.region(selection.area(57,05,62,11),"lit")
-- Throne room
des.region({ region={27,05, 37,11},lit=1,type="throne", prefilled=1 })
des.region({ region={27,05, 37,11},lit=1,type="throne", filled=2 })
-- Antechamber
des.region(selection.area(07,05,14,11),"lit")
-- Storerooms
@@ -244,8 +244,8 @@ des.region(selection.area(56,02,60,03),"lit")
des.region(selection.area(02,13,06,14),"lit")
des.region(selection.area(56,13,60,14),"lit")
-- Barracks
des.region({ region={16,05, 25,06},lit=1,type="barracks", prefilled=0 })
des.region({ region={16,10, 25,11},lit=1,type="barracks", prefilled=0 })
des.region({ region={16,05, 25,06},lit=1,type="barracks", filled=1 })
des.region({ region={16,10, 25,11},lit=1,type="barracks", filled=1 })
-- Hallways
des.region(selection.area(08,03,54,03),"unlit")
des.region(selection.area(08,13,54,13),"unlit")

View File

@@ -23,7 +23,7 @@ des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="b
des.teleport_region({ region={01,00,79,20}, region_islev=1,exclude={2,2,6,6} })
des.levregion({ region={4,4,4,4}, type="portal", name="wizard3" })
des.mazewalk(08,05,"east")
des.region({ region={04,03,06,06},lit=0,type="ordinary",prefilled=0,irregular=1 })
des.region({ region={04,03,06,06},lit=0,type="ordinary",irregular=1,arrival_room=true })
des.monster("L",04,04)
des.monster("vampire lord",03,04)
des.monster("kraken",06,06)

View File

@@ -22,7 +22,6 @@ des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="s
des.levregion({ region={01,00,79,20}, region_islev=1, exclude={0,0,8,7}, type="branch" });
des.teleport_region({ region={01,00,79,20}, region_islev=1,exclude={2,2,6,6} })
des.mazewalk(08,05,"east")
des.region({ region={04,03,06,06},lit=0,type="ordinary",prefilled=0,irregular=1 })
des.monster("L",04,04)
des.monster("vampire lord",03,04)
des.monster("kraken",06,06)

View File

@@ -39,7 +39,7 @@ des.levregion({ region = {08,16,08,16}, type="branch" });
des.teleport_region({ region = {06,15,09,16}, dir="up" })
des.teleport_region({ region = {06,15,09,16}, dir="down" })
-- Throne room, with Croesus on the throne
des.region({ x1=37,y1=08,x2=46,y2=11, lit=1, type="throne", prefilled=0 })
des.region({ x1=37,y1=08,x2=46,y2=11, lit=1, type="throne", filled=1 })
-- 50% chance each to move throne and/or fort's entry secret door up one row
if percent(50) then
des.monster({ id = "Croesus", x=43, y=10, peaceful = 0 })
@@ -80,10 +80,10 @@ des.region(selection.area(46,06,48,06),"lit")
des.region(selection.area(19,13,21,13),"lit")
des.region(selection.area(46,13,48,13),"lit")
-- A welcoming committee
des.region({ region={03,10,07,13},lit=1,type="zoo",prefilled=0,irregular=1 })
des.region({ region={03,10,07,13},lit=1,type="zoo",filled=1,irregular=1 })
-- arrival chamber; needs to be a real room to control migrating monsters,
-- and `unfilled' is a kludge to force an ordinary room to remain a room
des.region({ region={06,15,09,16},lit=0,type="ordinary",prefilled=0 })
des.region({ region={06,15,09,16},lit=0,type="ordinary",arrival_room=true })
-- 3.6.2: Entering level carrying a lit candle would show the whole entry
-- chamber except for its top right corner even though some of the revealed
@@ -109,7 +109,7 @@ des.region(selection.area(05,14,09,14),"unlit")
-- it is expected to work.)
-- Barracks
des.region({ region={62,03,71,04},lit=1,type="barracks",prefilled=0,irregular=1 })
des.region({ region={62,03,71,04},lit=1,type="barracks",filled=1,irregular=1 })
-- Doors
des.door("closed",06,14)
des.door("closed",09,03)

View File

@@ -36,8 +36,8 @@ des.map([[
-- Dungeon Description
des.region(selection.area(00,00,74,19),"lit")
des.region(selection.area(31,07,45,07),"unlit")
-- (must maintain one room definition; `filled=0' forces its room to be kept)
des.region({ region={35,09, 41,10}, lit = 0, type="ordinary", prefilled = 1 })
-- make the downstairs room a real room to control arriving monsters
des.region({ region={35,09, 41,10}, lit = 0, type="ordinary", arrival_room=true })
des.region(selection.area(31,12,45,12),"unlit")
-- Teleport: down to up stairs island, up to Medusa's island
des.teleport_region({ region = {01,01,05,17}, dir="down" })

View File

@@ -32,9 +32,10 @@ des.map([[
-- Dungeon Description
des.region(selection.area(00,00,74,19),"lit")
des.region(selection.area(02,03,05,16),"unlit")
des.region({ region={61,03, 72,16}, lit=0, type="ordinary", prefilled = 1,irregular = 1 })
des.region({ region={61,03, 72,16}, lit=0, type="ordinary",irregular = 1 })
des.region(selection.area(71,08,72,11),"unlit")
des.region(selection.area(67,08,69,11),"lit")
-- make the downstairs area a real room to control arriving monsters
des.region({ region={67,08,69,11}, lit=1, type="ordinary", arrival_room=true })
-- Teleport: down to up stairs island, up to Medusa's island
des.teleport_region({ region = {02,03,05,16}, dir="down" })
des.teleport_region({ region = {61,03,72,16}, dir="up" })

View File

@@ -37,7 +37,7 @@ place:set(66,05);
place:set(46,15);
des.region(selection.area(00,00,74,19),"lit")
des.region({ region={49,14, 51,16}, lit=-1, type="ordinary", prefilled = 1 });
des.region({ region={49,14, 51,16}, lit=-1, type="ordinary" });
des.region(selection.area(07,05,09,07),"unlit")
des.region(selection.area(65,04,67,06),"unlit")
des.region(selection.area(45,14,47,16),"unlit")

View File

@@ -40,7 +40,6 @@ place:set(10,08);
place:set(10,12);
--
des.region(selection.area(00,00,74,19),"lit")
des.region({ region={13,03, 18,13}, lit=1, type="ordinary", prefilled=1 })
--
des.teleport_region({ region = {64,01,74,17}, dir="down" });
des.teleport_region({ region = {02,02,18,13}, dir="up" });

View File

@@ -35,8 +35,8 @@ des.map([[
local place = { {08,16},{13,07},{21,08},{41,14},{50,04},{50,16},{66,01} }
shuffle(place)
des.region({ region={26,01,32,01}, lit=0, type="ordinary",
prefilled=0, irregular=1 })
-- make the entry chamber a real room; it affects monster arrival
des.region({ region={26,01,32,01}, lit=0, type="ordinary", irregular=1, arrival_room=true })
des.region(selection.area(20,08,21,08),"unlit")
des.region(selection.area(23,08,25,08),"unlit");
-- Secret doors

View File

@@ -95,13 +95,13 @@ des.monster("dwarf")
des.monster("dwarf")
-- The shops
des.region({ region={25,17, 28,19}, lit=1, type="candle shop", prefilled=0 })
des.region({ region={25,17, 28,19}, lit=1, type="candle shop", filled=1 })
des.door("closed",24,18)
des.region({ region={59, 9, 67,10}, lit=1, type="shop", prefilled=0 })
des.region({ region={59, 9, 67,10}, lit=1, type="shop", filled=1 })
des.door("closed",66,08)
des.region({ region={57,13, 60,15}, lit=1, type="tool shop", prefilled=0 })
des.region({ region={57,13, 60,15}, lit=1, type="tool shop", filled=1 })
des.door("closed",56,14)
des.region({ region={05,09, 08,10}, lit=1, type=monkfoodshop(), prefilled=0 })
des.region({ region={05,09, 08,10}, lit=1, type=monkfoodshop(), filled=1 })
des.door("closed",07,11)
-- Gnome homes
des.door("closed",04,14)

View File

@@ -36,11 +36,11 @@ des.levregion({ type="stair-down", region={61,03,75,19}, region_islev=1, exclude
des.feature("fountain" ,22,07)
des.feature("fountain", 09,13)
des.region(selection.area(13,5,14,6),"unlit")
des.region({ region={09,07, 11,09}, lit=1, type="candle shop", prefilled=0 })
des.region({ region={16,04, 18,06}, lit=1, type="tool shop", prefilled=0 })
des.region({ region={23,01, 25,03}, lit=1, type="shop", prefilled=0 })
des.region({ region={22,12, 24,13}, lit=1, type=monkfoodshop(), prefilled=0 })
des.region({ region={31,12, 36,14}, lit=1, type="temple", prefilled=0 })
des.region({ region={09,07, 11,09}, lit=1, type="candle shop", filled=1 })
des.region({ region={16,04, 18,06}, lit=1, type="tool shop", filled=1 })
des.region({ region={23,01, 25,03}, lit=1, type="shop", filled=1 })
des.region({ region={22,12, 24,13}, lit=1, type=monkfoodshop(), filled=1 })
des.region({ region={31,12, 36,14}, lit=1, type="temple", filled=1 })
des.altar({ x=35,y=13,align=align[1],type="shrine"})
des.door("closed",5,2)

View File

@@ -77,9 +77,9 @@ des.door("open",26,14)
des.door("closed",06,15)
-- Special rooms
des.altar({ x=24,y=07,align="noalign",type="sanctum" })
des.region({ region={22,12,25,16},lit=0,type="morgue", prefilled=0 })
des.region({ region={32,09,37,12},lit=1,type="shop",prefilled=0 })
des.region({ region={12,00,15,04},lit=1,type="shop",prefilled=0 })
des.region({ region={22,12,25,16},lit=0,type="morgue",filled=1 })
des.region({ region={32,09,37,12},lit=1,type="shop",filled=1 })
des.region({ region={12,00,15,04},lit=1,type="shop",filled=1 })
-- Some traps.
des.trap("spiked pit")
des.trap("sleep gas")

View File

@@ -36,7 +36,7 @@ des.region({ region={15,07, 21,10}, lit=1, type="temple", contents = function()
des.door({ wall = "random", state = "secret" });
end })
des.altar({ x=18, y=08, align="noalign", type="sanctum" })
des.region({ region={41,06, 48,11}, lit=0, type="morgue", prefilled=0, irregular=1 })
des.region({ region={41,06, 48,11}, lit=0, type="morgue", filled=1, irregular=1 })
-- Non diggable walls
des.non_diggable(selection.area(00,00,75,19))
-- Invisible barrier separating the left & right halves of the level

View File

@@ -94,8 +94,7 @@ des.door("closed", 17, 11);
des.door("closed", 17, 13);
des.door("closed", 17, 15);
des.region({ region={18,10, 22,16}, lit = 1, type = "zoo",
prefilled = 0, irregular = 1 });
des.region({ region={18,10, 22,16}, lit = 1, type = "zoo", filled = 1, irregular = 1 });
px, py = selection.rndcoord(place);
if percent(75) then

View File

@@ -96,8 +96,7 @@ des.door("locked",23,12)
des.door("closed",17,10)
des.door("closed",17,12)
des.door("closed",17,14)
des.region({ region={18,09, 22,15}, lit = 1, type = "zoo",
prefilled = 0, irregular = 1 });
des.region({ region={18,09, 22,15}, lit = 1, type = "zoo", filled = 1, irregular = 1 });
px, py = selection.rndcoord(place);
if percent(25) then

View File

@@ -12,7 +12,6 @@
-- core calls themerooms_generate() multiple times per level
-- to generate a single themed room.
themerooms = {
{
-- the "default" room
@@ -263,7 +262,7 @@ themerooms = {
|......|
|......|
|......|
--------]], contents = function(m) des.region({ region={1,1,3,3}, type="ordinary", irregular=true, prefilled=true }); end });
--------]], contents = function(m) des.region({ region={1,1,3,3}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- L-shaped, rot 1
@@ -276,7 +275,7 @@ xxx|...|
|......|
|......|
|......|
--------]], contents = function(m) des.region({ region={5,1,5,3}, type="ordinary", irregular=true, prefilled=true }); end });
--------]], contents = function(m) des.region({ region={5,1,5,3}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- L-shaped, rot 2
@@ -289,7 +288,7 @@ xxx|...|
----...|
xxx|...|
xxx|...|
xxx-----]], contents = function(m) des.region({ region={1,1,2,2}, type="ordinary", irregular=true, prefilled=true }); end });
xxx-----]], contents = function(m) des.region({ region={1,1,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- L-shaped, rot 3
@@ -302,7 +301,7 @@ xxx-----]], contents = function(m) des.region({ region={1,1,2,2}, type="ordinary
|...----
|...|xxx
|...|xxx
-----xxx]], contents = function(m) des.region({ region={1,1,2,2}, type="ordinary", irregular=true, prefilled=true }); end });
-----xxx]], contents = function(m) des.region({ region={1,1,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Blocked center
@@ -324,7 +323,7 @@ if (percent(30)) then
shuffle(terr);
des.replace_terrain({ region = {1,1, 9,9}, fromterrain = "L", toterrain = terr[1] });
end
des.region({ region={1,1,2,2}, type="ordinary", irregular=true, prefilled=true });
des.region({ region={1,1,2,2}, type="ordinary", irregular=true, filled=1 });
end });
end,
@@ -337,7 +336,7 @@ x--.--x
|.....|
--...--
x--.--x
xx---xx]], contents = function(m) des.region({ region={3,3,3,3}, type="ordinary", irregular=true, prefilled=true }); end });
xx---xx]], contents = function(m) des.region({ region={3,3,3,3}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Circular, medium
@@ -351,7 +350,7 @@ x--...--x
|.......|
--.....--
x--...--x
xx-----xx]], contents = function(m) des.region({ region={4,4,4,4}, type="ordinary", irregular=true, prefilled=true }); end });
xx-----xx]], contents = function(m) des.region({ region={4,4,4,4}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Circular, big
@@ -367,7 +366,7 @@ x-.......-x
--.......--
x-.......-x
x---...---x
xxx-----xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, prefilled=true }); end });
xxx-----xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped
@@ -380,7 +379,7 @@ xxx|...|xxx
|.........|
|.........|
|.........|
-----------]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, prefilled=true }); end });
-----------]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped, rot 1
@@ -396,7 +395,7 @@ xxx|...|xxx
|...----
|...|xxx
|...|xxx
-----xxx]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, prefilled=true }); end });
-----xxx]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped, rot 2
@@ -409,7 +408,7 @@ xxx|...|xxx
----...----
xxx|...|xxx
xxx|...|xxx
xxx-----xxx]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, prefilled=true }); end });
xxx-----xxx]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- T-shaped, rot 3
@@ -425,7 +424,7 @@ xxx|...|
----...|
xxx|...|
xxx|...|
xxx-----]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, prefilled=true }); end });
xxx-----]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- S-shaped
@@ -441,7 +440,7 @@ xxx-----]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary
----...|
xxx|...|
xxx|...|
xxx-----]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, prefilled=true }); end });
xxx-----]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- S-shaped, rot 1
@@ -454,7 +453,7 @@ xxx|......|
|......----
|......|xxx
|......|xxx
--------xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, prefilled=true }); end });
--------xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Z-shaped
@@ -470,7 +469,7 @@ xxx|...|
|...----
|...|xxx
|...|xxx
-----xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, prefilled=true }); end });
-----xxx]], contents = function(m) des.region({ region={5,5,5,5}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Z-shaped, rot 1
@@ -483,7 +482,7 @@ xxx|...|
----......|
xxx|......|
xxx|......|
xxx--------]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, prefilled=true }); end });
xxx--------]], contents = function(m) des.region({ region={2,2,2,2}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Cross
@@ -499,7 +498,7 @@ xxx|...|xxx
----...----
xxx|...|xxx
xxx|...|xxx
xxx-----xxx]], contents = function(m) des.region({ region={6,6,6,6}, type="ordinary", irregular=true, prefilled=true }); end });
xxx-----xxx]], contents = function(m) des.region({ region={6,6,6,6}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Four-leaf clover
@@ -515,7 +514,7 @@ xx|.....|xx
|.........|
|...---...|
|...|x|...|
-----x-----]], contents = function(m) des.region({ region={6,6,6,6}, type="ordinary", irregular=true, prefilled=true }); end });
-----x-----]], contents = function(m) des.region({ region={6,6,6,6}, type="ordinary", irregular=true, filled=1 }); end });
end,
-- Water-surrounded vault
@@ -526,7 +525,7 @@ xx|.....|xx
}|..|}
}|..|}
}----}
}}}}}}]], contents = function(m) des.region({ region={3,3,3,3}, type="themed", irregular=true, prefilled=false, joined=false });
}}}}}}]], contents = function(m) des.region({ region={3,3,3,3}, type="themed", irregular=true, filled=0, joined=false });
local nasty_undead = { "giant zombie", "ettin zombie", "vampire lord" };
des.object("chest", 2, 2);
des.object("chest", 3, 2);

View File

@@ -53,9 +53,9 @@ end
-- The shrine to Moloch.
des.region({ region={01,06, 05,14},lit=1,type="temple" })
-- The Morgues
des.region({ region={19,01, 24,08},lit=0,type="morgue",prefilled=0,irregular=1 })
des.region({ region={09,14, 16,18},lit=0,type="morgue",prefilled=0,irregular=1 })
des.region({ region={37,09, 43,14},lit=0,type="morgue",prefilled=0,irregular=1 })
des.region({ region={19,01, 24,08},lit=0,type="morgue",filled=1,irregular=1 })
des.region({ region={09,14, 16,18},lit=0,type="morgue",filled=1,irregular=1 })
des.region({ region={37,09, 43,14},lit=0,type="morgue",filled=1,irregular=1 })
-- Stairs
des.stair("down", 01,01)
-- Branch location

View File

@@ -28,12 +28,12 @@ des.levregion({ type="stair-up", region={01,00,79,20}, region_islev=1, exclude={
des.levregion({ type="stair-down", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} })
des.levregion({ type="branch", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} })
des.teleport_region({ region={01,00,79,20}, region_islev=1, exclude={0,0,27,12} })
des.region({ region={12,01, 20,09}, lit=0, type="morgue", prefilled=1, contents=function()
des.region({ region={12,01, 20,09}, lit=0, type="morgue", filled=2, contents=function()
local sdwall = { "south", "west", "east" };
des.door({ wall = sdwall[math.random(1, #sdwall)], state = "secret" });
end })
-- another region to constrain monster arrival
des.region({ region={01,01, 10,11}, lit=0, type="ordinary", prefilled=0 })
des.region({ region={01,01, 10,11}, lit=0, type="ordinary", arrival_room=true })
des.mazewalk(28,05,"east")
des.ladder("down", 06,05)
-- Non diggable walls

View File

@@ -26,8 +26,8 @@ des.levregion({ type="stair-down", region={01,00,79,20}, region_islev=1, exclude
des.levregion({ type="branch", region={01,00,79,20}, region_islev=1, exclude={0,0,28,12} })
des.teleport_region({ region={01,00,79,20}, region_islev=1, exclude={0,0,27,12} })
-- entire tower in a region, constrains monster migration
des.region({ region={01,01, 26,11}, lit=0, type="ordinary", prefilled=1 })
des.region({ region={09,03, 17,09}, lit=0, type="zoo", prefilled=0 })
des.region({ region={01,01, 26,11}, lit=0, type="ordinary", arrival_room=true })
des.region({ region={09,03, 17,09}, lit=0, type="zoo", filled=1 })
des.door("closed",15,02)
des.door("closed",11,10)
des.mazewalk(28,05,"east")

View File

@@ -27,11 +27,10 @@ des.levregion({ type="branch", region={01,00,79,20}, region_islev=1, exclude={0,
des.teleport_region({ region={01,00,79,20}, region_islev=1, exclude={0,0,27,12} })
des.levregion({ region={25,11,25,11}, type="portal", name="fakewiz1" });
des.mazewalk(28,09,"east")
des.region({ region={07,03, 15,11}, lit=0 ,type="morgue",prefilled=1 })
des.region({ region={07,03, 15,11}, lit=0 ,type="morgue", filled=2 })
des.region({ region={17,06, 18,11}, lit=0, type="beehive" })
-- make the entry chamber a real room; it affects monster arrival;
-- `unfilled' is a kludge to force an ordinary room to remain a room
des.region({ region={20,06,26,11},lit=0,type="ordinary",prefilled=1,
-- make the entry chamber a real room; it affects monster arrival
des.region({ region={20,06,26,11},lit=0,type="ordinary",arrival_room=true,
contents = function()
local w = "north";
if percent(50) then w = "west" end

View File

@@ -304,13 +304,13 @@ Set flags for this level.
| nommap | Prevents magic mapping
| shortsighted | Prevents monsters from seeing the hero from far away
| arboreal | Notionally an outdoor map; replaces solid stone with trees
| mazelevel |
| mazelevel |
| shroud | Unseen locations on the level will not be remembered by the hero, instead of rendering as out-of-sight map, trap, and object glyphs like they normally do.
| graveyard | Treats the level as a graveyard level (causes graveyard sounds and undead have a reduced chance of leaving corpses).
| icedpools | Ice generated with the level will be treated as frozen pools instead of frozen moats.
| corrmaze |
| corrmaze |
| premapped | Map, including traps and boulders, is revealed on entrance.
| solidify | Areas outside the specified level map are made undiggable and unphaseable.
| solidify | Areas outside the specified level map are made undiggable and unphaseable.
| inaccessibles | If inaccessible areas are generated, generate ways for them to connect to the "accessible" area.
| noflip | Prevent flipping the level.
| noflipx | Prevent flipping the level horizontally.
@@ -471,7 +471,7 @@ Example:
Example:
des.region(selection, lit);
des.region({ x1=NN, y1=NN, x2=NN, y2=NN, lit=BOOL, type=ROOMTYPE, joined=BOOL, irregular=BOOL, prefilled=BOOL [ , contents = FUNCTION ] });
des.region({ x1=NN, y1=NN, x2=NN, y2=NN, lit=BOOL, type=ROOMTYPE, joined=BOOL, irregular=BOOL, filled=NN [ , contents = FUNCTION ] });
des.region({ region={x1,y1, x2,y2}, type="ordinary" });
=== replace_terrain

View File

@@ -2467,7 +2467,7 @@ E boolean FDECL(create_room, (XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P, XCHAR_P,
XCHAR_P, XCHAR_P, XCHAR_P));
E void FDECL(create_secret_door, (struct mkroom *, XCHAR_P));
E boolean FDECL(dig_corridor, (coord *, coord *, BOOLEAN_P, SCHAR_P, SCHAR_P));
E void FDECL(fill_special_room, (struct mkroom *, BOOLEAN_P));
E void FDECL(fill_special_room, (struct mkroom *));
E boolean FDECL(load_special, (const char *));
E xchar FDECL(selection_getpoint, (int, int, struct selectionvar *));
E struct selectionvar *NDECL(selection_new);

View File

@@ -90,6 +90,14 @@ enum roomtype_types {
#define ROOMOFFSET 3 /* (levl[x][y].roomno - ROOMOFFSET) gives g.rooms[] index,
* for inside-squares and non-shared boundaries */
/* Values for needfill */
#define FILL_NONE 0 /* do not fill this room with anything */
#define FILL_NORMAL 1 /* fill the room normally (OROOM or THEMEROOM gets
fill_ordinary_room; any other room type gets stocked
with its usual monsters/objects/terrain) */
#define FILL_LVFLAGS 2 /* special rooms only; set the room's rtype and level
flags as appropriate, but do not put anything in it */
#define IS_ROOM_PTR(x) ((x) >= g.rooms && (x) < g.rooms + MAXNROFROOMS)
#define IS_ROOM_INDEX(x) ((x) >= 0 && (x) < MAXNROFROOMS)
#define IS_SUBROOM_PTR(x) ((x) >= g.subrooms && (x) < g.subrooms + MAXNROFROOMS)

View File

@@ -185,7 +185,7 @@ typedef struct _room {
Str_or_Len parent;
xchar x, y, w, h;
xchar xalign, yalign;
xchar rtype, chance, rlit, filled, joined;
xchar rtype, chance, rlit, needfill, joined;
} room;
struct mapfragment {

View File

@@ -757,7 +757,7 @@ struct mkroom *croom;
fill_ordinary_room(croom->sbrooms[x]);
}
if (!croom->needfill)
if (croom->needfill != FILL_NORMAL)
return;
/* put a sleeping monster inside */
@@ -916,7 +916,7 @@ makelevel()
TRUE, VAULT, FALSE);
g.level.flags.has_vault = 1;
++room_threshold;
fill_special_room(&g.rooms[g.nroom - 1], FALSE);
fill_special_room(&g.rooms[g.nroom - 1]);
mk_knox_portal(g.vault_x + w, g.vault_y + h);
if (!g.level.flags.noteleport && !rn2(3))
makevtele();

View File

@@ -1042,10 +1042,10 @@ fill_special_rooms()
for (tmpi = 0; tmpi < g.nroom; tmpi++) {
if (g.rooms[tmpi].needfill)
fill_special_room(&g.rooms[tmpi], (g.rooms[tmpi].needfill == 2));
fill_special_room(&g.rooms[tmpi]);
for (m = 0; m < g.rooms[tmpi].nsubrooms; m++)
if (g.rooms[tmpi].sbrooms[m]->needfill)
fill_special_room(g.rooms[tmpi].sbrooms[m], FALSE);
fill_special_room(g.rooms[tmpi].sbrooms[m]);
}
}
@@ -2682,14 +2682,14 @@ corridor *c;
* Fill a room (shop, zoo, etc...) with appropriate stuff.
*/
void
fill_special_room(croom, prefilled)
fill_special_room(croom)
struct mkroom *croom;
boolean prefilled;
{
if (!croom || croom->rtype == OROOM || croom->rtype == THEMEROOM)
if (!croom || croom->rtype == OROOM || croom->rtype == THEMEROOM
|| croom->needfill == FILL_NONE)
return;
if (!prefilled) {
if (croom->needfill == FILL_NORMAL) {
int x, y;
/* Shop ? */
@@ -2770,7 +2770,7 @@ struct mkroom *mkr;
#else
topologize(aroom); /* set roomno */
#endif
aroom->needfill = r->filled;
aroom->needfill = r->needfill;
aroom->needjoining = r->joined;
return aroom;
}
@@ -3831,7 +3831,8 @@ lua_State *L;
tmproom.rtype = get_table_roomtype_opt(L, "type", OROOM);
tmproom.chance = get_table_int_opt(L, "chance", 100);
tmproom.rlit = get_table_int_opt(L, "lit", -1);
tmproom.filled = get_table_int_opt(L, "filled", g.in_mk_themerooms ? 0 : 1);
/* theme rooms default to unfilled */
tmproom.needfill = get_table_int_opt(L, "filled", g.in_mk_themerooms ? 0 : 1);
tmproom.joined = get_table_int_opt(L, "joined", 1);
if (!g.coder->failed_room[g.coder->n_subroom - 1]) {
@@ -5599,7 +5600,7 @@ genericptr_t arg;
}
/* region(selection, lit); */
/* region({ x1=NN, y1=NN, x2=NN, y2=NN, lit=BOOL, type=ROOMTYPE, joined=BOOL, irregular=BOOL, prefilled=BOOL [ , contents = FUNCTION ] }); */
/* region({ x1=NN, y1=NN, x2=NN, y2=NN, lit=BOOL, type=ROOMTYPE, joined=BOOL, irregular=BOOL, filled=NN [ , contents = FUNCTION ] }); */
/* region({ region={x1,y1, x2,y2}, type="ordinary" }); */
int
lspo_region(L)
@@ -5607,9 +5608,9 @@ lua_State *L;
{
xchar dx1, dy1, dx2, dy2;
register struct mkroom *troom;
boolean prefilled = FALSE, room_not_needed,
boolean do_arrival_room = FALSE, room_not_needed,
irregular = FALSE, joined = TRUE;
int rtype = OROOM, rlit = 1;
int rtype = OROOM, rlit = 1, needfill = 0;
int argc = lua_gettop(L);
create_des_coder();
@@ -5617,13 +5618,12 @@ lua_State *L;
if (argc <= 1) {
lcheck_param_table(L);
/* TODO: check the prefilled, what was the default in lev_comp? */
/* "unfilled" == 0, "filled" == 1, missing = "filled" */
/* TODO: "unfilled" ==> prefilled=1 */
prefilled = get_table_boolean_opt(L, "prefilled", 0);
/* TODO: "unfilled" ==> filled=0, "filled" ==> filled=1, and
* "lvflags_only" ==> filled=2, probably in a get_table_needfill_opt */
needfill = get_table_int_opt(L, "filled", 0);
irregular = get_table_boolean_opt(L, "irregular", 0);
joined = get_table_boolean_opt(L, "joined", 1);
do_arrival_room = get_table_boolean_opt(L, "arrival_room", 0);
rtype = get_table_roomtype_opt(L, "type", OROOM);
rlit = get_table_int_opt(L, "lit", -1);
dx1 = get_table_int_opt(L, "x1", -1); /* TODO: area */
@@ -5668,10 +5668,16 @@ lua_State *L;
get_location(&dx1, &dy1, ANY_LOC, (struct mkroom *) 0);
get_location(&dx2, &dy2, ANY_LOC, (struct mkroom *) 0);
/* for an ordinary room, `prefilled' is a flag to force
an actual room to be created (such rooms are used to
control placement of migrating monster arrivals) */
room_not_needed = (rtype == OROOM && !irregular && !prefilled && !g.in_mk_themerooms);
/* Many regions are simple, rectangular areas that just need to set lighting
* in an area. In that case, we don't need to do anything complicated by
* creating a room. The exceptions are:
* - Special rooms (which usually need to be filled).
* - Irregular regions (more convenient to use the room-making code).
* - Themed room regions (which often have contents).
* - When a room is desired to constrain the arrival of migrating monsters
* (see the mon_arrive function for details).
*/
room_not_needed = (rtype == OROOM && !irregular && !do_arrival_room && !g.in_mk_themerooms);
if (room_not_needed || g.nroom >= MAXNROFROOMS) {
region tmpregion;
if (!room_not_needed)
@@ -5689,8 +5695,7 @@ lua_State *L;
troom = &g.rooms[g.nroom];
/* mark rooms that must be filled, but do it later */
if (rtype != OROOM)
troom->needfill = (prefilled ? 2 : 1);
troom->needfill = needfill;
troom->needjoining = joined;
@@ -5711,9 +5716,6 @@ lua_State *L;
#endif
}
if (g.in_mk_themerooms && prefilled)
troom->needfill = 1;
if (!room_not_needed) {
if (g.coder->n_subroom > 1)
impossible("region as subroom");

View File

@@ -324,8 +324,8 @@ end
function test_region()
des.region(selection.area(08,03,54,03),"unlit")
des.region(selection.area(56,02,60,03),"lit")
des.region({ region={16,05, 25,06}, lit=1, type="barracks", prefilled=0 })
des.region({ region={1,5, 3,7}, lit=1, irregular=true, prefilled=true, joined=false })
des.region({ region={16,05, 25,06}, lit=1, type="barracks", filled=0 })
des.region({ region={1,5, 3,7}, lit=1, irregular=true, filled=1, joined=false })
end
function test_door()