-/* NetHack 3.6 do_name.c $NHDT-Date: 1519420054 2018/02/23 21:07:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.128 $ */
+/* NetHack 3.6 do_name.c $NHDT-Date: 1555627306 2019/04/18 22:41:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.145 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
[1] "pick a %s"
[2] "use XXX to move the cursor to %s"
*/
-const char *const gloc_descr[NUM_GLOCS][4] = {
+static const char *const gloc_descr[NUM_GLOCS][4] = {
#if 0 /*JP*/
- { "any monsters", "monster", "next monster", "monsters" },
- { "any items", "item", "next object", "objects" },
- { "any doors", "door", "next door or doorway", "doors or doorways" },
+ { "any monsters", "monster", "next/previous monster", "monsters" },
+ { "any items", "item", "next/previous object", "objects" },
+ { "any doors", "door", "next/previous door or doorway", "doors or doorways" },
{ "any unexplored areas", "unexplored area", "unexplored location",
"unexplored locations" },
{ "anything interesting", "interesting thing", "anything interesting",
- "anything interesting" }
+ "anything interesting" },
+ { "any valid locations", "valid location", "valid location",
+ "valid locations" }
#else
{ "\89ö\95¨", "\89ö\95¨", "\89ö\95¨\82Ì\97×", "\89ö\95¨" },
{ "\95¨", "\95¨", "\95¨\82Ì\97×", "\95¨" },
{ "\94à", "\94à", "\94à\82â\8fo\93ü\82è\8cû\82Ì\97×", "\94à\82â\8fo\93ü\82è\8cû" },
{ "\96¢\92T\8dõ\95\94\95ª", "\96¢\92T\8dõ\95\94\95ª", "\96¢\92T\8dõ\82Ì\88Ê\92u", "\96¢\92T\8dõ\82Ì\88Ê\92u" },
- { "\8aÖ\90S\82Ì\82 \82é\82à\82Ì", "\8aÖ\90S\82Ì\82 \82é\82à\82Ì", "\8aÖ\90S\82Ì\82 \82é\82à\82Ì", "\8aÖ\90S\82Ì\82 \82é\82à\82Ì" }
+ { "\8aÖ\90S\82Ì\82 \82é\82à\82Ì", "\8aÖ\90S\82Ì\82 \82é\82à\82Ì", "\8aÖ\90S\82Ì\82 \82é\82à\82Ì", "\8aÖ\90S\82Ì\82 \82é\82à\82Ì" },
+ { "\97L\8cø\82È\88Ê\92u", "\97L\8cø\82È\88Ê\92u", "\97L\8cø\82È\88Ê\92u", "\97L\8cø\82È\88Ê\92u" },
#endif
};
-const char *const gloc_filtertxt[NUM_GFILTER] = {
+static const char *const gloc_filtertxt[NUM_GFILTER] = {
#if 0 /*JP*/
"",
" in view",
char sbuf[BUFSZ];
#if 0 /*JP*/
- Sprintf(sbuf, "Use '%s' or '%s' to %s%s%s.",
+ Sprintf(sbuf, "Use '%s'/'%s' to %s%s%s.",
k1, k2,
iflags.getloc_usemenu ? "get a menu of "
: "move the cursor to ",
boolean force;
const char *goal;
{
- char sbuf[BUFSZ];
- boolean doing_what_is;
- winid tmpwin = create_nhwindow(NHW_MENU);
#if 0 /*JP*/
- const char *const fastmovemode[2] = { "8 units at a time",
- "skipping same glyphs" };
+ static const char *const fastmovemode[2] = { "8 units at a time",
+ "skipping same glyphs" };
#else
- const char *const fastmovemode[2] = { "\88ê\93x\82É8\83}\83X",
- "\93¯\82¶\92n\8c`\82ð\94ò\82Î\82µ\82Ä" };
+ static const char *const fastmovemode[2] = { "\88ê\93x\82É8\83}\83X",
+ "\93¯\82¶\92n\8c`\82ð\94ò\82Î\82µ\82Ä" };
#endif
+ char sbuf[BUFSZ];
+ boolean doing_what_is;
+ winid tmpwin = create_nhwindow(NHW_MENU);
#if 0 /*JP*/
Sprintf(sbuf,
}
/* disgusting hack; the alternate selection characters work for any
getpos call, but only matter for dowhatis (and doquickwhatis) */
- doing_what_is = (goal == what_is_an_unknown_object);
+ doing_what_is = (goal == what_is_an_unknown_object);
if (doing_what_is) {
#if 0 /*JP*/
Sprintf(kbuf, "'%s' or '%s' or '%s' or '%s'",
#endif
putstr(tmpwin, 0, sbuf);
if (doing_what_is) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(sbuf,
" '%s' describe current spot, show 'more info', move to another spot.",
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_V]));
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_V]));
#endif
putstr(tmpwin, 0, sbuf);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(sbuf,
" '%s' describe current spot,%s move to another spot;",
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK]),
flags.help ? "\92Ç\89Á\8fî\95ñ\82ª\82 \82ê\82Î\8am\94F\82µ\81C" : "");
#endif
putstr(tmpwin, 0, sbuf);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(sbuf,
" '%s' describe current spot, move to another spot;",
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_Q]));
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_Q]));
#endif
putstr(tmpwin, 0, sbuf);
-#if 0 /*JP*/
+#if 0 /*JP:T*/
Sprintf(sbuf,
" '%s' describe current spot, stop looking at things;",
visctrl(Cmd.spkeys[NHKF_GETPOS_PICK_O]));
}
STATIC_OVL int
-gloc_filter_floodfill_matcharea(x,y)
-int x,y;
+gloc_filter_floodfill_matcharea(x, y)
+int x, y;
{
int glyph = back_to_glyph(x, y);
{
if (iflags.getloc_filter == GFILTER_AREA) {
if (!gloc_filter_map) {
- gloc_filter_map = selection_opvar(NULL);
+ gloc_filter_map = selection_opvar((char *) 0);
}
/* special case: if we're in a doorway, try to figure out which
direction we're moving, and use that side of the doorway */
} else {
gloc_filter_floodfill(u.ux, u.uy);
}
-
-
}
}
{
if (gloc_filter_map) {
opvar_free_x(gloc_filter_map);
- gloc_filter_map = NULL;
+ gloc_filter_map = (struct opvar *) 0;
}
}
|| IS_UNEXPLORED_LOC(x - 1, y)
|| IS_UNEXPLORED_LOC(x, y + 1)
|| IS_UNEXPLORED_LOC(x, y - 1)));
+ case GLOC_VALID:
+ if (getpos_getvalid)
+ return (*getpos_getvalid)(x,y);
+ /*FALLTHRU*/
case GLOC_INTERESTING:
return gather_locs_interesting(x,y, GLOC_DOOR)
|| !(glyph_is_cmap(glyph)
|| glyph_to_cmap(glyph) == S_darkroom
|| glyph_to_cmap(glyph) == S_corr
|| glyph_to_cmap(glyph) == S_litcorr));
- case GLOC_VALID:
- return (getpos_getvalid && getpos_getvalid(x,y));
}
/*NOTREACHED*/
return FALSE;
/* explicit direction; 'one step' is implicit */
Sprintf(buf, "%s", directionname(dst));
} else {
- const char *dirnames[4][2] = {
+ static const char *dirnames[4][2] = {
#if 0 /*JP*/
{ "n", "north" },
{ "s", "south" },
cc.x = cx;
cc.y = cy;
- if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch)) {
+ if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch,
+ (struct permonst **) 0)) {
(void) coord_desc(cx, cy, tmpbuf, iflags.getpos_coords);
#if 0 /*JP*/
custompline(SUPPRESS_HISTORY,
"%s%s%s%s%s", firstmatch, *tmpbuf ? " " : "", tmpbuf,
(iflags.autodescribe
- && getpos_getvalid && !getpos_getvalid(cx, cy))
+ && getpos_getvalid && !(*getpos_getvalid)(cx, cy))
? " (illegal)" : "",
(iflags.getloc_travelmode && !is_valid_travelpt(cx, cy))
? " (no travel path)" : "");
*/
const char *firstmatch = "\95s\96¾";
int sym = 0;
+
any.a_int = i + 1;
tmpcc.x = garr[i].x;
tmpcc.y = garr[i].y;
- if (do_screen_description(tmpcc, TRUE, sym, tmpbuf, &firstmatch)) {
+ if (do_screen_description(tmpcc, TRUE, sym, tmpbuf,
+ &firstmatch, (struct permonst **)0)) {
(void) coord_desc(garr[i].x, garr[i].y, tmpbuf,
iflags.getpos_coords);
Sprintf(fullbuf, "%s%s%s", firstmatch,
}
}
-#if 0 /*JP*/
- Sprintf(tmpbuf, "Pick a target %s%s%s",
- gloc_descr[gloc][1],
+#if 0 /*JP:T*/
+ Sprintf(tmpbuf, "Pick %s%s%s",
+ an(gloc_descr[gloc][1]),
gloc_filtertxt[iflags.getloc_filter],
- iflags.getloc_travelmode ? " for travel" : "");
+ iflags.getloc_travelmode ? " for travel destination" : "");
#else
Sprintf(tmpbuf, "%s%s\82Å\96Ú\95W\82Æ\82·\82é%s\82ð\91I\91ð\82µ\82Ä\82\82¾\82³\82¢",
iflags.getloc_travelmode ? "\88Ú\93®\82Ì\82½\82ß\82É" : "",
const char *goal;
{
const char *cp;
- struct {
+ static struct {
int nhkf, ret;
} const pick_chars_def[] = {
{ NHKF_GETPOS_PICK, LOOK_TRADITIONAL },
{ NHKF_GETPOS_PICK_O, LOOK_ONCE },
{ NHKF_GETPOS_PICK_V, LOOK_VERBOSE }
};
- const int mMoOdDxX_def[] = {
+ static const int mMoOdDxX_def[] = {
NHKF_GETPOS_MON_NEXT,
NHKF_GETPOS_MON_PREV,
NHKF_GETPOS_OBJ_NEXT,
msg_given = TRUE;
goto nxtc;
} else if (c == Cmd.spkeys[NHKF_GETPOS_LIMITVIEW]) {
- const char *const view_filters[NUM_GFILTER] = {
+ static const char *const view_filters[NUM_GFILTER] = {
#if 0 /*JP*/
"Not limiting targets",
- "Limiting targets to in sight",
- "Limiting targets to in same area"
+ "Limiting targets to those in sight",
+ "Limiting targets to those in same area"
#else
"\83^\81[\83Q\83b\83g\82ð\90§\8cÀ\82µ\82È\82¢",
"\8e\8b\8aE\93à\82É\83^\81[\83Q\83b\83g\82ð\90§\8cÀ\82·\82é",
"\93¯\82¶\83G\83\8a\83A\82É\83^\81[\83Q\83b\83g\82ð\90§\8cÀ\82·\82é"
#endif
};
+
iflags.getloc_filter = (iflags.getloc_filter + 1) % NUM_GFILTER;
for (i = 0; i < NUM_GLOCS; i++) {
if (garr[i]) {
goto nxtc;
} else if (c == Cmd.spkeys[NHKF_GETPOS_MENU]) {
iflags.getloc_usemenu = !iflags.getloc_usemenu;
-#if 0 /*JP*/
- pline("%s a menu to show possible targets.",
- iflags.getloc_usemenu ? "Using" : "Not using");
+#if 0 /*JP:T*/
+ pline("%s a menu to show possible targets%s.",
+ iflags.getloc_usemenu ? "Using" : "Not using",
+ iflags.getloc_usemenu
+ ? " for 'm|M', 'o|O', 'd|D', and 'x|X'" : "");
#else
- pline("\89Â\94\\82È\83^\81[\83Q\83b\83g\82ð\8c©\82é\82Ì\82É\83\81\83j\83\85\81[\82ð\8eg%s\81D",
- iflags.getloc_usemenu ? "\82¤" : "\82í\82È\82¢");
+ pline("\89Â\94\\82È\83^\81[\83Q\83b\83g\82ð\8c©\82é\82Ì\82É\83\81\83j\83\85\81[\82ð\8eg%s\81D%s",
+ iflags.getloc_usemenu ? "\82¤" : "\82í\82È\82¢",
+ iflags.getloc_usemenu
+ ? "('m|M', 'o|O', 'd|D', 'x|X'\97p)" : "");
#endif
msg_given = TRUE;
goto nxtc;
if (iflags.getloc_usemenu) {
coord tmpcrd;
+
if (getpos_menu(&tmpcrd, gloc)) {
cx = tmpcrd.x;
cy = tmpcrd.y;
if (!mtmp
|| (!sensemon(mtmp)
&& (!(cansee(cx, cy) || see_with_infrared(mtmp))
- || mtmp->mundetected || mtmp->m_ap_type == M_AP_FURNITURE
- || mtmp->m_ap_type == M_AP_OBJECT
+ || mtmp->mundetected || M_AP_TYPE(mtmp) == M_AP_FURNITURE
+ || M_AP_TYPE(mtmp) == M_AP_OBJECT
|| (mtmp->minvis && !See_invisible)))) {
/*JP
pline("I see no monster there.");
/* for "the Foo of Bar", only scuff "Foo of Bar" part */
bufp = !strncmpi(bufcpy, "the ", 4) ? (buf + 4) : buf;
do {
- wipeout_text(bufp, rnd(2), (unsigned) 0);
+ wipeout_text(bufp, rn2_on_display_rng(2), (unsigned) 0);
} while (!strcmp(buf, bufcpy));
/*JP
pline("While engraving, your %s slips.", body_part(HAND));
#endif
return;
}
- /* note well: 'obj' might be as instance of STRANGE_OBJECT if target
+ /* note well: 'obj' might be an instance of STRANGE_OBJECT if target
is a mimic; passing that to xname (directly or via simpleonames)
would yield "glorkum" so we need to handle it explicitly; it will
always fail the Hallucination test and pass the !callable test,
unames[0] = ((Upolyd ? u.mfemale : flags.female) && urole.name.f)
? urole.name.f
: urole.name.m;
- /* random rank title for hero's role */
- unames[1] = rank_of(rnd(30), Role_switch, flags.female);
+ /* random rank title for hero's role
+
+ note: the 30 is hardcoded in xlev_to_rank, so should be
+ hardcoded here too */
+ unames[1] = rank_of(rn2_on_display_rng(30) + 1,
+ Role_switch, flags.female);
/* random fake monster */
unames[2] = bogusmon(tmpbuf, (char *) 0);
/* increased chance for fake monster */
unames[5] = "Wibbly Wobbly";
*/
unames[5] = "\82¤\82ë\82¤\82ë";
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s %s to call you \"%s.\"",
The(buf), use_plural ? "decide" : "decides",
- unames[rn2(SIZE(unames))]);
+ unames[rn2_on_display_rng(SIZE(unames))]);
#else
pline("%s\82Í\82 \82È\82½\82ð\81u%s\81v\82Æ\8cÄ\82Ô\82±\82Æ\82É\8c\88\82ß\82½\81D",
buf,
- unames[rn2(SIZE(unames))]);
+ unames[rn2_on_display_rng(SIZE(unames))]);
#endif
} else if (!objtyp_is_callable(obj->otyp)) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
pline("%s %s can't be assigned a type name.",
use_plural ? "Those" : "That", buf);
#else
buf);
#endif
} else if (!obj->dknown) {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
You("don't know %s %s well enough to name %s.",
use_plural ? "those" : "that", buf, use_plural ? "them" : "it");
#else
} else {
docall(obj);
}
- if (fakeobj)
+ if (fakeobj) {
+ obj->where = OBJ_FREE; /* object_from_map() sets it to OBJ_FLOOR */
dealloc_obj(obj);
+ }
}
static const char *const ghostnames[] = {
*/
Strcat(buf, "\88Æ\82Ì\82Â\82¢\82Ä\82¢\82é");
#if 0 /*JP*/
- if (buf[0] != 0)
- has_adjectives = TRUE;
- else
- has_adjectives = FALSE;
+ has_adjectives = (buf[0] != '\0');
#endif
/* Put the actual monster name or type into the buffer now */
{
char *mname = buf;
- get_rnd_text(BOGUSMONFILE, buf);
+ get_rnd_text(BOGUSMONFILE, buf, rn2_on_display_rng);
/* strip prefix if present */
if (!letter(*mname)) {
if (code)
*code = '\0';
do {
- name = rn1(SPECIAL_PM + BOGUSMONSIZE - LOW_PM, LOW_PM);
+ name = rn2_on_display_rng(SPECIAL_PM + BOGUSMONSIZE - LOW_PM) + LOW_PM;
} while (name < SPECIAL_PM
&& (type_is_pname(&mons[name]) || (mons[name].geno & G_NOGEN)));
hcolor(colorpref)
const char *colorpref;
{
- return (Hallucination || !colorpref) ? hcolors[rn2(SIZE(hcolors))]
- : colorpref;
+ return (Hallucination || !colorpref)
+ ? hcolors[rn2_on_display_rng(SIZE(hcolors))]
+ : colorpref;
}
/* return a random real color unless hallucinating */
"instant coffee", "tea", "herbal infusion", "liquid rainbow",
"creamy foam", "mulled wine", "bouillon", "nectar", "grog", "flubber",
"ketchup", "slow light", "oil", "vinaigrette", "liquid crystal", "honey",
- "caramel sauce", "ink", "aqueous humour", "milk substitute", "fruit juice",
- "glowing lava", "gastric acid", "mineral water", "cough syrup", "quicksilver",
- "sweet vitriol", "grey goo", "pink slime",
+ "caramel sauce", "ink", "aqueous humour", "milk substitute",
+ "fruit juice", "glowing lava", "gastric acid", "mineral water",
+ "cough syrup", "quicksilver", "sweet vitriol", "grey goo", "pink slime",
#else
"\83\88\81[\83O\83\8b\83g", "\83E\81[\83u\83\8c\83b\83N", "\8c\8c\8cÐ", "\8fö\97¯\90\85", "\90¸\90»\90\85",
"\83C\83\93\83X\83^\83\93\83g\83R\81[\83q\81[", "\8dg\92\83", "\83n\81[\83u\89t", "\89t\91Ì\82Ì\93ø",
"\83N\83\8a\81[\83~\81[\83t\83H\81[\83\80", "\83z\83b\83g\83\8f\83C\83\93", "\83u\83C\83\88\83\93", "\89Ê\8f`", "\83O\83\8d\83b\83O", "\83t\83\89\83o\81[",
"\83P\83`\83\83\83b\83v", "\92á\91¬\8cõ", "\96û", "\83r\83l\83O\83\8c\83b\83g\83\\81[\83X", "\89t\91Ì\90\85\8f»", "\96I\96¨",
- "\83J\83\89\83\81\83\8b\83\\81[\83X", "\83C\83\93\83N", "\96[\90\85", "\91ã\97p\93û", "\83t\83\8b\81[\83c\83W\83\85\81[\83X",
- "\97¬\82ê\82é\97n\8aâ", "\88Ý\8e_", "\83~\83l\83\89\83\8b\83E\83H\81[\83^\81[", "\8aP\8e~\82ß\83V\83\8d\83b\83v", "\90\85\8bâ",
- "\83W\83G\83`\83\8b\83G\81[\83e\83\8b", "\83O\83\8c\83C\83O\81[", "\83s\83\93\83N\83X\83\89\83C\83\80",
+ "\83J\83\89\83\81\83\8b\83\\81[\83X", "\83C\83\93\83N", "\96[\90\85", "\91ã\97p\93û",
+ "\83t\83\8b\81[\83c\83W\83\85\81[\83X", "\97¬\82ê\82é\97n\8aâ", "\88Ý\8e_", "\83~\83l\83\89\83\8b\83E\83H\81[\83^\81[",
+ "\8aP\8e~\82ß\83V\83\8d\83b\83v", "\90\85\8bâ", "\83W\83G\83`\83\8b\83G\81[\83e\83\8b", "\83O\83\8c\83C\83O\81[", "\83s\83\93\83N\83X\83\89\83C\83\80",
#endif
};
const char *liquidpref;
{
return (Hallucination || !liquidpref) ? hliquids[rn2(SIZE(hliquids))]
- : liquidpref;
+ : liquidpref;
}
/* Aliases for road-runner nemesis
return buf;
}
+char *
+rndorcname(s)
+char *s;
+{
+ static const char *v[] = { "a", "ai", "og", "u" };
+ static const char *snd[] = { "gor", "gris", "un", "bane", "ruk",
+ "oth","ul", "z", "thos","akh","hai" };
+ int i, iend = rn1(2, 3), vstart = rn2(2);
+
+ if (s) {
+ *s = '\0';
+ for (i = 0; i < iend; ++i) {
+ vstart = 1 - vstart; /* 0 -> 1, 1 -> 0 */
+ Sprintf(eos(s), "%s%s", (i > 0 && !rn2(30)) ? "-" : "",
+ vstart ? v[rn2(SIZE(v))] : snd[rn2(SIZE(snd))]);
+ }
+ }
+ return s;
+}
+
+struct monst *
+christen_orc(mtmp, gang, other)
+struct monst *mtmp;
+const char *gang, *other;
+{
+ int sz = 0;
+ char buf[BUFSZ], buf2[BUFSZ], *orcname;
+
+ orcname = rndorcname(buf2);
+ sz = (int) strlen(orcname);
+ if (gang)
+ sz += (int) (strlen(gang) + sizeof " of " - sizeof "");
+ else if (other)
+ sz += (int) strlen(other);
+
+ if (sz < BUFSZ) {
+ char gbuf[BUFSZ];
+ boolean nameit = FALSE;
+
+ if (gang && orcname) {
+ Sprintf(buf, "%s of %s", upstart(orcname),
+ upstart(strcpy(gbuf, gang)));
+ nameit = TRUE;
+ } else if (other && orcname) {
+ Sprintf(buf, "%s%s", upstart(orcname), other);
+ nameit = TRUE;
+ }
+ if (nameit)
+ mtmp = christen_monst(mtmp, buf);
+ }
+ return mtmp;
+}
+
/* make sure "The Colour of Magic" remains the first entry in here */
static const char *const sir_Terry_novels[] = {
"The Colour of Magic", "The Light Fantastic", "Equal Rites", "Mort",