'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
+4
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") vulnerable to one that was gave wrong message ("still constricts")
for accessibility reasons, give a message when monster teleports for accessibility reasons, give a message when monster teleports
if a gremlin stole intrinsic 'see invisible' the map wasn't updated properly 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 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 conversion utility so far; also supported by tilemap utility to
generate tile.c generate tile.c
tty: use bright colors directly on supporting terminals 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 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 unixconf.h from enabling SUSPEND without need to modify unixconf.h
X11: implement 'selectsaved', restore via menu of saved games X11: implement 'selectsaved', restore via menu of saved games
+2 -2
View File
@@ -3252,7 +3252,7 @@ maybe_wail(void)
} }
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 #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 */ * 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; g.killer.format = k_format;
if (g.killer.name != knam) /* the thing that killed you */ if (g.killer.name != knam) /* the thing that killed you */
Strcpy(g.killer.name, knam ? knam : ""); Strcpy(g.killer.name, knam ? knam : "");
You("die..."); custompline(URGENT_MESSAGE, "You die...");
done(DIED); done(DIED);
} else if (n > 0 && u.uhp * 10 < u.uhpmax) { } else if (n > 0 && u.uhp * 10 < u.uhpmax) {
maybe_wail(); maybe_wail();
+11 -8
View File
@@ -1838,11 +1838,12 @@ doseduce(struct monst *mon)
} }
naked = (!uarmc && !uarmf && !uarmg && !uarms && !uarmh && !uarmu); naked = (!uarmc && !uarmf && !uarmg && !uarms && !uarmh && !uarmu);
pline("%s %s%s.", Who, custompline(URGENT_MESSAGE,
Deaf ? "seems to murmur into your ear" "%s %s%s.", Who,
: naked ? "murmurs sweet nothings into your ear" Deaf ? "seems to murmur into your ear"
: "murmurs in your ear", : naked ? "murmurs sweet nothings into your ear"
naked ? "" : ", while helping you undress"); : "murmurs in your ear",
naked ? "" : ", while helping you undress");
mayberem(mon, Who, uarmc, cloak_simple_name(uarmc)); mayberem(mon, Who, uarmc, cloak_simple_name(uarmc));
if (!uarmc) if (!uarmc)
mayberem(mon, Who, uarm, suit_simple_name(uarm)); mayberem(mon, Who, uarm, suit_simple_name(uarm));
@@ -1878,7 +1879,8 @@ doseduce(struct monst *mon)
verbalize("Well, then you owe me %s%s!", verbalize("Well, then you owe me %s%s!",
yourgloves ? yname(yourgloves) yourgloves ? yname(yourgloves)
: "twelve pairs of gloves", : "twelve pairs of gloves",
yourgloves ? " and eleven more pairs of gloves" : ""); yourgloves ? " and eleven more pairs of gloves"
: "");
} }
} else if (seewho) } else if (seewho)
pline("%s appears to sigh.", Monnam(mon)); pline("%s appears to sigh.", Monnam(mon));
@@ -1892,8 +1894,9 @@ doseduce(struct monst *mon)
adjalign(1); adjalign(1);
/* by this point you have discovered mon's identity, blind or not... */ /* 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...", custompline(URGENT_MESSAGE,
noit_mon_nam(mon)); "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 /* 3.6.1: a combined total for charisma plus intelligence of 35-1
used to guarantee successful outcome; now total maxes out at 32 used to guarantee successful outcome; now total maxes out at 32
as far as deciding what will happen; chance for bad outcome when as far as deciding what will happen; chance for bad outcome when
+3 -2
View File
@@ -2392,8 +2392,9 @@ in_container(struct obj *obj)
} }
} else if (Is_mbag(g.current_container) && mbag_explodes(obj, 0)) { } else if (Is_mbag(g.current_container) && mbag_explodes(obj, 0)) {
/* explicitly mention what item is triggering the explosion */ /* explicitly mention what item is triggering the explosion */
pline("As you put %s inside, you are blasted by a magical explosion!", custompline(URGENT_MESSAGE,
doname(obj)); "As you put %s inside, you are blasted by a magical explosion!",
doname(obj));
/* did not actually insert obj yet */ /* did not actually insert obj yet */
if (was_unpaid) if (was_unpaid)
addtobill(obj, FALSE, FALSE, TRUE); addtobill(obj, FALSE, FALSE, TRUE);
+2 -2
View File
@@ -2467,7 +2467,7 @@ do_class_genocide(void)
u.mh = -1; u.mh = -1;
if (Unchanging) { if (Unchanging) {
if (!feel_dead++) if (!feel_dead++)
You("die."); custompline(URGENT_MESSAGE, "You die.");
/* finish genociding this class of /* finish genociding this class of
monsters before ultimately dying */ monsters before ultimately dying */
gameover = TRUE; gameover = TRUE;
@@ -2484,7 +2484,7 @@ do_class_genocide(void)
You_feel("%s inside.", udeadinside()); You_feel("%s inside.", udeadinside());
} else { } else {
if (!feel_dead++) if (!feel_dead++)
You("die."); custompline(URGENT_MESSAGE, "You die.");
gameover = TRUE; gameover = TRUE;
} }
} }
+20 -18
View File
@@ -428,22 +428,23 @@ steal(struct monst* mtmp, char* objnambuf)
unmul((char *) 0); unmul((char *) 0);
slowly = (armordelay >= 1 || g.multi < 0); slowly = (armordelay >= 1 || g.multi < 0);
if (flags.female) if (flags.female)
pline("%s charms you. You gladly %s your %s.", custompline(URGENT_MESSAGE,
!seen ? "She" : Monnam(mtmp), "%s charms you. You gladly %s your %s.",
curssv ? "let her take" !seen ? "She" : Monnam(mtmp),
: !slowly ? "hand over" curssv ? "let her take"
: was_doffing ? "continue removing" : !slowly ? "hand over"
: "start removing", : was_doffing ? "continue removing"
equipname(otmp)); : "start removing",
equipname(otmp));
else else
pline("%s seduces you and %s off your %s.", custompline(URGENT_MESSAGE,
!seen ? "She" : Adjmonnam(mtmp, "beautiful"), "%s seduces you and %s off your %s.",
curssv !seen ? "She" : Adjmonnam(mtmp, "beautiful"),
? "helps you to take" curssv ? "helps you to take"
: !slowly ? "you take" : !slowly ? "you take"
: was_doffing ? "you continue taking" : was_doffing ? "you continue taking"
: "you start taking", : "you start taking",
equipname(otmp)); equipname(otmp));
named++; named++;
/* the following is to set multi for later on */ /* the following is to set multi for later on */
nomul(-armordelay); nomul(-armordelay);
@@ -478,9 +479,10 @@ steal(struct monst* mtmp, char* objnambuf)
subfrombill(otmp, shop_keeper(*u.ushops)); subfrombill(otmp, shop_keeper(*u.ushops));
freeinv(otmp); freeinv(otmp);
/* if attached ball was taken, uball and uchain are now Null */ /* if attached ball was taken, uball and uchain are now Null */
pline("%s%s stole %s.", named ? "She" : Monnam(mtmp), custompline(URGENT_MESSAGE,
(was_punished && !Punished) ? " removed your chain and" : "", "%s%s stole %s.", named ? "She" : Monnam(mtmp),
doname(otmp)); (was_punished && !Punished) ? " removed your chain and" : "",
doname(otmp));
could_petrify = (otmp->otyp == CORPSE could_petrify = (otmp->otyp == CORPSE
&& touch_petrifies(&mons[otmp->corpsenm])); && touch_petrifies(&mons[otmp->corpsenm]));
(void) mpickobj(mtmp, otmp); /* may free otmp */ (void) mpickobj(mtmp, otmp); /* may free otmp */
+1 -1
View File
@@ -2635,7 +2635,7 @@ zapyourself(struct obj *obj, boolean ordinary)
Sprintf(g.killer.name, "shot %sself with a death ray", uhim()); Sprintf(g.killer.name, "shot %sself with a death ray", uhim());
g.killer.format = NO_KILLER_PREFIX; g.killer.format = NO_KILLER_PREFIX;
You("irradiate yourself with pure energy!"); You("irradiate yourself with pure energy!");
You("die."); custompline(URGENT_MESSAGE, "You die.");
/* They might survive with an amulet of life saving */ /* They might survive with an amulet of life saving */
done(DIED); done(DIED);
break; break;
+3 -2
View File
@@ -582,8 +582,9 @@ msghistory_snapshot(boolean purge) /* clear message history buffer
/* release memory allocated to message history snapshot */ /* release memory allocated to message history snapshot */
static void static void
free_msghistory_snapshot(boolean purged) /* True: took history's pointers, free_msghistory_snapshot(
False: just cloned them */ boolean purged) /* True: took history's pointers,
* False: just cloned them */
{ {
if (snapshot_mesgs) { if (snapshot_mesgs) {
/* snapshot pointers are no longer in use */ /* snapshot pointers are no longer in use */
+9 -3
View File
@@ -109,9 +109,9 @@ struct window_procs tty_procs = {
| WC2_HILITE_STATUS | WC2_HITPOINTBAR | WC2_FLUSH_STATUS | WC2_HILITE_STATUS | WC2_HITPOINTBAR | WC2_FLUSH_STATUS
| WC2_RESET_STATUS | WC2_RESET_STATUS
#endif #endif
| WC2_DARKGRAY | WC2_SUPPRESS_HIST | WC2_STATUSLINES), | WC2_DARKGRAY | WC2_SUPPRESS_HIST | WC2_URGENT_MESG | WC2_STATUSLINES),
#ifdef TEXTCOLOR #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 #else
{1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1},
#endif #endif
@@ -2662,7 +2662,13 @@ tty_putstr(winid window, int attr, const char *str)
switch (cw->type) { switch (cw->type) {
case NHW_MESSAGE: { 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 /* in case we ever support display attributes for topline
messages, clear flag mask leaving only display attr */ messages, clear flag mask leaving only display attr */