diff --git a/include/rm.h b/include/rm.h index f0382870f..e22f48054 100644 --- a/include/rm.h +++ b/include/rm.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 rm.h $NHDT-Date: 1684058570 2023/05/14 10:02:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.107 $ */ +/* NetHack 3.7 rm.h $NHDT-Date: 1745114235 2025/04/19 17:57:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.120 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2017. */ /* NetHack may be freely redistributed. See license for details. */ @@ -164,10 +164,11 @@ struct rm { * | bit5 | bit4 | bit3 | bit2 | bit1 | * | 0x10 | 0x8 | 0x4 | 0x2 | 0x1 | * +-------------+-------------+------------+------------+------------+ + * wall |W_NONPASSWALL|W_NONDIGGABLE| W_MASK | W_MASK | W_MASK | * door |D_TRAPPED | D_LOCKED | D_CLOSED | D_ISOPEN | D_BROKEN | * |D_WARNED | | | | | + * sdoor |D_TRAPPED | D_LOCKED | W_MASK | W_MASK | W_MASK | * drawbr. |DB_FLOOR | DB_ICE | DB_LAVA | DB_DIR | DB_DIR | - * wall |W_NONPASSWALL|W_NONDIGGABLE| W_MASK | W_MASK | W_MASK | * sink | | | S_LRING | S_LDWASHER | S_LPUDDING | * tree | | | | TREE_SWARM | TREE_LOOTED| * throne | | | | | T_LOOTED | @@ -191,8 +192,8 @@ struct rm { * it isn't set to D_LOCKED (see cvt_sdoor_to_door() in detect.c). * * D_LOCKED conflicts with W_NONDIGGABLE but the latter is not - * expected to be used on door locations. D_TRAPPED conflicts - * with W_NONPASSWALL but secret doors aren't trapped. + * expected to be used on door locations. + * D_TRAPPED conflicts with W_NONPASSWALL. * D_SECRET would not fit within struct rm's 5-bit 'flags' field. */ @@ -205,6 +206,10 @@ struct rm { #define icedpool flags /* used for ice (in case it melts) */ #define emptygrave flags /* no corpse in grave */ +/* candig is used for floor trap locations so is available for overload + on walls, doors, secret doors, and furniture */ +#define arboreal_sdoor candig + /* * The 5 possible states of doors. * For historical reasons they are numbered as mask bits rather than 0..4. @@ -219,9 +224,6 @@ 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 */ /* diff --git a/src/detect.c b/src/detect.c index 89476dc88..61e5dd3d6 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 detect.c $NHDT-Date: 1721684299 2024/07/22 21:38:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.180 $ */ +/* NetHack 3.7 detect.c $NHDT-Date: 1745114235 2025/04/19 17:57:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.190 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1584,11 +1584,11 @@ do_vicinity_map( docrt(); } -/* convert a secret door into a normal door */ +/* convert a secret door into a normal door; it might be trapped */ void cvt_sdoor_to_door(struct rm *lev) { - int newmask = lev->doormask & ~(WM_MASK | D_ARBOREAL); + int newmask = lev->doormask & ~WM_MASK; if (Is_rogue_level(&u.uz)) { /* rogue didn't have doors, only doorways */ @@ -1600,6 +1600,7 @@ cvt_sdoor_to_door(struct rm *lev) } lev->typ = DOOR; lev->doormask = newmask; + lev->arboreal_sdoor = 0; /* clears 'candig' */ } /* update the map for something which has just been found by wand of secret diff --git a/src/display.c b/src/display.c index c14165c3d..ba1841cca 100644 --- a/src/display.c +++ b/src/display.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 display.c $NHDT-Date: 1723834773 2024/08/16 18:59:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.244 $ */ +/* NetHack 3.7 display.c $NHDT-Date: 1745114235 2025/04/19 17:57:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.260 $ */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* and Dave Cohrs, 1990. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2291,7 +2291,7 @@ back_to_glyph(coordxy x, coordxy y) idx = (ptr->waslit || flags.lit_corridor) ? S_litcorr : S_corr; break; case SDOOR: - if ((ptr->doormask & D_ARBOREAL) != 0) { + if (ptr->arboreal_sdoor) { idx = S_tree; break; } @@ -3586,7 +3586,7 @@ wall_angle(struct rm *lev) break; case SDOOR: - if ((lev->doormask & D_ARBOREAL) != 0) { + if (lev->arboreal_sdoor) { idx = S_tree; break; } diff --git a/src/mkmaze.c b/src/mkmaze.c index 799c2b6b8..debc686cd 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mkmaze.c $NHDT-Date: 1737387068 2025/01/20 07:31:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.176 $ */ +/* NetHack 3.7 mkmaze.c $NHDT-Date: 1745114235 2025/04/19 17:57:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.179 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Pasi Kallinen, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -81,7 +81,7 @@ set_levltyp(coordxy x, coordxy y, schar newtyp) /* 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; + levl[x][y].arboreal_sdoor = 1; return TRUE; } diff --git a/src/objnam.c b/src/objnam.c index 0816a4fd2..32091dfcc 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 objnam.c $NHDT-Date: 1737528848 2025/01/21 22:54:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.444 $ */ +/* NetHack 3.7 objnam.c $NHDT-Date: 1745114235 2025/04/19 17:57:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.453 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3770,10 +3770,9 @@ wizterrainwish(struct _readobjnam_data *d) lev->wall_info |= (old_wall_info & WM_MASK); /* set up trapped flag; open door states aren't eligible */ if (d->trapped == 2 /* 2: wish includes explicit "untrapped" */ - || secret /* secret doors can't be trapped due to their use - * of both doormask and wall_info; those both - * overlay rm->flags and partially conflict */ - || (lev->doormask & (D_LOCKED | D_CLOSED)) == 0) + || ((lev->doormask & (D_LOCKED | D_CLOSED)) == 0 + /* D_CLOSED is implicit for secret doors */ + && !secret)) d->trapped = 0; if (d->trapped) lev->doormask |= D_TRAPPED;