Accessibility: more message locations

Add a new pline_mon() which sets the message location
to the monster location.

Add locations to several trap messages.
This commit is contained in:
Pasi Kallinen
2024-06-13 19:04:30 +03:00
parent a86b9e6899
commit a72b95e4bc
10 changed files with 113 additions and 70 deletions

View File

@@ -2359,6 +2359,7 @@ extern void dumplogfreemessages(void);
extern void pline(const char *, ...) PRINTF_F(1, 2); extern void pline(const char *, ...) PRINTF_F(1, 2);
extern void pline_dir(int, const char *, ...) PRINTF_F(2, 3); extern void pline_dir(int, const char *, ...) PRINTF_F(2, 3);
extern void pline_xy(coordxy, coordxy, const char *, ...) PRINTF_F(3, 4); extern void pline_xy(coordxy, coordxy, const char *, ...) PRINTF_F(3, 4);
extern void pline_mon(struct monst *, const char *, ...) PRINTF_F(2, 3) NONNULLARG1;
extern void set_msg_dir(int); extern void set_msg_dir(int);
extern void set_msg_xy(coordxy, coordxy); extern void set_msg_xy(coordxy, coordxy);
extern void custompline(unsigned, const char *, ...) PRINTF_F(2, 3); extern void custompline(unsigned, const char *, ...) PRINTF_F(2, 3);

View File

@@ -63,8 +63,7 @@ cursetxt(struct monst *mtmp, boolean undirected)
else else
point_msg = "at you, then curses"; point_msg = "at you, then curses";
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp, "%s points %s.", Monnam(mtmp), point_msg);
"%s points %s.", Monnam(mtmp), point_msg);
} else if ((!(gm.moves % 4) || !rn2(4))) { } else if ((!(gm.moves % 4) || !rn2(4))) {
if (!Deaf) if (!Deaf)
Norep("You hear a mumbled curse."); /* Deaf-aware */ Norep("You hear a mumbled curse."); /* Deaf-aware */
@@ -245,7 +244,7 @@ castmu(
*/ */
if (!foundyou && thinks_it_foundyou if (!foundyou && thinks_it_foundyou
&& !is_undirected_spell(mattk->adtyp, spellnum)) { && !is_undirected_spell(mattk->adtyp, spellnum)) {
pline_xy(mtmp->mx, mtmp->my, "%s casts a spell at %s!", pline_mon(mtmp, "%s casts a spell at %s!",
canseemon(mtmp) ? Monnam(mtmp) : "Something", canseemon(mtmp) ? Monnam(mtmp) : "Something",
is_waterwall(mtmp->mux, mtmp->muy) ? "empty water" is_waterwall(mtmp->mux, mtmp->muy) ? "empty water"
: "thin air"); : "thin air");
@@ -262,7 +261,7 @@ castmu(
return M_ATTK_MISS; return M_ATTK_MISS;
} }
if (canspotmon(mtmp) || !is_undirected_spell(mattk->adtyp, spellnum)) { if (canspotmon(mtmp) || !is_undirected_spell(mattk->adtyp, spellnum)) {
pline_xy(mtmp->mx, mtmp->my, "%s casts a spell%s!", pline_mon(mtmp, "%s casts a spell%s!",
canspotmon(mtmp) ? Monnam(mtmp) : "Something", canspotmon(mtmp) ? Monnam(mtmp) : "Something",
is_undirected_spell(mattk->adtyp, spellnum) ? "" is_undirected_spell(mattk->adtyp, spellnum) ? ""
: (Invis && !perceives(mtmp->data) : (Invis && !perceives(mtmp->data)

View File

@@ -35,7 +35,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
if same gender, "engagingly" for nymph, normal msg for others. */ if same gender, "engagingly" for nymph, normal msg for others. */
if ((compat = could_seduce(mtmp, &gy.youmonst, mattk)) != 0 if ((compat = could_seduce(mtmp, &gy.youmonst, mattk)) != 0
&& !mtmp->mcan && !mtmp->mspec_used) { && !mtmp->mcan && !mtmp->mspec_used) {
pline_xy(mtmp->mx, mtmp->my, "%s %s you %s.", Monst_name, pline_mon(mtmp, "%s %s you %s.", Monst_name,
!Blind ? "smiles at" : !Deaf ? "talks to" : "touches", !Blind ? "smiles at" : !Deaf ? "talks to" : "touches",
(compat == 2) ? "engagingly" : "seductively"); (compat == 2) ? "engagingly" : "seductively");
} else { } else {
@@ -73,7 +73,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk)
&& gh.hitmsg_prev != NULL && gh.hitmsg_prev != NULL
&& mattk == gh.hitmsg_prev + 1 && mattk == gh.hitmsg_prev + 1
&& mattk->aatyp == gh.hitmsg_prev->aatyp) ? " again" : ""; && mattk->aatyp == gh.hitmsg_prev->aatyp) ? " again" : "";
pline_xy(mtmp->mx, mtmp->my, "%s %s%s%s", Monst_name, verb, again, punct); pline_mon(mtmp, "%s %s%s%s", Monst_name, verb, again, punct);
} }
gh.hitmsg_mid = mtmp->m_id; gh.hitmsg_mid = mtmp->m_id;
gh.hitmsg_prev = mattk; gh.hitmsg_prev = mattk;
@@ -90,9 +90,9 @@ missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk)
map_invisible(mtmp->mx, mtmp->my); map_invisible(mtmp->mx, mtmp->my);
if (could_seduce(mtmp, &gy.youmonst, mattk) && !mtmp->mcan) if (could_seduce(mtmp, &gy.youmonst, mattk) && !mtmp->mcan)
pline_xy(mtmp->mx, mtmp->my, "%s pretends to be friendly.", Monnam(mtmp)); pline_mon(mtmp, "%s pretends to be friendly.", Monnam(mtmp));
else else
pline_xy(mtmp->mx, mtmp->my, "%s %smisses!", Monnam(mtmp), pline_mon(mtmp, "%s %smisses!", Monnam(mtmp),
(nearmiss && flags.verbose) ? "just " : ""); (nearmiss && flags.verbose) ? "just " : "");
stop_occupation(); stop_occupation();
@@ -132,7 +132,7 @@ mswings(
boolean bash) /* True: polearm used at too close range */ boolean bash) /* True: polearm used at too close range */
{ {
if (flags.verbose && !Blind && mon_visible(mtmp)) { if (flags.verbose && !Blind && mon_visible(mtmp)) {
pline_xy(mtmp->mx, mtmp->my, "%s %s %s%s %s.", Monnam(mtmp), mswings_verb(otemp, bash), pline_mon(mtmp, "%s %s %s%s %s.", Monnam(mtmp), mswings_verb(otemp, bash),
(otemp->quan > 1L) ? "one of " : "", mhis(mtmp), xname(otemp)); (otemp->quan > 1L) ? "one of " : "", mhis(mtmp), xname(otemp));
} }
} }

View File

@@ -1786,8 +1786,7 @@ mpickgold(struct monst *mtmp)
add_to_minv(mtmp, gold); add_to_minv(mtmp, gold);
if (cansee(mtmp->mx, mtmp->my)) { if (cansee(mtmp->mx, mtmp->my)) {
if (flags.verbose && !mtmp->isgd) if (flags.verbose && !mtmp->isgd)
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp, "%s picks up some %s.", Monnam(mtmp),
"%s picks up some %s.", Monnam(mtmp),
mat_idx == GOLD ? "gold" : "money"); mat_idx == GOLD ? "gold" : "money");
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
} }
@@ -1847,8 +1846,8 @@ mpickstuff(struct monst *mtmp)
char *otmpname = distant_name(otmp, doname); char *otmpname = distant_name(otmp, doname);
if (flags.verbose) if (flags.verbose)
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp, "%s picks up %s.",
"%s picks up %s.", Monnam(mtmp), otmpname); Monnam(mtmp), otmpname);
} }
obj_extract_self(otmp3); /* remove from floor */ obj_extract_self(otmp3); /* remove from floor */
(void) mpickobj(mtmp, otmp3); /* may merge and free otmp3 */ (void) mpickobj(mtmp, otmp3); /* may merge and free otmp3 */

View File

@@ -1927,8 +1927,8 @@ use_offensive(struct monst *mtmp)
*/ */
if (cansee(mtmp->mx, mtmp->my)) { if (cansee(mtmp->mx, mtmp->my)) {
otmp->dknown = 1; otmp->dknown = 1;
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp, "%s hurls %s!",
"%s hurls %s!", Monnam(mtmp), singular(otmp, doname)); Monnam(mtmp), singular(otmp, doname));
} }
m_throw(mtmp, mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx), m_throw(mtmp, mtmp->mx, mtmp->my, sgn(mtmp->mux - mtmp->mx),
sgn(mtmp->muy - mtmp->my), sgn(mtmp->muy - mtmp->my),

View File

@@ -116,6 +116,18 @@ pline_xy(coordxy x, coordxy y, const char *line, ...)
va_end(the_args); va_end(the_args);
} }
void
pline_mon(struct monst *mtmp, const char *line, ...)
{
va_list the_args;
set_msg_xy(mtmp->mx, mtmp->my);
va_start(the_args, line);
vpline(line, the_args);
va_end(the_args);
}
/* set the direction where next message happens */ /* set the direction where next message happens */
void void
set_msg_dir(int dir) set_msg_dir(int dir)

View File

@@ -846,7 +846,7 @@ mdrop_obj(
} }
/* obj_no_longer_held(obj); -- done by place_object */ /* obj_no_longer_held(obj); -- done by place_object */
if (verbosely && cansee(omx, omy)) if (verbosely && cansee(omx, omy))
pline_xy(mon->mx, mon->my, "%s drops %s.", Monnam(mon), obj_name); pline_mon(mon, "%s drops %s.", Monnam(mon), obj_name);
if (!flooreffects(obj, omx, omy, "fall")) { if (!flooreffects(obj, omx, omy, "fall")) {
place_object(obj, omx, omy); place_object(obj, omx, omy);
stackobj(obj); stackobj(obj);

View File

@@ -1916,8 +1916,8 @@ mlevel_tele_trap(
assign_level(&tolevel, &valley_level); assign_level(&tolevel, &valley_level);
} else if (Is_botlevel(&u.uz)) { } else if (Is_botlevel(&u.uz)) {
if (in_sight && trap->tseen) if (in_sight && trap->tseen)
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp, "%s avoids the %s.",
"%s avoids the %s.", Monnam(mtmp), Monnam(mtmp),
(tt == HOLE) ? "hole" : "trap"); (tt == HOLE) ? "hole" : "trap");
return Trap_Effect_Finished; return Trap_Effect_Finished;
} else { } else {
@@ -1929,9 +1929,9 @@ mlevel_tele_trap(
|| is_home_elemental(mtmp->data) || is_home_elemental(mtmp->data)
|| rn2(7))) { || rn2(7))) {
if (in_sight && mtmp->data->mlet != S_ELEMENTAL) { if (in_sight && mtmp->data->mlet != S_ELEMENTAL) {
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp,
"%s seems to shimmer for a moment.", "%s seems to shimmer for a moment.",
Monnam(mtmp)); Monnam(mtmp));
seetrap(trap); seetrap(trap);
} }
return Trap_Effect_Finished; return Trap_Effect_Finished;
@@ -1949,7 +1949,7 @@ mlevel_tele_trap(
currently inside his or her own special room */ currently inside his or her own special room */
|| (tt == NO_TRAP && onscary(0, 0, mtmp))) { || (tt == NO_TRAP && onscary(0, 0, mtmp))) {
if (in_sight) if (in_sight)
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp,
"%s seems very disoriented for a moment.", "%s seems very disoriented for a moment.",
Monnam(mtmp)); Monnam(mtmp));
return Trap_Effect_Finished; return Trap_Effect_Finished;
@@ -1964,8 +1964,8 @@ mlevel_tele_trap(
nlev = random_teleport_level(); nlev = random_teleport_level();
if (nlev == depth(&u.uz)) { if (nlev == depth(&u.uz)) {
if (in_sight) if (in_sight)
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp, "%s shudders for a moment.",
"%s shudders for a moment.", Monnam(mtmp)); Monnam(mtmp));
return Trap_Effect_Finished; return Trap_Effect_Finished;
} }
get_level(&tolevel, nlev); get_level(&tolevel, nlev);
@@ -1976,8 +1976,7 @@ mlevel_tele_trap(
} }
if (in_sight) { if (in_sight) {
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp, "Suddenly, %s %s.", mon_nam(mtmp),
"Suddenly, %s %s.", mon_nam(mtmp),
(tt == HOLE) ? "falls into a hole" (tt == HOLE) ? "falls into a hole"
: (tt == TRAPDOOR) ? "falls through a trap door" : (tt == TRAPDOOR) ? "falls through a trap door"
: "disappears out of sight"); : "disappears out of sight");

View File

@@ -805,6 +805,7 @@ animate_statue(
pline("Instead of shattering, %s suddenly %s!", statuename, pline("Instead of shattering, %s suddenly %s!", statuename,
comes_to_life); comes_to_life);
} else { /* cause == ANIMATE_NORMAL */ } else { /* cause == ANIMATE_NORMAL */
set_msg_xy(x, y);
You("find %s posing as a statue.", You("find %s posing as a statue.",
canspotmon(mon) ? a_monnam(mon) : something); canspotmon(mon) ? a_monnam(mon) : something);
if (!canspotmon(mon) && Blind) if (!canspotmon(mon) && Blind)
@@ -950,7 +951,8 @@ mu_maybe_destroy_web(
(flaming(mptr)) ? "burn" : "dissolve", (flaming(mptr)) ? "burn" : "dissolve",
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
else else
pline("%s %s %s spider web!", Monnam(mtmp), pline_mon(mtmp,
"%s %s %s spider web!", Monnam(mtmp),
(flaming(mptr)) ? "burns" : "dissolves", (flaming(mptr)) ? "burns" : "dissolves",
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
} }
@@ -962,7 +964,8 @@ mu_maybe_destroy_web(
if (isyou) { if (isyou) {
You("flow through %s spider web.", a_your[trap->madeby_u]); You("flow through %s spider web.", a_your[trap->madeby_u]);
} else { } else {
pline("%s flows through %s spider web.", Monnam(mtmp), pline_mon(mtmp,
"%s flows through %s spider web.", Monnam(mtmp),
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
seetrap(trap); seetrap(trap);
} }
@@ -1173,7 +1176,8 @@ trapeffect_arrow_trap(
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
if (in_sight && see_it) if (in_sight && see_it)
pline("%s triggers a trap but nothing happens.", pline_mon(mtmp,
"%s triggers a trap but nothing happens.",
Monnam(mtmp)); Monnam(mtmp));
deltrap(trap); deltrap(trap);
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
@@ -1242,7 +1246,8 @@ trapeffect_dart_trap(
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
if (in_sight && see_it) if (in_sight && see_it)
pline("%s triggers a trap but nothing happens.", pline_mon(mtmp,
"%s triggers a trap but nothing happens.",
Monnam(mtmp)); Monnam(mtmp));
deltrap(trap); deltrap(trap);
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
@@ -1322,7 +1327,8 @@ trapeffect_rocktrap(
if (trap->once && trap->tseen && !rn2(15)) { if (trap->once && trap->tseen && !rn2(15)) {
if (in_sight && see_it) if (in_sight && see_it)
pline("A trap door above %s opens, but nothing falls out!", pline_mon(mtmp,
"A trap door above %s opens, but nothing falls out!",
mon_nam(mtmp)); mon_nam(mtmp));
deltrap(trap); deltrap(trap);
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
@@ -1388,11 +1394,13 @@ trapeffect_sqky_board(
if (IndexOk(trap->tnote, tsnds)) { if (IndexOk(trap->tnote, tsnds)) {
Soundeffect(tsnds[trap->tnote], 50); Soundeffect(tsnds[trap->tnote], 50);
} }
pline("A board beneath %s squeaks %s loudly.", pline_mon(mtmp,
"A board beneath %s squeaks %s loudly.",
mon_nam(mtmp), trapnote(trap, FALSE)); mon_nam(mtmp), trapnote(trap, FALSE));
seetrap(trap); seetrap(trap);
} else if (!mindless(mtmp->data)) { } else if (!mindless(mtmp->data)) {
pline("%s stops momentarily and appears to cringe.", pline_mon(mtmp,
"%s stops momentarily and appears to cringe.",
Monnam(mtmp)); Monnam(mtmp));
} }
} else { } else {
@@ -1467,7 +1475,8 @@ trapeffect_bear_trap(
&& !is_whirly(mptr) && !unsolid(mptr)) { && !is_whirly(mptr) && !unsolid(mptr)) {
mtmp->mtrapped = 1; mtmp->mtrapped = 1;
if (in_sight) { if (in_sight) {
pline("%s is caught in %s bear trap!", Monnam(mtmp), pline_mon(mtmp,
"%s is caught in %s bear trap!", Monnam(mtmp),
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
seetrap(trap); seetrap(trap);
} else { } else {
@@ -1479,7 +1488,8 @@ trapeffect_bear_trap(
} }
} else if (forcetrap) { } else if (forcetrap) {
if (in_sight) { if (in_sight) {
pline("%s evades %s bear trap!", Monnam(mtmp), pline_mon(mtmp,
"%s evades %s bear trap!", Monnam(mtmp),
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
seetrap(trap); seetrap(trap);
} }
@@ -1516,7 +1526,8 @@ trapeffect_slp_gas_trap(
if (!resists_sleep(mtmp) && !breathless(mtmp->data) if (!resists_sleep(mtmp) && !breathless(mtmp->data)
&& !helpless(mtmp)) { && !helpless(mtmp)) {
if (sleep_monst(mtmp, rnd(25), -1) && in_sight) { if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
pline("%s suddenly falls asleep!", Monnam(mtmp)); pline_mon(mtmp,
"%s suddenly falls asleep!", Monnam(mtmp));
seetrap(trap); seetrap(trap);
} }
} }
@@ -1594,14 +1605,16 @@ trapeffect_rust_trap(
switch (rn2(5)) { switch (rn2(5)) {
case 0: case 0:
if (in_sight) if (in_sight)
pline("%s %s on the %s!", A_gush_of_water_hits, pline_mon(mtmp,
"%s %s on the %s!", A_gush_of_water_hits,
mon_nam(mtmp), mbodypart(mtmp, HEAD)); mon_nam(mtmp), mbodypart(mtmp, HEAD));
target = which_armor(mtmp, W_ARMH); target = which_armor(mtmp, W_ARMH);
(void) water_damage(target, helm_simple_name(target), TRUE); (void) water_damage(target, helm_simple_name(target), TRUE);
break; break;
case 1: case 1:
if (in_sight) if (in_sight)
pline("%s %s's left %s!", A_gush_of_water_hits, pline_mon(mtmp,
"%s %s's left %s!", A_gush_of_water_hits,
mon_nam(mtmp), mbodypart(mtmp, ARM)); mon_nam(mtmp), mbodypart(mtmp, ARM));
target = which_armor(mtmp, W_ARMS); target = which_armor(mtmp, W_ARMS);
if (water_damage(target, "shield", TRUE) != ER_NOTHING) if (water_damage(target, "shield", TRUE) != ER_NOTHING)
@@ -1615,7 +1628,8 @@ trapeffect_rust_trap(
break; break;
case 2: case 2:
if (in_sight) if (in_sight)
pline("%s %s's right %s!", A_gush_of_water_hits, pline_mon(mtmp,
"%s %s's right %s!", A_gush_of_water_hits,
mon_nam(mtmp), mbodypart(mtmp, ARM)); mon_nam(mtmp), mbodypart(mtmp, ARM));
(void) water_damage(MON_WEP(mtmp), 0, TRUE); (void) water_damage(MON_WEP(mtmp), 0, TRUE);
goto mglovecheck; goto mglovecheck;
@@ -1639,7 +1653,7 @@ trapeffect_rust_trap(
if (completelyrusts(mptr)) { if (completelyrusts(mptr)) {
if (in_sight) if (in_sight)
pline("%s %s to pieces!", Monnam(mtmp), pline_mon(mtmp, "%s %s to pieces!", Monnam(mtmp),
!mlifesaver(mtmp) ? "falls" : "starts to fall"); !mlifesaver(mtmp) ? "falls" : "starts to fall");
monkilled(mtmp, (const char *) 0, AD_RUST); monkilled(mtmp, (const char *) 0, AD_RUST);
if (DEADMONSTER(mtmp)) if (DEADMONSTER(mtmp))
@@ -1672,12 +1686,14 @@ trapeffect_fire_trap(
int orig_dmg = d(2, 4); int orig_dmg = d(2, 4);
if (in_sight) if (in_sight)
pline("A %s erupts from the %s under %s!", tower_of_flame, pline_mon(mtmp,
"A %s erupts from the %s under %s!", tower_of_flame,
surface(mtmp->mx, mtmp->my), mon_nam(mtmp)); surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
else if (see_it) /* evidently `mtmp' is invisible */ else if (see_it) { /* evidently `mtmp' is invisible */
set_msg_xy(mtmp->mx, mtmp->my);
You_see("a %s erupt from the %s!", tower_of_flame, You_see("a %s erupt from the %s!", tower_of_flame,
surface(mtmp->mx, mtmp->my)); surface(mtmp->mx, mtmp->my));
}
if (resists_fire(mtmp)) { if (resists_fire(mtmp)) {
if (in_sight) { if (in_sight) {
shieldeff(mtmp->mx, mtmp->my); shieldeff(mtmp->mx, mtmp->my);
@@ -1897,7 +1913,7 @@ trapeffect_pit(
/* openfallingtrap; not inescapable here */ /* openfallingtrap; not inescapable here */
if (in_sight) { if (in_sight) {
seetrap(trap); seetrap(trap);
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp,
"%s doesn't fall into the pit.", Monnam(mtmp)); "%s doesn't fall into the pit.", Monnam(mtmp));
} }
return Trap_Effect_Finished; return Trap_Effect_Finished;
@@ -1909,7 +1925,7 @@ trapeffect_pit(
if (!passes_walls(mptr)) if (!passes_walls(mptr))
mtmp->mtrapped = 1; mtmp->mtrapped = 1;
if (in_sight) { if (in_sight) {
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp,
"%s %s into %s pit!", Monnam(mtmp), fallverb, "%s %s into %s pit!", Monnam(mtmp), fallverb,
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
if (mptr == &mons[PM_PIT_VIPER] if (mptr == &mons[PM_PIT_VIPER]
@@ -1961,11 +1977,11 @@ trapeffect_hole(
if (in_sight) { if (in_sight) {
seetrap(trap); seetrap(trap);
if (tt == TRAPDOOR) if (tt == TRAPDOOR)
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp,
"A trap door opens, but %s doesn't fall through.", "A trap door opens, but %s doesn't fall through.",
mon_nam(mtmp)); mon_nam(mtmp));
else /* (tt == HOLE) */ else /* (tt == HOLE) */
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp,
"%s doesn't fall through the hole.", "%s doesn't fall through the hole.",
Monnam(mtmp)); Monnam(mtmp));
} }
@@ -1973,7 +1989,7 @@ trapeffect_hole(
} }
if (inescapable) { /* sokoban hole */ if (inescapable) { /* sokoban hole */
if (in_sight) { if (in_sight) {
pline_xy(mtmp->mx, mtmp->my, pline_mon(mtmp,
"%s seems to be yanked down!", Monnam(mtmp)); "%s seems to be yanked down!", Monnam(mtmp));
/* suppress message in mlevel_tele_trap() */ /* suppress message in mlevel_tele_trap() */
in_sight = FALSE; in_sight = FALSE;
@@ -2151,7 +2167,8 @@ trapeffect_web(
|| (mtmp->wormno && count_wsegs(mtmp) > 5)) { || (mtmp->wormno && count_wsegs(mtmp) > 5)) {
tear_web = TRUE; tear_web = TRUE;
} else if (in_sight) { } else if (in_sight) {
pline("%s is caught in %s spider web.", Monnam(mtmp), pline_mon(mtmp,
"%s is caught in %s spider web.", Monnam(mtmp),
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
seetrap(trap); seetrap(trap);
} }
@@ -2176,13 +2193,15 @@ trapeffect_web(
} }
if (tear_web) { if (tear_web) {
if (in_sight) if (in_sight)
pline("%s tears through %s spider web!", Monnam(mtmp), pline_mon(mtmp,
"%s tears through %s spider web!", Monnam(mtmp),
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
deltrap(trap); deltrap(trap);
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
} else if (forcetrap && !mtmp->mtrapped) { } else if (forcetrap && !mtmp->mtrapped) {
if (in_sight) { if (in_sight) {
pline("%s avoids %s spider web!", Monnam(mtmp), pline_mon(mtmp,
"%s avoids %s spider web!", Monnam(mtmp),
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
seetrap(trap); seetrap(trap);
} }
@@ -2308,7 +2327,8 @@ trapeffect_anti_magic(
mtmp->mspec_used += d(2, 6); mtmp->mspec_used += d(2, 6);
if (in_sight) { if (in_sight) {
seetrap(trap); seetrap(trap);
pline("%s seems lethargic.", Monnam(mtmp)); pline_mon(mtmp, "%s seems lethargic.",
Monnam(mtmp));
} }
} }
} else { /* take some damage */ } else { /* take some damage */
@@ -2476,7 +2496,8 @@ trapeffect_landmine(
boolean already_seen = trap->tseen; boolean already_seen = trap->tseen;
if (in_sight && !already_seen) { if (in_sight && !already_seen) {
pline("A trigger appears in a pile of soil below %s.", pline_mon(mtmp,
"A trigger appears in a pile of soil below %s.",
mon_nam(mtmp)); mon_nam(mtmp));
seetrap(trap); seetrap(trap);
} }
@@ -2489,7 +2510,8 @@ trapeffect_landmine(
} }
} else if (in_sight) { } else if (in_sight) {
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
pline("%s%s triggers %s land mine!", pline_mon(mtmp,
"%s%s triggers %s land mine!",
!Deaf ? "KAABLAMM!!! " : "", Monnam(mtmp), !Deaf ? "KAABLAMM!!! " : "", Monnam(mtmp),
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
} }
@@ -2550,7 +2572,7 @@ trapeffect_rolling_boulder_trap(
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
if (in_sight) if (in_sight)
pline("%s%s triggers %s.", pline_mon(mtmp, "%s%s triggers %s.",
!Deaf ? "Click! " : "", Monnam(mtmp), !Deaf ? "Click! " : "", Monnam(mtmp),
trap->tseen ? "a rolling boulder trap" : something); trap->tseen ? "a rolling boulder trap" : something);
if (launch_obj(BOULDER, trap->launch.x, trap->launch.y, if (launch_obj(BOULDER, trap->launch.x, trap->launch.y,
@@ -3228,7 +3250,8 @@ launch_obj(
if (otyp == BOULDER && throws_rocks(mtmp->data)) { if (otyp == BOULDER && throws_rocks(mtmp->data)) {
if (rn2(3)) { if (rn2(3)) {
if (cansee(x, y)) if (cansee(x, y))
pline("%s snatches the boulder.", Monnam(mtmp)); pline_mon(mtmp, "%s snatches the boulder.",
Monnam(mtmp));
singleobj->otrapped = 0; singleobj->otrapped = 0;
(void) mpickobj(mtmp, singleobj); (void) mpickobj(mtmp, singleobj);
used_up = TRUE; used_up = TRUE;
@@ -3265,6 +3288,8 @@ launch_obj(
switch (t->ttyp) { switch (t->ttyp) {
case LANDMINE: case LANDMINE:
if (rn2(10) > 2) { if (rn2(10) > 2) {
if (cansee(x, y))
set_msg_xy(x, y);
pline("KAABLAMM!!!%s", pline("KAABLAMM!!!%s",
cansee(x, y) cansee(x, y)
? " The rolling boulder triggers a land mine." ? " The rolling boulder triggers a land mine."
@@ -3294,7 +3319,7 @@ launch_obj(
/*FALLTHRU*/ /*FALLTHRU*/
case TELEP_TRAP: case TELEP_TRAP:
if (cansee(x, y)) if (cansee(x, y))
pline("Suddenly the rolling boulder disappears!"); pline_xy(x, y, "Suddenly the rolling boulder disappears!");
else if (!Deaf) else if (!Deaf)
You_hear("a rumbling stop abruptly."); You_hear("a rumbling stop abruptly.");
singleobj->otrapped = 0; singleobj->otrapped = 0;
@@ -3356,8 +3381,10 @@ launch_obj(
} }
} }
if (otyp == BOULDER && closed_door(x, y)) { if (otyp == BOULDER && closed_door(x, y)) {
if (cansee(x, y)) if (cansee(x, y)) {
set_msg_xy(x, y);
pline_The("boulder crashes through a door."); pline_The("boulder crashes through a door.");
}
levl[x][y].doormask = D_BROKEN; levl[x][y].doormask = D_BROKEN;
if (dist) if (dist)
unblock_point(x, y); unblock_point(x, y);
@@ -3577,11 +3604,13 @@ mintrap(struct monst *mtmp, unsigned mintrapflags)
if (!rn2(2)) { if (!rn2(2)) {
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s pulls free...", Monnam(mtmp)); pline_mon(mtmp, "%s pulls free...",
Monnam(mtmp));
fill_pit(mtmp->mx, mtmp->my); fill_pit(mtmp->mx, mtmp->my);
} }
} else { } else {
if (canseemon(mtmp)) { if (canseemon(mtmp)) {
set_msg_xy(mtmp->mx, mtmp->my);
if (is_pit(trap->ttyp)) if (is_pit(trap->ttyp))
pline("%s climbs %sout of the pit.", Monnam(mtmp), pline("%s climbs %sout of the pit.", Monnam(mtmp),
m_easy_escape_pit(mtmp) ? "easily " : ""); m_easy_escape_pit(mtmp) ? "easily " : "");
@@ -3594,13 +3623,15 @@ mintrap(struct monst *mtmp, unsigned mintrapflags)
} else if (metallivorous(mptr)) { } else if (metallivorous(mptr)) {
if (trap->ttyp == BEAR_TRAP) { if (trap->ttyp == BEAR_TRAP) {
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s eats a bear trap!", Monnam(mtmp)); pline_mon(mtmp, "%s eats a bear trap!",
Monnam(mtmp));
deltrap(trap); deltrap(trap);
mtmp->meating = 5; mtmp->meating = 5;
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
} else if (trap->ttyp == SPIKED_PIT) { } else if (trap->ttyp == SPIKED_PIT) {
if (canseemon(mtmp)) if (canseemon(mtmp))
pline("%s munches on some spikes!", Monnam(mtmp)); pline_mon(mtmp, "%s munches on some spikes!",
Monnam(mtmp));
trap->ttyp = PIT; trap->ttyp = PIT;
mtmp->meating = 5; mtmp->meating = 5;
} }
@@ -3646,7 +3677,7 @@ mintrap(struct monst *mtmp, unsigned mintrapflags)
maybe_unhide_at(mtmp->mx, mtmp->my); maybe_unhide_at(mtmp->mx, mtmp->my);
if (!alreadyspotted && canseemon(mtmp)) if (!alreadyspotted && canseemon(mtmp))
pline("%s appears.", Amonnam(mtmp)); pline_mon(mtmp, "%s appears.", Amonnam(mtmp));
} }
} }
return trap_result; return trap_result;
@@ -3684,7 +3715,7 @@ minstapetrify(struct monst *mon, boolean byplayer)
mon_adjust_speed(mon, -3, (struct obj *) 0); mon_adjust_speed(mon, -3, (struct obj *) 0);
if (cansee(mon->mx, mon->my)) if (cansee(mon->mx, mon->my))
pline("%s turns to stone.", Monnam(mon)); pline_mon(mon, "%s turns to stone.", Monnam(mon));
if (byplayer) { if (byplayer) {
gs.stoned = TRUE; gs.stoned = TRUE;
xkilled(mon, XKILL_NOMSG); xkilled(mon, XKILL_NOMSG);
@@ -3733,7 +3764,7 @@ mselftouch(
if (mwep && mwep->otyp == CORPSE && touch_petrifies(&mons[mwep->corpsenm]) if (mwep && mwep->otyp == CORPSE && touch_petrifies(&mons[mwep->corpsenm])
&& !resists_ston(mon)) { && !resists_ston(mon)) {
if (cansee(mon->mx, mon->my)) { if (cansee(mon->mx, mon->my)) {
pline("%s%s touches %s.", arg ? arg : "", pline_mon(mon, "%s%s touches %s.", arg ? arg : "",
arg ? mon_nam(mon) : Monnam(mon), arg ? mon_nam(mon) : Monnam(mon),
corpse_xname(mwep, (const char *) 0, CXN_PFX_THE)); corpse_xname(mwep, (const char *) 0, CXN_PFX_THE));
} }
@@ -6471,15 +6502,17 @@ thitm(
*/ */
if (!strike) { if (!strike) {
if (obj && cansee(mon->mx, mon->my)) if (obj && cansee(mon->mx, mon->my))
pline("%s is almost hit by %s!", Monnam(mon), doname(obj)); pline_mon(mon, "%s is almost hit by %s!",
Monnam(mon), doname(obj));
} else { } else {
int dam = 1; int dam = 1;
boolean harmless = (obj && stone_missile(obj) boolean harmless = (obj && stone_missile(obj)
&& passes_rocks(mon->data)); && passes_rocks(mon->data));
if (obj && cansee(mon->mx, mon->my)) if (obj && cansee(mon->mx, mon->my))
pline("%s is hit by %s%s", Monnam(mon), doname(obj), pline_mon(mon, "%s is hit by %s%s",
harmless ? " but is not harmed." : "!"); Monnam(mon), doname(obj),
harmless ? " but is not harmed." : "!");
if (d_override) { if (d_override) {
dam = d_override; dam = d_override;
} else if (obj) { } else if (obj) {

View File

@@ -839,9 +839,9 @@ mon_wield_item(struct monst *mon)
if (canseemon(mon)) { if (canseemon(mon)) {
boolean newly_welded; boolean newly_welded;
pline_xy(mon->mx, mon->my, pline_mon(mon, "%s wields %s%c",
"%s wields %s%c", Monnam(mon), doname(obj), Monnam(mon), doname(obj),
exclaim ? '!' : '.'); exclaim ? '!' : '.');
/* 3.6.3: mwelded() predicate expects the object to have its /* 3.6.3: mwelded() predicate expects the object to have its
W_WEP bit set in owormmask, but the pline here and for W_WEP bit set in owormmask, but the pline here and for
artifact_light don't want that because they'd have '(weapon artifact_light don't want that because they'd have '(weapon