From: PatR Date: Mon, 7 Feb 2022 23:55:04 +0000 (-0800) Subject: suddenly appears! vs ^G X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50d8463b71a1481c706006b2a44ac44c8531c222;p=nethack suddenly appears! vs ^G For ^G, throttle the monster creation feedback. Don't say "suddenly" and don't exclaim the message, just say " appears." Also, use Norep() so creating lots of similar monsters at once only gives a few messages (just one unless varied by "next to you" vs "nearby" vs no qualifier for farther away). And for mimics created as objects or furniture, report the sudden appearance of new object or furniture. --- diff --git a/include/hack.h b/include/hack.h index a7ea384ed..9628fa977 100644 --- a/include/hack.h +++ b/include/hack.h @@ -296,6 +296,7 @@ typedef struct sortloot_item Loot; #define GP_ALLOW_XY 0x080000L /* [actually used by enexto() to decide whether * to make an extra call to goodpos()] */ #define GP_ALLOW_U 0x100000L /* don't reject hero's location */ +#define MM_NOEXCLAM 0x200000L /* more sedate " appears." mesg for ^G */ /* flags for make_corpse() and mkcorpstat(); 0..7 are recorded in obj->spe */ #define CORPSTAT_NONE 0x00 diff --git a/src/makemon.c b/src/makemon.c index 8cc95517f..103c946c8 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1411,13 +1411,30 @@ makemon(register struct permonst *ptr, if (!g.in_mklev) { newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */ - if (!(mmflags & MM_NOMSG) - && ((canseemon(mtmp) && (M_AP_TYPE(mtmp) == M_AP_NOTHING + if (!(mmflags & MM_NOMSG)) { + char mbuf[BUFSZ], *what = 0; + /* MM_NOEXCLAM is used for #wizgenesis (^G) */ + boolean exclaim = !(mmflags & MM_NOEXCLAM); + + if ((canseemon(mtmp) && (M_AP_TYPE(mtmp) == M_AP_NOTHING || M_AP_TYPE(mtmp) == M_AP_MONSTER)) - || sensemon(mtmp))) - pline("%s suddenly appears%s!", Amonnam(mtmp), - distu(x, y) <= 2 ? " next to you" - : (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by" : ""); + || sensemon(mtmp)) { + what = Amonnam(mtmp); + if (M_AP_TYPE(mtmp) == M_AP_MONSTER) + exclaim = TRUE; + } else if (canseemon(mtmp)) { + /* mimic masquerading as furniture or object and not sensed */ + mhidden_description(mtmp, FALSE, mbuf); + what = upstart(strsubst(mbuf, ", mimicking ", "")); + } + if (what) + Norep("%s%s appears%s%c", what, + exclaim ? " suddenly" : "", + distu(x, y) <= 2 ? " next to you" + : (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by" + : "", + exclaim ? '!' : '.'); + } /* TODO: unify with teleport appears msg */ } diff --git a/src/pager.c b/src/pager.c index a454c8872..8abb64e8d 100644 --- a/src/pager.c +++ b/src/pager.c @@ -161,10 +161,10 @@ trap_description(char *outbuf, int tnum, int x, int y) /* describe a hidden monster; used for look_at during extended monster detection and for probing; also when looking at self */ void -mhidden_description(struct monst *mon, - boolean altmon, /* for probing: if mimicking a monster, - say so */ - char *outbuf) +mhidden_description( + struct monst *mon, + boolean altmon, /* for probing: if mimicking a monster, say so */ + char *outbuf) { struct obj *otmp; boolean fakeobj, isyou = (mon == &g.youmonst); diff --git a/src/read.c b/src/read.c index d02d848f5..a177923f9 100644 --- a/src/read.c +++ b/src/read.c @@ -2703,7 +2703,7 @@ do_genocide(int how) if (!(mons[mndx].geno & G_UNIQ) && !(g.mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT))) for (i = rn1(3, 4); i > 0; i--) { - if (!makemon(ptr, u.ux, u.uy, NO_MINVENT|MM_NOMSG)) + if (!makemon(ptr, u.ux, u.uy, NO_MINVENT | MM_NOMSG)) break; /* couldn't make one */ ++cnt; if (g.mvitals[mndx].mvflags & G_EXTINCT) @@ -2977,10 +2977,12 @@ create_particular_creation(struct _create_particular_data* d) if (d->genderconf == -1) { /* no confict exists between explicit gender term and the specified monster name */ - if (d->fem != -1 - && (!whichpm || (!is_male(whichpm) && !is_female(whichpm)))) + if (d->fem != -1 && (!whichpm || (!is_male(whichpm) + && !is_female(whichpm)))) mmflags |= (d->fem == FEMALE) ? MM_FEMALE : (d->fem == MALE) ? MM_MALE : 0; + /* no surprise; " appears." rather than " appears!" */ + mmflags |= MM_NOEXCLAM; } else { /* conundrum alert: an explicit gender term conflicts with an explicit gender-tied naming term (i.e. male cavewoman) */ @@ -2989,11 +2991,11 @@ create_particular_creation(struct _create_particular_data* d) commented out here */ /* d->fem = d->genderconf; */ - /* option chosen: let the explicit gender term (male or female) - override the gender-tied naming term, so leave d->fem as-is */ + /* option chosen: let the explicit gender term (male or female) + override the gender-tied naming term, so leave d->fem as-is */ - mmflags |= (d->fem == FEMALE) ? MM_FEMALE - : (d->fem == MALE) ? MM_MALE : 0; + mmflags |= (d->fem == FEMALE) ? MM_FEMALE + : (d->fem == MALE) ? MM_MALE : 0; /* another option would be to consider it a faulty specification and reject the request completely and produce a random monster