populate insight.c

Move enlightenment and conduct from cmd.c to insight.c.  Also move
vanquished monsters plus genocided and/or extinct monsters from end.c
to there.  And move the one-line stethoscope/probing feedback for
self and for monsters from priest.c to there.

Achievement feedback has been overhauled a bit.  When no achievements
have been recorded, the header for them (after conducts) won't be
shown, and when at least one has been recorded, make the prompt for
asking whether to disclose conduct be about disclosing conduct and
achievements.  Also, describe achievements in the Guidebook.

I ran out of gas before updating Guidebook.tex; it will catch up to
Guidebook.mn eventually.

Some of the MS-DOS Makefiles haven't been updated yet so linking
without insight.{o,obj} will break there.
This commit is contained in:
PatR
2020-02-06 17:42:15 -08:00
parent 690e072a49
commit b4d8475b95
6 changed files with 2559 additions and 2420 deletions

View File

@@ -861,242 +861,4 @@ boolean ghostly;
}
}
/*
* align_str(), piousness(), mstatusline() and ustatusline() used to be
* in pline.c, presumeably because the latter two generate one line of
* output. The USE_OLDARGS config gets warnings from 2016ish-vintage
* gcc (for -Wint-to-pointer-cast, activated by -Wall or -W) when they
* follow pline() itself. Fixing up the variadic calls like is done for
* lev_comp would be needlessly messy there.
*
* They don't belong here. If/when enlightenment ever gets split off
* from cmd.c (which definitely doesn't belong there), they should go
* with it.
*/
const char *
align_str(alignment)
aligntyp alignment;
{
switch ((int) alignment) {
case A_CHAOTIC:
return "chaotic";
case A_NEUTRAL:
return "neutral";
case A_LAWFUL:
return "lawful";
case A_NONE:
return "unaligned";
}
return "unknown";
}
/* used for self-probing */
char *
piousness(showneg, suffix)
boolean showneg;
const char *suffix;
{
static char buf[32]; /* bigger than "insufficiently neutral" */
const char *pio;
/* note: piousness 20 matches MIN_QUEST_ALIGN (quest.h) */
if (u.ualign.record >= 20)
pio = "piously";
else if (u.ualign.record > 13)
pio = "devoutly";
else if (u.ualign.record > 8)
pio = "fervently";
else if (u.ualign.record > 3)
pio = "stridently";
else if (u.ualign.record == 3)
pio = "";
else if (u.ualign.record > 0)
pio = "haltingly";
else if (u.ualign.record == 0)
pio = "nominally";
else if (!showneg)
pio = "insufficiently";
else if (u.ualign.record >= -3)
pio = "strayed";
else if (u.ualign.record >= -8)
pio = "sinned";
else
pio = "transgressed";
Sprintf(buf, "%s", pio);
if (suffix && (!showneg || u.ualign.record >= 0)) {
if (u.ualign.record != 3)
Strcat(buf, " ");
Strcat(buf, suffix);
}
return buf;
}
/* stethoscope or probing applied to monster -- one-line feedback */
void
mstatusline(mtmp)
struct monst *mtmp;
{
aligntyp alignment = mon_aligntyp(mtmp);
char info[BUFSZ], monnambuf[BUFSZ];
info[0] = 0;
if (mtmp->mtame) {
Strcat(info, ", tame");
if (wizard) {
Sprintf(eos(info), " (%d", mtmp->mtame);
if (!mtmp->isminion)
Sprintf(eos(info), "; hungry %ld; apport %d",
EDOG(mtmp)->hungrytime, EDOG(mtmp)->apport);
Strcat(info, ")");
}
} else if (mtmp->mpeaceful)
Strcat(info, ", peaceful");
if (mtmp->data == &mons[PM_LONG_WORM]) {
int segndx, nsegs = count_wsegs(mtmp);
/* the worm code internals don't consider the head of be one of
the worm's segments, but we count it as such when presenting
worm feedback to the player */
if (!nsegs) {
Strcat(info, ", single segment");
} else {
++nsegs; /* include head in the segment count */
segndx = wseg_at(mtmp, g.bhitpos.x, g.bhitpos.y);
Sprintf(eos(info), ", %d%s of %d segments",
segndx, ordin(segndx), nsegs);
}
}
if (mtmp->cham >= LOW_PM && mtmp->data != &mons[mtmp->cham])
/* don't reveal the innate form (chameleon, vampire, &c),
just expose the fact that this current form isn't it */
Strcat(info, ", shapechanger");
/* pets eating mimic corpses mimic while eating, so this comes first */
if (mtmp->meating)
Strcat(info, ", eating");
/* a stethoscope exposes mimic before getting here so this
won't be relevant for it, but wand of probing doesn't */
if (mtmp->mundetected || mtmp->m_ap_type)
mhidden_description(mtmp, TRUE, eos(info));
if (mtmp->mcan)
Strcat(info, ", cancelled");
if (mtmp->mconf)
Strcat(info, ", confused");
if (mtmp->mblinded || !mtmp->mcansee)
Strcat(info, ", blind");
if (mtmp->mstun)
Strcat(info, ", stunned");
if (mtmp->msleeping)
Strcat(info, ", asleep");
#if 0 /* unfortunately mfrozen covers temporary sleep and being busy \
(donning armor, for instance) as well as paralysis */
else if (mtmp->mfrozen)
Strcat(info, ", paralyzed");
#else
else if (mtmp->mfrozen || !mtmp->mcanmove)
Strcat(info, ", can't move");
#endif
/* [arbitrary reason why it isn't moving] */
else if (mtmp->mstrategy & STRAT_WAITMASK)
Strcat(info, ", meditating");
if (mtmp->mflee)
Strcat(info, ", scared");
if (mtmp->mtrapped)
Strcat(info, ", trapped");
if (mtmp->mspeed)
Strcat(info, (mtmp->mspeed == MFAST) ? ", fast"
: (mtmp->mspeed == MSLOW) ? ", slow"
: ", [? speed]");
if (mtmp->minvis)
Strcat(info, ", invisible");
if (mtmp == u.ustuck)
Strcat(info, sticks(g.youmonst.data) ? ", held by you"
: !u.uswallow ? ", holding you"
: attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_DGST)
? ", digesting you"
: is_animal(u.ustuck->data) ? ", swallowing you"
: ", engulfing you");
if (mtmp == u.usteed)
Strcat(info, ", carrying you");
/* avoid "Status of the invisible newt ..., invisible" */
/* and unlike a normal mon_nam, use "saddled" even if it has a name */
Strcpy(monnambuf, x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(SUPPRESS_IT | SUPPRESS_INVISIBLE), FALSE));
pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", monnambuf,
align_str(alignment), mtmp->m_lev, mtmp->mhp, mtmp->mhpmax,
find_mac(mtmp), info);
}
/* stethoscope or probing applied to hero -- one-line feedback */
void
ustatusline()
{
char info[BUFSZ];
info[0] = '\0';
if (Sick) {
Strcat(info, ", dying from");
if (u.usick_type & SICK_VOMITABLE)
Strcat(info, " food poisoning");
if (u.usick_type & SICK_NONVOMITABLE) {
if (u.usick_type & SICK_VOMITABLE)
Strcat(info, " and");
Strcat(info, " illness");
}
}
if (Stoned)
Strcat(info, ", solidifying");
if (Slimed)
Strcat(info, ", becoming slimy");
if (Strangled)
Strcat(info, ", being strangled");
if (Vomiting)
Strcat(info, ", nauseated"); /* !"nauseous" */
if (Confusion)
Strcat(info, ", confused");
if (Blind) {
Strcat(info, ", blind");
if (u.ucreamed) {
if ((long) u.ucreamed < Blinded || Blindfolded
|| !haseyes(g.youmonst.data))
Strcat(info, ", cover");
Strcat(info, "ed by sticky goop");
} /* note: "goop" == "glop"; variation is intentional */
}
if (Stunned)
Strcat(info, ", stunned");
if (!u.usteed && Wounded_legs) {
const char *what = body_part(LEG);
if ((Wounded_legs & BOTH_SIDES) == BOTH_SIDES)
what = makeplural(what);
Sprintf(eos(info), ", injured %s", what);
}
if (Glib)
Sprintf(eos(info), ", slippery %s", makeplural(body_part(HAND)));
if (u.utrap)
Strcat(info, ", trapped");
if (Fast)
Strcat(info, Very_fast ? ", very fast" : ", fast");
if (u.uundetected)
Strcat(info, ", concealed");
if (Invis)
Strcat(info, ", invisible");
if (u.ustuck) {
if (sticks(g.youmonst.data))
Strcat(info, ", holding ");
else
Strcat(info, ", held by ");
Strcat(info, mon_nam(u.ustuck));
}
pline("Status of %s (%s): Level %d HP %d(%d) AC %d%s.", g.plname,
piousness(FALSE, align_str(u.ualign.type)),
Upolyd ? mons[u.umonnum].mlevel : u.ulevel, Upolyd ? u.mh : u.uhp,
Upolyd ? u.mhmax : u.uhpmax, u.uac, info);
}
/*priest.c*/