]> granicus.if.org Git - nethack/commitdiff
Adjust rooms in Medusa levels to account for player monster statues
authorcopperwater <aosdict@gmail.com>
Thu, 21 May 2020 17:23:41 +0000 (13:23 -0400)
committerPasi Kallinen <paxed@alt.org>
Sun, 27 Sep 2020 15:54:15 +0000 (18:54 +0300)
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.

dat/medusa-1.lua
dat/medusa-2.lua
dat/medusa-3.lua
dat/medusa-4.lua
src/mkmaze.c

index f9710081151723bfe3724b282b729737a11c2c71..85f053a06fabe529a3d087097b0988ab38b68a16 100644 (file)
@@ -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
index 017b9b4b34aaf3d55651e17ef4c82128e8cfacf9..5fc0886ea951e99a7d341720e36dd8bbf3a7fc8c 100644 (file)
@@ -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
index 56f37c1c793a1f62379d4d8122a887e4a21f66fd..65da48b7698cc2f183ac14fe920b8bb8aaf96fdd 100644 (file)
@@ -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")
index 7df55430c884a2ec53f4a3d410eafb932888c3af..75e910bf5dcd8fb89f0ad08b8b7d88f4fa49aaf6 100644 (file)
@@ -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" });
index ae8e7636b01728ab8d0a3bf9b33ac444ff1d51a2..8987cda958c82d36acdfcf67a02e64b910975ffc 100644 (file)
@@ -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);