]> granicus.if.org Git - nethack/commitdiff
<Mon> suddenly appears! vs ^G
authorPatR <rankin@nethack.org>
Mon, 7 Feb 2022 23:55:04 +0000 (15:55 -0800)
committerPatR <rankin@nethack.org>
Mon, 7 Feb 2022 23:55:04 +0000 (15:55 -0800)
For ^G, throttle the monster creation feedback.  Don't say "suddenly"
and don't exclaim the message, just say "<Mon> 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.

include/hack.h
src/makemon.c
src/pager.c
src/read.c

index a7ea384eddb211b9f33d6ded3672f43de7890feb..9628fa977a9590abcf5d218a41e0ac7916fb1622 100644 (file)
@@ -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 "<mon> appears." mesg for ^G */
 
 /* flags for make_corpse() and mkcorpstat(); 0..7 are recorded in obj->spe */
 #define CORPSTAT_NONE     0x00
index 8cc95517f77a3b243cb0f100efdfb5464d6326df..103c946c8d95ad41d2da43ac80e0e5e1c0b6158e 100644 (file)
@@ -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 */
     }
 
index a454c8872ea61ed7b0f40ee8fd6706486ce03190..8abb64e8dd09518b55da82e277742a40f9b876d9 100644 (file)
@@ -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);
index d02d848f53d631e67075c603f6d954e5aeadb3cf..a177923f9d2f270811224e045e67f2d9a75c3975 100644 (file)
@@ -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; "<mon> appears." rather than "<mon> 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