Various bits I had in progress before Michael's commit.

Mainly forget engravings when bones are saved instead of leaving them
flagged as seen for the next hero who gets the level.
This commit is contained in:
PatR
2024-12-19 18:18:11 -08:00
parent 21d35e768c
commit 8a7f3b2b6b
6 changed files with 37 additions and 17 deletions

View File

@@ -47,8 +47,7 @@ struct engr {
#define spot_shows_engravings(x,y) \ #define spot_shows_engravings(x,y) \
(levl[(x)][(y)].typ == CORR \ (levl[(x)][(y)].typ == CORR \
|| levl[(x)][(y)].typ == SCORR \
|| levl[(x)][(y)].typ == ICE \ || levl[(x)][(y)].typ == ICE \
|| levl[(x)][(y)].typ == ROOM ) || levl[(x)][(y)].typ == ROOM)
#endif /* ENGRAVE_H */ #endif /* ENGRAVE_H */

View File

@@ -959,6 +959,7 @@ extern void del_engr_at(coordxy, coordxy);
extern int freehand(void); extern int freehand(void);
extern int doengrave(void); extern int doengrave(void);
extern void sanitize_engravings(void); extern void sanitize_engravings(void);
extern void forget_engravings(void);
extern void engraving_sanity_check(void); extern void engraving_sanity_check(void);
extern void save_engravings(NHFILE *) NONNULLARG1; extern void save_engravings(NHFILE *) NONNULLARG1;
extern void rest_engravings(NHFILE *) NONNULLARG1; extern void rest_engravings(NHFILE *) NONNULLARG1;

View File

@@ -445,6 +445,7 @@ savebones(int how, time_t when, struct obj *corpse)
iter_mons(remove_mon_from_bones); /* send various unique monsters away, */ iter_mons(remove_mon_from_bones); /* send various unique monsters away, */
dmonsfree(); /* then discard dead or gone monsters */ dmonsfree(); /* then discard dead or gone monsters */
forget_engravings(); /* next hero won't have read any engravings yet */
/* mark all named fruits as nonexistent; if/when we come to instances /* mark all named fruits as nonexistent; if/when we come to instances
of any of them we'll mark those as existing (using goodfruit()) */ of any of them we'll mark those as existing (using goodfruit()) */
for (f = gf.ffruit; f; f = f->nextf) for (f = gf.ffruit; f; f = f->nextf)

View File

@@ -1404,7 +1404,7 @@ show_map_spot(coordxy x, coordxy y, boolean cnf)
if (!IS_FURNITURE(lev->typ)) { if (!IS_FURNITURE(lev->typ)) {
if ((t = t_at(x, y)) != 0 && t->tseen) { if ((t = t_at(x, y)) != 0 && t->tseen) {
map_trap(t, 1); map_trap(t, 1);
} else if ((ep = engr_at(x, y)) != 0) { } else if ((ep = engr_at(x, y)) != 0 && !cnf) {
map_engraving(ep, 1); map_engraving(ep, 1);
} else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) { } else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) {
show_glyph(x, y, oldglyph); show_glyph(x, y, oldglyph);

View File

@@ -420,8 +420,9 @@ unmap_object(coordxy x, coordxy y)
struct rm *lev = &levl[x][y]; struct rm *lev = &levl[x][y];
if (spot_shows_engravings(x, y) if (spot_shows_engravings(x, y)
&& (ep = engr_at(x, y)) != 0 && !covers_traps(x, y)) { && (ep = engr_at(x, y)) != 0 && !covers_traps(x, y)) {
ep->erevealed = 0; if (cansee(x, y))
ep->erevealed = 1;
map_engraving(ep, 0); map_engraving(ep, 0);
} else { } else {
map_background(x, y, 0); map_background(x, y, 0);
@@ -458,7 +459,7 @@ unmap_object(coordxy x, coordxy y)
map_trap(trap, show); \ map_trap(trap, show); \
} else if (spot_shows_engravings(x, y) \ } else if (spot_shows_engravings(x, y) \
&& (ml_ep = engr_at(x, y)) != 0 \ && (ml_ep = engr_at(x, y)) != 0 \
&& ml_ep->erevealed != 0 \ && ml_ep->erevealed \
&& !covers_traps(x, y)) { \ && !covers_traps(x, y)) { \
map_engraving(ml_ep, show); \ map_engraving(ml_ep, show); \
} else { \ } else { \
@@ -857,7 +858,7 @@ feel_location(coordxy x, coordxy y)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_darkroom)); show_glyph(x, y, lev->glyph = cmap_to_glyph(S_darkroom));
} }
} else { } else {
if ((ep = engr_at(x, y)) && !ep->erevealed && engr_can_be_felt(ep)) if ((ep = engr_at(x, y)) != 0 && engr_can_be_felt(ep))
ep->erevealed = 1; ep->erevealed = 1;
_map_location(x, y, 1); _map_location(x, y, 1);
@@ -959,6 +960,8 @@ newsym(coordxy x, coordxy y)
mon = m_at(x, y); mon = m_at(x, y);
worm_tail = is_worm_tail(mon); worm_tail = is_worm_tail(mon);
if ((ep = engr_at(x, y)) != 0)
ep->erevealed = 1; /* even when covered by objects or a monster */
/* /*
* Normal region shown only on accessible positions, but * Normal region shown only on accessible positions, but
* poison clouds and steam clouds also shown above lava, * poison clouds and steam clouds also shown above lava,
@@ -1020,8 +1023,6 @@ newsym(coordxy x, coordxy y)
} else if (glyph_is_invisible(lev->glyph)) { } else if (glyph_is_invisible(lev->glyph)) {
map_invisible(x, y); map_invisible(x, y);
} else { } else {
if ((ep = engr_at(x, y)) && !ep->erevealed)
ep->erevealed = 1;
_map_location(x, y, 1); /* map the location */ _map_location(x, y, 1); /* map the location */
} }
} }

View File

@@ -317,7 +317,7 @@ read_engr_at(coordxy x, coordxy y)
const char *eloc = surface(x, y); const char *eloc = surface(x, y);
int sensed = 0; int sensed = 0;
/* Sensing an engraving does not require sight, /* Sensing an engraving does not require sight for some engraving types,
* nor does it necessarily imply comprehension (literacy). * nor does it necessarily imply comprehension (literacy).
*/ */
if (ep && ep->engr_txt[actual_text][0]) { if (ep && ep->engr_txt[actual_text][0]) {
@@ -1467,6 +1467,22 @@ sanitize_engravings(void)
} }
} }
/* mark all engravings as not-discovered/not-read when saving bones */
void
forget_engravings(void)
{
struct engr *ep;
for (ep = head_engr; ep; ep = ep->nxt_engr) {
ep->erevealed = ep->eread = 0;
/* Note: engr_txt[actual_text], engr_txt[rememberd_text], and
* engr_txt[pristine_text] retain their original text rather
* than get updated to reflect each engraving's current text.
* Does it matter? */
}
}
void void
engraving_sanity_check(void) engraving_sanity_check(void)
{ {
@@ -1665,16 +1681,18 @@ see_engraving(struct engr *ep)
newsym(ep->engr_x, ep->engr_y); newsym(ep->engr_x, ep->engr_y);
} }
/* like see_engravings() but overrides vision, but /* like see_engravings() but overrides vision, but only for some types
only for some types of engravings that can be felt */ of engravings that can be felt [this isn't actually used anywhere?] */
void void
feel_engraving(struct engr *ep) feel_engraving(struct engr *ep)
{ {
ep->eread = 1; if (engr_can_be_felt(ep)) {
ep->erevealed = 1; ep->eread = 1;
map_engraving(ep, 1); ep->erevealed = 1;
/* in case it's beneath something, redisplay the something */ map_engraving(ep, 1);
newsym(ep->engr_x, ep->engr_y); /* in case it's beneath something, redisplay the something */
newsym(ep->engr_x, ep->engr_y);
}
} }
static const char blind_writing[][21] = { static const char blind_writing[][21] = {