From: copperwater Date: Thu, 21 May 2020 17:23:41 +0000 (-0400) Subject: Adjust rooms in Medusa levels to account for player monster statues X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d73b2be0842033354a3f1ec31526eb133e7b24e;p=nethack Adjust rooms in Medusa levels to account for player monster statues There is code in fixup_special for stocking Medusa's lair with statues of players from the leaderboard. It makes two assumptions: that there will always be at least one room defined on Medusa's level, and that the statues should be placed in the first room defined. In the process of removing prefilled, some of these rooms suddenly became non-rooms, and this caused problems. This commit ensures that the regions for turning into rooms to hold the statues are present and come first. In the process of writing this commit, I discovered a bug: the statue stocking code for medusa in fixup_special naively chooses the spot at which to place its final statue by selecting independent x and y coordinates with somex and somey. This is responsible for a statue occasionally being embedded in a wall or in iron bars on medusa-2 and medusa-4: the rooms defined to receive statues are irregular, and some of the possible coordinates happen to be walls, bars, and water. The proper fix here is to add lua functionality so that the level designer can specify that they want a leaderboard corpse or statue, and remove the medusa special case from fixup_special, but that's rather out of scope for what I'm doing here. --- diff --git a/dat/medusa-1.lua b/dat/medusa-1.lua index f97100811..85f053a06 100644 --- a/dat/medusa-1.lua +++ b/dat/medusa-1.lua @@ -36,7 +36,9 @@ des.map([[ -- Dungeon Description des.region(selection.area(00,00,74,19),"lit") des.region(selection.area(31,07,45,07),"unlit") --- make the downstairs room a real room to control arriving monsters +-- make the downstairs room a real room to control arriving monsters, +-- and also as a fixup_special hack; the first room defined on Medusa's level +-- receives some statues 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 diff --git a/dat/medusa-2.lua b/dat/medusa-2.lua index 017b9b4b3..5fc0886ea 100644 --- a/dat/medusa-2.lua +++ b/dat/medusa-2.lua @@ -32,6 +32,8 @@ des.map([[ -- Dungeon Description des.region(selection.area(00,00,74,19),"lit") des.region(selection.area(02,03,05,16),"unlit") +-- fixup_special hack: the first room defined on a Medusa level gets some +-- leaderboard statues; setting the region as irregular makes it a room des.region({ region={61,03, 72,16}, lit=0, type="ordinary",irregular = 1 }) des.region(selection.area(71,08,72,11),"unlit") -- make the downstairs area a real room to control arriving monsters diff --git a/dat/medusa-3.lua b/dat/medusa-3.lua index 56f37c1c7..65da48b76 100644 --- a/dat/medusa-3.lua +++ b/dat/medusa-3.lua @@ -37,7 +37,10 @@ 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" }); +-- fixup_special hack: the first room defined on a Medusa level gets some +-- leaderboard statues, use arrival_room to force it to be a room even though +-- monsters won't arrive within it +des.region({ region={49,14, 51,16}, lit=-1, type="ordinary", arrival_room=true }); 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 7df55430c..75e910bf5 100644 --- a/dat/medusa-4.lua +++ b/dat/medusa-4.lua @@ -40,6 +40,10 @@ place:set(10,08); place:set(10,12); -- des.region(selection.area(00,00,74,19),"lit") +-- fixup_special hack: The first "room" region in Medusa levels gets filled with +-- some leaderboard statues, so this needs to be a room; setting irregular=1 +-- will force this +des.region({ region={13,03, 18,13}, lit=1, type="ordinary", irregular=1 }) -- des.teleport_region({ region = {64,01,74,17}, dir="down" }); des.teleport_region({ region = {02,02,18,13}, dir="up" }); diff --git a/src/mkmaze.c b/src/mkmaze.c index ae8e7636b..8987cda95 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -541,7 +541,7 @@ fixup_special() struct obj *otmp; int tryct; - croom = &g.rooms[0]; /* only one room on the medusa level */ + croom = &g.rooms[0]; /* the first room defined on the medusa level */ for (tryct = rnd(4); tryct; tryct--) { x = somex(croom); y = somey(croom);