Revisit the Valkyrie goal level hack

Instead of hardcoding the lava terrain change in core, if the stairs
are created in a fixed location, force the terrain to room floor first.
Move the surrounding lava changing to room floor to the Val-goal lua
file.
This commit is contained in:
Pasi Kallinen
2022-04-15 18:52:46 +03:00
parent a15b587b81
commit cb02ce88c5
5 changed files with 17 additions and 24 deletions

View File

@@ -32,6 +32,8 @@ xxxxxxxxx..................xxxxxxxx
des.region(selection.area(00,00,34,16), "lit") des.region(selection.area(00,00,34,16), "lit")
-- Stairs -- Stairs
-- Note: The up stairs are *intentionally* off of the map. -- Note: The up stairs are *intentionally* off of the map.
-- if the stairs are surrounded by lava, maybe give some room
des.replace_terrain({ region = {44,09, 46,11}, fromterrain='L', toterrain='.', chance=50 });
des.stair("up", 45,10) des.stair("up", 45,10)
-- Non diggable walls -- Non diggable walls
des.non_diggable(selection.area(00,00,34,16)) des.non_diggable(selection.area(00,00,34,16))

View File

@@ -1348,7 +1348,7 @@ extern boolean occupied(xchar, xchar);
extern int okdoor(xchar, xchar); extern int okdoor(xchar, xchar);
extern void dodoor(int, int, struct mkroom *); extern void dodoor(int, int, struct mkroom *);
extern void mktrap(int, int, struct mkroom *, coord *); extern void mktrap(int, int, struct mkroom *, coord *);
extern void mkstairs(xchar, xchar, char, struct mkroom *); extern void mkstairs(xchar, xchar, char, struct mkroom *, boolean);
extern void mkinvokearea(void); extern void mkinvokearea(void);
extern void mineralize(int, int, int, int, boolean); extern void mineralize(int, int, int, int, boolean);

View File

@@ -1619,11 +1619,14 @@ mktrap(
} }
} }
/* Create stairs up or down at x,y.
If force is TRUE, change the terrain to ROOM first */
void void
mkstairs( mkstairs(
xchar x, xchar y, xchar x, xchar y,
char up, /* [why 'char' when usage is boolean?] */ char up, /* [why 'char' when usage is boolean?] */
struct mkroom *croom UNUSED) struct mkroom *croom UNUSED,
boolean force)
{ {
int ltyp; int ltyp;
d_level dest; d_level dest;
@@ -1632,6 +1635,8 @@ mkstairs(
impossible("mkstairs: bogus stair attempt at <%d,%d>", x, y); impossible("mkstairs: bogus stair attempt at <%d,%d>", x, y);
return; return;
} }
if (force)
levl[x][y].typ = ROOM;
ltyp = levl[x][y].typ; /* somexyspace() allows ice */ ltyp = levl[x][y].typ; /* somexyspace() allows ice */
if (ltyp != ROOM && ltyp != CORR && ltyp != ICE) { if (ltyp != ROOM && ltyp != CORR && ltyp != ICE) {
int glyph = back_to_glyph(x, y), int glyph = back_to_glyph(x, y),
@@ -1718,7 +1723,7 @@ generate_stairs(void)
pos.x = somex(croom); pos.x = somex(croom);
pos.y = somey(croom); pos.y = somey(croom);
} }
mkstairs(pos.x, pos.y, 0, croom); /* down */ mkstairs(pos.x, pos.y, 0, croom, FALSE); /* down */
} }
if (g.nroom > 1) if (g.nroom > 1)
@@ -1729,7 +1734,7 @@ generate_stairs(void)
pos.x = somex(croom); pos.x = somex(croom);
pos.y = somey(croom); pos.y = somey(croom);
} }
mkstairs(pos.x, pos.y, 1, croom); /* up */ mkstairs(pos.x, pos.y, 1, croom, FALSE); /* up */
} }
} }
@@ -1920,7 +1925,7 @@ mkinvokearea(void)
} }
You("are standing at the top of a stairwell leading down!"); You("are standing at the top of a stairwell leading down!");
mkstairs(u.ux, u.uy, 0, (struct mkroom *) 0); /* down */ mkstairs(u.ux, u.uy, 0, (struct mkroom *) 0, FALSE); /* down */
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
g.vision_full_recalc = 1; /* everything changed */ g.vision_full_recalc = 1; /* everything changed */
} }

View File

@@ -392,7 +392,7 @@ put_lregion_here(
break; break;
case LR_DOWNSTAIR: case LR_DOWNSTAIR:
case LR_UPSTAIR: case LR_UPSTAIR:
mkstairs(x, y, (char) rtype, (struct mkroom *) 0); mkstairs(x, y, (char) rtype, (struct mkroom *) 0, FALSE);
break; break;
case LR_BRANCH: case LR_BRANCH:
place_branch(Is_branchlev(&u.uz), x, y); place_branch(Is_branchlev(&u.uz), x, y);
@@ -1043,10 +1043,10 @@ makemaz(const char *s)
wallification(2, 2, g.x_maze_max, g.y_maze_max); wallification(2, 2, g.x_maze_max, g.y_maze_max);
mazexy(&mm); mazexy(&mm);
mkstairs(mm.x, mm.y, 1, (struct mkroom *) 0); /* up */ mkstairs(mm.x, mm.y, 1, (struct mkroom *) 0, FALSE); /* up */
if (!Invocation_lev(&u.uz)) { if (!Invocation_lev(&u.uz)) {
mazexy(&mm); mazexy(&mm);
mkstairs(mm.x, mm.y, 0, (struct mkroom *) 0); /* down */ mkstairs(mm.x, mm.y, 0, (struct mkroom *) 0, FALSE); /* down */
} else { /* choose "vibrating square" location */ } else { /* choose "vibrating square" location */
stairway *stway; stairway *stway;
int trycnt = 0; int trycnt = 0;

View File

@@ -3905,22 +3905,8 @@ l_create_stairway(lua_State *L, boolean using_ladder)
levl[x][y].ladder = LA_DOWN; levl[x][y].ladder = LA_DOWN;
} }
} else { } else {
/* hack for Valkyrie goal level where upstairs are at a fixed mkstairs(x, y, (char) up, g.coder->croom,
location outside the mapped area; make sure they don't get !(scoord & SP_COORD_IS_RANDOM));
placed on a lava spot */
if (levl[x][y].typ == LAVAPOOL) {
int tx, ty;
for (tx = x - 1; tx <= x + 1; ++tx)
for (ty = y - 1; ty <= y + 1; ++ty)
if (isok(tx, ty) && levl[tx][ty].typ == LAVAPOOL
&& ((tx == x && ty == y) || !rn2(2))) {
levl[tx][ty].typ = ROOM;
SpLev_Map[tx][ty] = 1;
}
}
mkstairs(x, y, (char) up, g.coder->croom);
} }
return 0; return 0;
} }