'urgent' messages

Follow up on some old groundwork.  For tty, if the core has designated
a message as 'urgent', override any message suppression taking place
because of ESC typed at the --More-- prompt.  Right now, "You die"
messages, feedback about having something stolen, feedback for
"amorous demon" interaction (mainly in case of armor removal), and
exploding a bag of holding are treated as urgent.

The "You die" case is already handled by a hack in top-line handling;
I left that in place so the conversion of 3 or 4 pline("You die.*")
to custompline(URGENT_MESSAGE, "You die.*") was redundant.  There
are probably various non-You_die messages which precede done() which
should be marked urgent too.

Other interfaces might want to do something similar.  And we ought to
implement MSGTYPE=force or MSGTYPE=urgent to allow players to indicate
other messages that they want have to override suppression.  But I'm
not intending to work on either of those.  I mainly wanted to force
the magic bag explosion message to be shown since a sequence of "You
put <foo> into <bag>." messages is a likely candidate for --More--ESC.
This commit is contained in:
PatR
2021-12-17 17:46:49 -08:00
parent 420afb6b1f
commit 420d121f93
9 changed files with 55 additions and 38 deletions

View File

@@ -712,6 +712,8 @@ polymorphing while wearing an amulet of strangulation from a form that wasn't
vulnerable to one that was gave wrong message ("still constricts")
for accessibility reasons, give a message when monster teleports
if a gremlin stole intrinsic 'see invisible' the map wasn't updated properly
mark some messages as urgent ("You die*.", having equipment stolen, being
caught in a magical explosion)
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
@@ -1323,6 +1325,8 @@ tiles: male and female variations in monsters.txt; tested only with tile2bmp
conversion utility so far; also supported by tilemap utility to
generate tile.c
tty: use bright colors directly on supporting terminals
tty: if a message is marked urgent, override message suppression initiated
by user having typed ESC at previous --More-- prompt
Unix: can define NOSUSPEND in config.h or src/Makefile's CFLAGS to prevent
unixconf.h from enabling SUSPEND without need to modify unixconf.h
X11: implement 'selectsaved', restore via menu of saved games

View File

@@ -3252,7 +3252,7 @@ maybe_wail(void)
}
void
losehp(register int n, register const char *knam, boolean k_format)
losehp(int n, const char *knam, boolean k_format)
{
#if 0 /* code below is prepared to handle negative 'loss' so don't add this
* until we've verified that no callers intentionally rely on that */
@@ -3281,7 +3281,7 @@ losehp(register int n, register const char *knam, boolean k_format)
g.killer.format = k_format;
if (g.killer.name != knam) /* the thing that killed you */
Strcpy(g.killer.name, knam ? knam : "");
You("die...");
custompline(URGENT_MESSAGE, "You die...");
done(DIED);
} else if (n > 0 && u.uhp * 10 < u.uhpmax) {
maybe_wail();

View File

@@ -1838,11 +1838,12 @@ doseduce(struct monst *mon)
}
naked = (!uarmc && !uarmf && !uarmg && !uarms && !uarmh && !uarmu);
pline("%s %s%s.", Who,
Deaf ? "seems to murmur into your ear"
: naked ? "murmurs sweet nothings into your ear"
: "murmurs in your ear",
naked ? "" : ", while helping you undress");
custompline(URGENT_MESSAGE,
"%s %s%s.", Who,
Deaf ? "seems to murmur into your ear"
: naked ? "murmurs sweet nothings into your ear"
: "murmurs in your ear",
naked ? "" : ", while helping you undress");
mayberem(mon, Who, uarmc, cloak_simple_name(uarmc));
if (!uarmc)
mayberem(mon, Who, uarm, suit_simple_name(uarm));
@@ -1878,7 +1879,8 @@ doseduce(struct monst *mon)
verbalize("Well, then you owe me %s%s!",
yourgloves ? yname(yourgloves)
: "twelve pairs of gloves",
yourgloves ? " and eleven more pairs of gloves" : "");
yourgloves ? " and eleven more pairs of gloves"
: "");
}
} else if (seewho)
pline("%s appears to sigh.", Monnam(mon));
@@ -1892,8 +1894,9 @@ doseduce(struct monst *mon)
adjalign(1);
/* by this point you have discovered mon's identity, blind or not... */
pline("Time stands still while you and %s lie in each other's arms...",
noit_mon_nam(mon));
custompline(URGENT_MESSAGE,
"Time stands still while you and %s lie in each other's arms...",
noit_mon_nam(mon));
/* 3.6.1: a combined total for charisma plus intelligence of 35-1
used to guarantee successful outcome; now total maxes out at 32
as far as deciding what will happen; chance for bad outcome when

View File

@@ -2392,8 +2392,9 @@ in_container(struct obj *obj)
}
} else if (Is_mbag(g.current_container) && mbag_explodes(obj, 0)) {
/* explicitly mention what item is triggering the explosion */
pline("As you put %s inside, you are blasted by a magical explosion!",
doname(obj));
custompline(URGENT_MESSAGE,
"As you put %s inside, you are blasted by a magical explosion!",
doname(obj));
/* did not actually insert obj yet */
if (was_unpaid)
addtobill(obj, FALSE, FALSE, TRUE);

View File

@@ -2467,7 +2467,7 @@ do_class_genocide(void)
u.mh = -1;
if (Unchanging) {
if (!feel_dead++)
You("die.");
custompline(URGENT_MESSAGE, "You die.");
/* finish genociding this class of
monsters before ultimately dying */
gameover = TRUE;
@@ -2484,7 +2484,7 @@ do_class_genocide(void)
You_feel("%s inside.", udeadinside());
} else {
if (!feel_dead++)
You("die.");
custompline(URGENT_MESSAGE, "You die.");
gameover = TRUE;
}
}

View File

@@ -428,22 +428,23 @@ steal(struct monst* mtmp, char* objnambuf)
unmul((char *) 0);
slowly = (armordelay >= 1 || g.multi < 0);
if (flags.female)
pline("%s charms you. You gladly %s your %s.",
!seen ? "She" : Monnam(mtmp),
curssv ? "let her take"
: !slowly ? "hand over"
: was_doffing ? "continue removing"
: "start removing",
equipname(otmp));
custompline(URGENT_MESSAGE,
"%s charms you. You gladly %s your %s.",
!seen ? "She" : Monnam(mtmp),
curssv ? "let her take"
: !slowly ? "hand over"
: was_doffing ? "continue removing"
: "start removing",
equipname(otmp));
else
pline("%s seduces you and %s off your %s.",
!seen ? "She" : Adjmonnam(mtmp, "beautiful"),
curssv
? "helps you to take"
: !slowly ? "you take"
: was_doffing ? "you continue taking"
: "you start taking",
equipname(otmp));
custompline(URGENT_MESSAGE,
"%s seduces you and %s off your %s.",
!seen ? "She" : Adjmonnam(mtmp, "beautiful"),
curssv ? "helps you to take"
: !slowly ? "you take"
: was_doffing ? "you continue taking"
: "you start taking",
equipname(otmp));
named++;
/* the following is to set multi for later on */
nomul(-armordelay);
@@ -478,9 +479,10 @@ steal(struct monst* mtmp, char* objnambuf)
subfrombill(otmp, shop_keeper(*u.ushops));
freeinv(otmp);
/* if attached ball was taken, uball and uchain are now Null */
pline("%s%s stole %s.", named ? "She" : Monnam(mtmp),
(was_punished && !Punished) ? " removed your chain and" : "",
doname(otmp));
custompline(URGENT_MESSAGE,
"%s%s stole %s.", named ? "She" : Monnam(mtmp),
(was_punished && !Punished) ? " removed your chain and" : "",
doname(otmp));
could_petrify = (otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm]));
(void) mpickobj(mtmp, otmp); /* may free otmp */

View File

@@ -2635,7 +2635,7 @@ zapyourself(struct obj *obj, boolean ordinary)
Sprintf(g.killer.name, "shot %sself with a death ray", uhim());
g.killer.format = NO_KILLER_PREFIX;
You("irradiate yourself with pure energy!");
You("die.");
custompline(URGENT_MESSAGE, "You die.");
/* They might survive with an amulet of life saving */
done(DIED);
break;

View File

@@ -582,8 +582,9 @@ msghistory_snapshot(boolean purge) /* clear message history buffer
/* release memory allocated to message history snapshot */
static void
free_msghistory_snapshot(boolean purged) /* True: took history's pointers,
False: just cloned them */
free_msghistory_snapshot(
boolean purged) /* True: took history's pointers,
* False: just cloned them */
{
if (snapshot_mesgs) {
/* snapshot pointers are no longer in use */

View File

@@ -109,9 +109,9 @@ struct window_procs tty_procs = {
| WC2_HILITE_STATUS | WC2_HITPOINTBAR | WC2_FLUSH_STATUS
| WC2_RESET_STATUS
#endif
| WC2_DARKGRAY | WC2_SUPPRESS_HIST | WC2_STATUSLINES),
| WC2_DARKGRAY | WC2_SUPPRESS_HIST | WC2_URGENT_MESG | WC2_STATUSLINES),
#ifdef TEXTCOLOR
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
#else
{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1},
#endif
@@ -2662,7 +2662,13 @@ tty_putstr(winid window, int attr, const char *str)
switch (cw->type) {
case NHW_MESSAGE: {
int suppress_history = (attr & ATR_NOHISTORY);
int suppress_history = (attr & ATR_NOHISTORY),
urgent_message = (attr & ATR_URGENT);
/* if message is designated 'urgent' don't suppress it if user has
typed ESC at --More-- prompt when dismissing an earlier message */
if (urgent_message)
cw->flags &= ~WIN_STOP;
/* in case we ever support display attributes for topline
messages, clear flag mask leaving only display attr */