MCPcopy Create free account
hub / github.com/NetHack/NetHack / background_enlightenment

Function background_enlightenment

src/insight.c:467–722  ·  view source on GitHub ↗

ARGSUSED*/ display role, race, alignment and such to en_win */

Source from the content-addressed store, hash-verified

465/*ARGSUSED*/
466/* display role, race, alignment and such to en_win */
467staticfn void
468background_enlightenment(int unused_mode UNUSED, int final)
469{
470 const char *role_titl, *rank_titl;
471 int innategend, difgend, difalgn;
472 char buf[BUFSZ], tmpbuf[BUFSZ];
473
474 /* note that if poly'd, we need to use u.mfemale instead of flags.female
475 to access hero's saved gender-as-human/elf/&c rather than current */
476 innategend = (Upolyd ? u.mfemale : flags.female) ? 1 : 0;
477 role_titl = (innategend && gu.urole.name.f) ? gu.urole.name.f
478 : gu.urole.name.m;
479 rank_titl = rank_of(u.ulevel, Role_switch, innategend);
480
481 enlght_out(""); /* separator after title */
482 enlght_out("Background:");
483
484 /* if polymorphed, report current shape before underlying role;
485 will be repeated as first status: "you are transformed" and also
486 among various attributes: "you are in beast form" (after being
487 told about lycanthropy) or "you are polymorphed into <a foo>"
488 (with countdown timer appended for wizard mode); we really want
489 the player to know he's not a samurai at the moment... */
490 if (Upolyd) {
491 char anbuf[20]; /* includes trailing space; [4] suffices */
492 struct permonst *uasmon = gy.youmonst.data;
493 boolean altphrasing = vampshifted(&gy.youmonst);
494
495 tmpbuf[0] = '\0';
496 /* here we always use current gender, not saved role gender */
497 if (!is_male(uasmon) && !is_female(uasmon) && !is_neuter(uasmon))
498 Sprintf(tmpbuf, "%s ", genders[flags.female ? 1 : 0].adj);
499 if (altphrasing)
500 Sprintf(eos(tmpbuf), "%s in ",
501 pmname(&mons[gy.youmonst.cham],
502 flags.female ? FEMALE : MALE));
503 Snprintf(buf, sizeof(buf), "%s%s%s%s form",
504 !final ? "currently " : "",
505 altphrasing ? just_an(anbuf, tmpbuf) : "in ",
506 tmpbuf, pmname(uasmon, flags.female ? FEMALE : MALE));
507 you_are(buf, "");
508 }
509
510 /* report role; omit gender if it's redundant (eg, "female priestess") */
511 tmpbuf[0] = '\0';
512 if (!gu.urole.name.f
513 && ((gu.urole.allow & ROLE_GENDMASK) == (ROLE_MALE | ROLE_FEMALE)
514 || innategend != flags.initgend))
515 Sprintf(tmpbuf, "%s ", genders[innategend].adj);
516 buf[0] = '\0';
517 if (Upolyd)
518 Strcpy(buf, "actually "); /* "You are actually a ..." */
519 if (!strcmpi(rank_titl, role_titl)) {
520 /* omit role when rank title matches it */
521 Sprintf(eos(buf), "%s, level %d %s%s", an(rank_titl), u.ulevel,
522 tmpbuf, gu.urace.noun);
523 } else {
524 Sprintf(eos(buf), "%s, a level %d %s%s %s", an(rank_titl), u.ulevel,

Callers 1

enlightenmentFunction · 0.85

Calls 15

rank_ofFunction · 0.85
enlght_outFunction · 0.85
eosFunction · 0.85
pmnameFunction · 0.85
just_anFunction · 0.85
anFunction · 0.85
align_strFunction · 0.85
u_gnameFunction · 0.85
align_gnameFunction · 0.85
body_partFunction · 0.85
observable_depthFunction · 0.85
endgamelevelnameFunction · 0.85

Tested by

no test coverage detected