From 0fef8fce9ffab9b0378ff1af3493c470d6d0ad17 Mon Sep 17 00:00:00 2001 From: copperwater Date: Tue, 19 May 2020 00:13:41 -0400 Subject: [PATCH] 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). --- dat/Arc-goal.lua | 2 +- dat/Arc-loca.lua | 14 ++++++------- dat/Cav-loca.lua | 2 +- dat/Cav-strt.lua | 14 ++++++------- dat/Kni-strt.lua | 2 +- dat/Pri-loca.lua | 10 ++++----- dat/Sam-strt.lua | 2 +- dat/Tou-loca.lua | 16 +++++++-------- dat/Tou-strt.lua | 2 +- dat/Wiz-loca.lua | 10 ++++----- dat/Wiz-strt.lua | 2 +- dat/astral.lua | 6 +++--- dat/castle.lua | 6 +++--- dat/fakewiz1.lua | 2 +- dat/fakewiz2.lua | 1 - dat/knox.lua | 8 ++++---- dat/medusa-1.lua | 4 ++-- dat/medusa-2.lua | 5 +++-- dat/medusa-3.lua | 2 +- dat/medusa-4.lua | 1 - dat/minend-1.lua | 4 ++-- dat/minetn-5.lua | 8 ++++---- dat/minetn-6.lua | 10 ++++----- dat/orcus.lua | 6 +++--- dat/sanctum.lua | 2 +- dat/soko1-1.lua | 3 +-- dat/soko1-2.lua | 3 +-- dat/themerms.lua | 39 +++++++++++++++++------------------ dat/valley.lua | 6 +++--- dat/wizard1.lua | 4 ++-- dat/wizard2.lua | 4 ++-- dat/wizard3.lua | 7 +++---- doc/lua.adoc | 8 ++++---- include/extern.h | 2 +- include/mkroom.h | 8 ++++++++ include/sp_lev.h | 2 +- src/mklev.c | 4 ++-- src/sp_lev.c | 52 ++++++++++++++++++++++++----------------------- test/test_des.lua | 4 ++-- 39 files changed, 146 insertions(+), 141 deletions(-) diff --git a/dat/Arc-goal.lua b/dat/Arc-goal.lua index ba3a00555..8cdf65e8c 100644 --- a/dat/Arc-goal.lua +++ b/dat/Arc-goal.lua @@ -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) diff --git a/dat/Arc-loca.lua b/dat/Arc-loca.lua index 31776ac52..93ab61fee 100644 --- a/dat/Arc-loca.lua +++ b/dat/Arc-loca.lua @@ -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) diff --git a/dat/Cav-loca.lua b/dat/Cav-loca.lua index 8406a5dd6..a9dfe1a07 100644 --- a/dat/Cav-loca.lua +++ b/dat/Cav-loca.lua @@ -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 diff --git a/dat/Cav-strt.lua b/dat/Cav-strt.lua index 1dfe83628..83c071d0c 100644 --- a/dat/Cav-strt.lua +++ b/dat/Cav-strt.lua @@ -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 diff --git a/dat/Kni-strt.lua b/dat/Kni-strt.lua index 7d43f61c4..4442d93a7 100644 --- a/dat/Kni-strt.lua +++ b/dat/Kni-strt.lua @@ -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" }) diff --git a/dat/Pri-loca.lua b/dat/Pri-loca.lua index 9ebd55300..5583ac270 100644 --- a/dat/Pri-loca.lua +++ b/dat/Pri-loca.lua @@ -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 }) diff --git a/dat/Sam-strt.lua b/dat/Sam-strt.lua index ec865ab5d..8186c3cb4 100644 --- a/dat/Sam-strt.lua +++ b/dat/Sam-strt.lua @@ -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 diff --git a/dat/Tou-loca.lua b/dat/Tou-loca.lua index d32a7911f..808d45faa 100644 --- a/dat/Tou-loca.lua +++ b/dat/Tou-loca.lua @@ -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" }) diff --git a/dat/Tou-strt.lua b/dat/Tou-strt.lua index 60891c8c4..c5efa0d29 100644 --- a/dat/Tou-strt.lua +++ b/dat/Tou-strt.lua @@ -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") diff --git a/dat/Wiz-loca.lua b/dat/Wiz-loca.lua index 6acc15da6..7197f1856 100644 --- a/dat/Wiz-loca.lua +++ b/dat/Wiz-loca.lua @@ -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 diff --git a/dat/Wiz-strt.lua b/dat/Wiz-strt.lua index fdc9ae531..715cb5744 100644 --- a/dat/Wiz-strt.lua +++ b/dat/Wiz-strt.lua @@ -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) diff --git a/dat/astral.lua b/dat/astral.lua index 7085eba78..cfe22dd78 100644 --- a/dat/astral.lua +++ b/dat/astral.lua @@ -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 diff --git a/dat/castle.lua b/dat/castle.lua index 4c614f550..c2f05f02f 100644 --- a/dat/castle.lua +++ b/dat/castle.lua @@ -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") diff --git a/dat/fakewiz1.lua b/dat/fakewiz1.lua index 6576176e2..906d7f97c 100644 --- a/dat/fakewiz1.lua +++ b/dat/fakewiz1.lua @@ -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) diff --git a/dat/fakewiz2.lua b/dat/fakewiz2.lua index f34d00af0..ae14a6966 100644 --- a/dat/fakewiz2.lua +++ b/dat/fakewiz2.lua @@ -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) diff --git a/dat/knox.lua b/dat/knox.lua index c1b4c204b..e9603e866 100644 --- a/dat/knox.lua +++ b/dat/knox.lua @@ -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) diff --git a/dat/medusa-1.lua b/dat/medusa-1.lua index 63a471904..f97100811 100644 --- a/dat/medusa-1.lua +++ b/dat/medusa-1.lua @@ -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" }) diff --git a/dat/medusa-2.lua b/dat/medusa-2.lua index 4b03631e7..017b9b4b3 100644 --- a/dat/medusa-2.lua +++ b/dat/medusa-2.lua @@ -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" }) diff --git a/dat/medusa-3.lua b/dat/medusa-3.lua index 221cb8172..56f37c1c7 100644 --- a/dat/medusa-3.lua +++ b/dat/medusa-3.lua @@ -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") diff --git a/dat/medusa-4.lua b/dat/medusa-4.lua index c5f8e206d..7df55430c 100644 --- a/dat/medusa-4.lua +++ b/dat/medusa-4.lua @@ -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" }); diff --git a/dat/minend-1.lua b/dat/minend-1.lua index 30e1a23d7..f86140518 100644 --- a/dat/minend-1.lua +++ b/dat/minend-1.lua @@ -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 diff --git a/dat/minetn-5.lua b/dat/minetn-5.lua index 5faac05a1..8160cef07 100644 --- a/dat/minetn-5.lua +++ b/dat/minetn-5.lua @@ -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) diff --git a/dat/minetn-6.lua b/dat/minetn-6.lua index 7e3c88131..ba642c625 100644 --- a/dat/minetn-6.lua +++ b/dat/minetn-6.lua @@ -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) diff --git a/dat/orcus.lua b/dat/orcus.lua index b04247491..109053c3d 100644 --- a/dat/orcus.lua +++ b/dat/orcus.lua @@ -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") diff --git a/dat/sanctum.lua b/dat/sanctum.lua index c99eff81d..84f7f7f99 100644 --- a/dat/sanctum.lua +++ b/dat/sanctum.lua @@ -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 diff --git a/dat/soko1-1.lua b/dat/soko1-1.lua index f38667960..1d6b7c09b 100644 --- a/dat/soko1-1.lua +++ b/dat/soko1-1.lua @@ -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 diff --git a/dat/soko1-2.lua b/dat/soko1-2.lua index 48305895e..3b54a231e 100644 --- a/dat/soko1-2.lua +++ b/dat/soko1-2.lua @@ -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 diff --git a/dat/themerms.lua b/dat/themerms.lua index 4b3947fe4..85c3e18f4 100644 --- a/dat/themerms.lua +++ b/dat/themerms.lua @@ -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); diff --git a/dat/valley.lua b/dat/valley.lua index f283cb415..b030925f7 100644 --- a/dat/valley.lua +++ b/dat/valley.lua @@ -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 diff --git a/dat/wizard1.lua b/dat/wizard1.lua index 3a40d6ae9..2e4a0af79 100644 --- a/dat/wizard1.lua +++ b/dat/wizard1.lua @@ -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 diff --git a/dat/wizard2.lua b/dat/wizard2.lua index d9fd181a0..825f2f342 100644 --- a/dat/wizard2.lua +++ b/dat/wizard2.lua @@ -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") diff --git a/dat/wizard3.lua b/dat/wizard3.lua index 60e9dd014..4f0baf922 100644 --- a/dat/wizard3.lua +++ b/dat/wizard3.lua @@ -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 diff --git a/doc/lua.adoc b/doc/lua.adoc index 27da21ed9..cc4835d7b 100644 --- a/doc/lua.adoc +++ b/doc/lua.adoc @@ -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 diff --git a/include/extern.h b/include/extern.h index 79708ebfe..60c44d2fd 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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); diff --git a/include/mkroom.h b/include/mkroom.h index e7bd874ea..e707aa695 100644 --- a/include/mkroom.h +++ b/include/mkroom.h @@ -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) diff --git a/include/sp_lev.h b/include/sp_lev.h index 821359907..cf86388e3 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -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 { diff --git a/src/mklev.c b/src/mklev.c index b4d7efe07..670f8760a 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -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(); diff --git a/src/sp_lev.c b/src/sp_lev.c index b3b369c73..258fa8f66 100755 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -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"); diff --git a/test/test_des.lua b/test/test_des.lua index 8cb281bce..9275d801a 100644 --- a/test/test_des.lua +++ b/test/test_des.lua @@ -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()