Skip to content

Commit 6ea8766

Browse files
committed
Fix: impossible "portal on top of portal??" when loading Gehennom level with the portal to Vecna's domain.
I was aware of this bug while working on the previous commit, but this had a bit lower priority since not having the portal to Vecna's domain spawn would not make the game unwinnable (Vecna's domain is an optional branch). The cause of this impossible in this regard is due to the lava rivers that form in each filler level in Gehennom. Prevent those from forming, bug goes away. But we want those lava rivers. So... the fix is to prevent a magic portal from forming on an already occupied space. The function occupied() checks for pools, lava, furniture, existing traps, and the vibrating square. Perfect for this scenario. While here, I made a slight improvement in somexyspace(), and did some minor code formatting in mklev.c I made sure magic portals spawn where they're supposed to (all of the planes, quest entry portal, etc) before committing.
1 parent 97f8fa2 commit 6ea8766

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

doc/evilhack-changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -4363,4 +4363,6 @@ The following changes to date are:
43634363
- Fix: portal to quest would sometimes not spawn if entry portal spawned
43644364
on Aphrodite's Garden or the Desolate Forest levels
43654365
- Fix: prevent boomerang going out of map
4366+
- Fix: impossible "portal on top of portal??" when loading Gehennom
4367+
level with the portal to Vecna's domain
43664368

src/mklev.c

+14-13
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,8 @@ xchar x, y; /* location */
14031403
}
14041404

14051405
if (br->type == BR_PORTAL) {
1406-
mkportal(x, y, dest->dnum, dest->dlevel);
1406+
if (!occupied(x, y))
1407+
mkportal(x, y, dest->dnum, dest->dlevel);
14071408
} else if (make_stairs) {
14081409
sstairs.sx = x;
14091410
sstairs.sy = y;
@@ -1652,18 +1653,18 @@ coord *tm;
16521653
if (kind == WEB) {
16531654
i = rn2(4);
16541655
switch (i) {
1655-
case 0:
1656-
(void) makemon(&mons[PM_JUMPING_SPIDER], m.x, m.y, NO_MM_FLAGS);
1657-
break;
1658-
case 1:
1659-
(void) makemon(&mons[PM_CAVE_SPIDER], m.x, m.y, NO_MM_FLAGS);
1660-
break;
1661-
case 2:
1662-
(void) makemon(&mons[PM_LARGE_SPIDER], m.x, m.y, NO_MM_FLAGS);
1663-
break;
1664-
default:
1665-
(void) makemon(&mons[PM_GIANT_SPIDER], m.x, m.y, NO_MM_FLAGS);
1666-
break;
1656+
case 0:
1657+
(void) makemon(&mons[PM_JUMPING_SPIDER], m.x, m.y, NO_MM_FLAGS);
1658+
break;
1659+
case 1:
1660+
(void) makemon(&mons[PM_CAVE_SPIDER], m.x, m.y, NO_MM_FLAGS);
1661+
break;
1662+
case 2:
1663+
(void) makemon(&mons[PM_LARGE_SPIDER], m.x, m.y, NO_MM_FLAGS);
1664+
break;
1665+
default:
1666+
(void) makemon(&mons[PM_GIANT_SPIDER], m.x, m.y, NO_MM_FLAGS);
1667+
break;
16671668
}
16681669
}
16691670

src/mkmaze.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,8 @@ d_level *lev;
365365
u_on_newpos(x, y);
366366
break;
367367
case LR_PORTAL:
368-
mkportal(x, y, lev->dnum, lev->dlevel);
368+
if (!occupied(x, y))
369+
mkportal(x, y, lev->dnum, lev->dlevel);
369370
break;
370371
case LR_DOWNSTAIR:
371372
case LR_UPSTAIR:

src/mkroom.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ int xy_flags;
10781078
if ((xy_flags & 16))
10791079
mazexy(pos);
10801080
if ((xy_flags & 1)
1081-
&& (IS_POOL(levl[pos->x][pos->y].typ)
1081+
&& (is_pool_or_lava(pos->x, pos->y)
10821082
|| IS_FURNITURE(levl[pos->x][pos->y].typ)))
10831083
isok = FALSE;
10841084
if ((xy_flags & 2)

0 commit comments

Comments
 (0)