"someone"/"something" instead of "it"

I thought there were more places that checked for "it" and substituted
"someone" or "something".  Perhaps there are and I'm just not finding
them now.  Anyway, this extends x_monnam() and adds some_mon_nam() and
Some_Monnam() to do that during monster name formatting instead of
having various bits of code try fix it up after the fact.  The fixups
could be fooled by monsters given the name "it" or "It"; x_monnam()
won't be.
This commit is contained in:
PatR
2021-10-28 12:55:32 -07:00
parent 3a0f1bb1aa
commit 49b2ea1b89
6 changed files with 40 additions and 24 deletions

View File

@@ -310,13 +310,14 @@ E char emptystr[];
#define ARTICLE_A 2
#define ARTICLE_YOUR 3
/* Monster name suppress masks */
/* x_monnam() monster name suppress masks */
#define SUPPRESS_IT 0x01
#define SUPPRESS_INVISIBLE 0x02
#define SUPPRESS_HALLUCINATION 0x04
#define SUPPRESS_SADDLE 0x08
#define EXACT_NAME 0x0F
#define SUPPRESS_NAME 0x10
#define AUGMENT_IT 0x20 /* use "someone" or "something" instead of "it" */
/* Window system stuff */
E NEARDATA winid WIN_MESSAGE;

View File

@@ -438,8 +438,10 @@ extern char *x_monnam(struct monst *, int, const char *, int, boolean);
extern char *l_monnam(struct monst *);
extern char *mon_nam(struct monst *);
extern char *noit_mon_nam(struct monst *);
extern char *some_mon_nam(struct monst *);
extern char *Monnam(struct monst *);
extern char *noit_Monnam(struct monst *);
extern char *Some_Monnam(struct monst *);
extern char *noname_monnam(struct monst *, int);
extern char *m_monnam(struct monst *);
extern char *y_monnam(struct monst *);

View File

@@ -1669,9 +1669,13 @@ rndghostname(void)
* seen unseen detected named
* mon_nam: the newt it the invisible orc Fido
* noit_mon_nam:the newt (as if detected) the invisible orc Fido
* some_mon_nam:the newt someone the invisible orc Fido
* or something
* l_monnam: newt it invisible orc dog called Fido
* Monnam: The newt It The invisible orc Fido
* noit_Monnam: The newt (as if detected) The invisible orc Fido
* Some_Monnam: The newt Someone The invisible orc Fido
* or Something
* Adjmonnam: The poor newt It The poor invisible orc The poor Fido
* Amonnam: A newt It An invisible orc Fido
* a_monnam: a newt it an invisible orc Fido
@@ -1711,7 +1715,7 @@ x_monnam(
char *buf = nextmbuf();
struct permonst *mdat = mtmp->data;
const char *pm_name = mon_pmname(mtmp);
boolean do_hallu, do_invis, do_it, do_saddle, do_name;
boolean do_hallu, do_invis, do_it, do_saddle, do_name, augment_it;
boolean name_at_start, has_adjectives,
falseCap = (*pm_name != lowc(*pm_name));
char *bp;
@@ -1728,12 +1732,16 @@ x_monnam(
&& !(u.uswallow && mtmp == u.ustuck) && !(suppress & SUPPRESS_IT);
do_saddle = !(suppress & SUPPRESS_SADDLE);
do_name = !(suppress & SUPPRESS_NAME) || type_is_pname(mdat);
augment_it = (suppress & AUGMENT_IT) != 0;
buf[0] = '\0';
/* unseen monsters, etc. Use "it" */
/* unseen monsters, etc.; usually "it" but sometimes more specific;
when hallucinating, the more specific values might be inverted */
if (do_it) {
Strcpy(buf, "it");
Strcpy(buf, !augment_it ? "it"
: (!do_hallu ? humanoid(mdat) : !rn2(2)) ? "someone"
: "something");
return buf;
}
@@ -1908,8 +1916,19 @@ char *
noit_mon_nam(struct monst *mtmp)
{
return x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mgivenname(mtmp)) ? (SUPPRESS_SADDLE | SUPPRESS_IT)
: SUPPRESS_IT,
(has_mgivenname(mtmp) ? (SUPPRESS_SADDLE | SUPPRESS_IT)
: SUPPRESS_IT),
FALSE);
}
/* in between noit_mon_nam() and mon_nam(); if the latter would pick "it",
use "someone" (for humanoids) or "something" (for others) instead */
char *
some_mon_nam(struct monst *mtmp)
{
return x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mgivenname(mtmp) ? (SUPPRESS_SADDLE | AUGMENT_IT)
: AUGMENT_IT),
FALSE);
}
@@ -1931,6 +1950,15 @@ noit_Monnam(struct monst *mtmp)
return bp;
}
char *
Some_Monnam(struct monst *mtmp)
{
char *bp = some_mon_nam(mtmp);
*bp = highc(*bp);
return bp;
}
/* return "a dog" rather than "Fido", honoring hallucination and visibility */
char *
noname_monnam(struct monst *mtmp, int article)

View File

@@ -247,9 +247,7 @@ monshoot(struct monst* mtmp, struct obj* otmp, struct obj* mwep)
onm = obj_is_pname(otmp) ? the(onm) : an(onm);
}
g.m_shot.s = ammo_and_launcher(otmp, mwep) ? TRUE : FALSE;
Strcpy(trgbuf, mtarg ? mon_nam(mtarg) : "");
if (!strcmp(trgbuf, "it"))
Strcpy(trgbuf, humanoid(mtmp->data) ? "someone" : something);
Strcpy(trgbuf, mtarg ? some_mon_nam(mtarg) : "");
pline("%s %s %s%s%s!", Monnam(mtmp),
g.m_shot.s ? "shoots" : "throws", onm,
mtarg ? " at " : "", trgbuf);

View File

@@ -2166,15 +2166,7 @@ use_misc(struct monst* mtmp)
if (vis || vistrapspot)
seetrap(t);
if (vismon || vistrapspot) {
const char *Mnam = Monnam(mtmp);
/* when the trap is seen but the monster isn't, Monnam()
will yield "It"; change that to "Someone" or "Something";
the canspotmon() check is to avoid making the change if
mtmp has been explicitly named "It" */
if (!strcmp(Mnam, "It") && !canspotmon(mtmp))
Mnam = humanoid(mtmp->data) ? "Someone" : "Something";
pline("%s deliberately %s onto a %s trap!", Mnam,
pline("%s deliberately %s onto a %s trap!", Some_Monnam(mtmp),
vtense(fakename[0], locomotion(mtmp->data, "jump")),
t->tseen ? "polymorph" : "hidden");
/* note: if mtmp is unseen because it is invisible, its new

View File

@@ -745,12 +745,7 @@ gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy)
}
if (see_it) { /* cansee(goldx, goldy) */
char monnambuf[BUFSZ];
Strcpy(monnambuf, Monnam(grd));
if (!strcmpi(monnambuf, "It"))
Strcpy(monnambuf, "Someone");
pline("%s%s picks up the gold%s.", monnambuf,
pline("%s%s picks up the gold%s.", Some_Monnam(grd),
(grd->mpeaceful && EGD(grd)->warncnt > 5)
? " calms down and" : "",
under_u ? " from beneath you" : "");