fix issue #1309 - secret doors in Garden rooms

Issue reported by elunna:  when a room gets converted into a theme
room with fill type Garden, its walls are changed to trees but any
secret doors in those walls are still displayed as regular walls.

This adds a new D_ARBOREAL flag for secret doors, used to force them
to be displayed as a tree instead of a wall.

Fixes #1309
This commit is contained in:
PatR
2025-04-12 17:21:40 -07:00
parent 8f344a30b5
commit e26a496088
5 changed files with 28 additions and 4 deletions

View File

@@ -1071,7 +1071,10 @@ end
-- postprocess callback: turn room walls into trees
function make_garden_walls(data)
local sel = data.sel:grow();
-- change walls to trees
des.replace_terrain({ selection = sel, fromterrain="w", toterrain = "T" });
-- update secret doors; attempting to change to AIR will set arboreal flag
des.replace_terrain({ selection = sel, fromterrain="S", toterrain = "A" });
end
-- postprocess callback: make a trap

View File

@@ -219,6 +219,9 @@ struct rm {
#define D_LOCKED 0x08
#define D_TRAPPED 0x10
/* secret doors aren't trapped or nonpasswall; overload D_TRAPPED and
W_NONPASSWALL for 'arboreal' secret doors (in garden theme room) */
#define D_ARBOREAL D_TRAPPED
#define D_SECRET 0x20 /* only used by sp_lev.c, NOT in rm-struct */
/*

View File

@@ -1588,7 +1588,7 @@ do_vicinity_map(
void
cvt_sdoor_to_door(struct rm *lev)
{
int newmask = lev->doormask & ~WM_MASK;
int newmask = lev->doormask & ~(WM_MASK | D_ARBOREAL);
if (Is_rogue_level(&u.uz)) {
/* rogue didn't have doors, only doorways */

View File

@@ -2289,6 +2289,13 @@ back_to_glyph(coordxy x, coordxy y)
case CORR:
idx = (ptr->waslit || flags.lit_corridor) ? S_litcorr : S_corr;
break;
case SDOOR:
if ((ptr->doormask & D_ARBOREAL) != 0) {
idx = S_tree;
break;
}
FALLTHROUGH;
/*FALLTHRU*/
case HWALL:
case VWALL:
case TLCORNER:
@@ -2300,7 +2307,6 @@ back_to_glyph(coordxy x, coordxy y)
case TDWALL:
case TLWALL:
case TRWALL:
case SDOOR:
idx = ptr->seenv ? wall_angle(ptr) : S_stone;
break;
case DOOR:
@@ -3579,6 +3585,10 @@ wall_angle(struct rm *lev)
break;
case SDOOR:
if ((lev->doormask & D_ARBOREAL) != 0) {
idx = S_tree;
break;
}
if (lev->horizontal)
goto horiz;
FALLTHROUGH;

View File

@@ -76,8 +76,16 @@ boolean
set_levltyp(coordxy x, coordxy y, schar newtyp)
{
if (isok(x, y) && newtyp >= STONE && newtyp < MAX_TYPE) {
if (CAN_OVERWRITE_TERRAIN(levl[x][y].typ)) {
schar oldtyp = levl[x][y].typ;
schar oldtyp = levl[x][y].typ;
/* hack for secret doors in garden theme rooms */
if (oldtyp == SDOOR && newtyp == AIR) {
/* levl[][].typ stays SDOOR rather than change to AIR */
levl[x][y].doormask |= D_ARBOREAL;
return TRUE;
}
if (CAN_OVERWRITE_TERRAIN(oldtyp)) {
/* typ==ICE || (typ==DRAWBRIDGE_UP && drawbridgemask==DB_ICE) */
boolean was_ice = is_ice(x, y);