-/* NetHack 3.6 role.c $NHDT-Date: 1446861770 2015/11/07 02:02:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
+/* NetHack 3.6 role.c $NHDT-Date: 1547086250 2019/01/10 02:10:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.56 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
+/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
+/* JNetHack Copyright */
+/* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020 */
+/* JNetHack may be freely redistributed. See license for details. */
+
#include "hack.h"
/*** Table of all roles ***/
* God names use a leading underscore to flag goddesses.
*/
const struct Role roles[] = {
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Archeologist", 0 },
{ { "Digger", 0 },
{ "Field Worker", 0 },
{ "\93´\8cA\8aw\8eÒ", 0 },
{ "\94ü\8fp\8eû\8fW\8eÒ", 0 },
{ "\8aÙ\92·", 0 } },
- "Quetzalcoatl", "Camaxtli", "Huhetotl", /* Central American */
+ "\83P\83c\83A\83\8b\83J\83g\83\8b", "\83J\83}\83L\83V\83g\83\8a", "\83t\83w\83g\83g\83\8b", /* Central American */
#endif
"Arc",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the College of Archeology",
"the Tomb of the Toltec Kings",
#else
A_INT,
SPE_MAGIC_MAPPING,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Barbarian", 0 },
{ { "Plunderer", "Plunderess" },
{ "Pillager", 0 },
{ "\8eE\9dC\8eÒ", 0 },
{ "\8eñ\97Ì", 0 },
{ "\90ª\95\9e\8eÒ", 0 } },
- "Mitra", "Crom", "Set", /* Hyborian */
+ "\83~\83g\83\89", "\83N\83\8d\83\80", "\83Z\83g", /* Hyborian */
#endif
"Bar",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Camp of the Duali Tribe",
"the Duali Oasis",
#else
A_INT,
SPE_HASTE_SELF,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Caveman", "Cavewoman" },
{ { "Troglodyte", 0 },
{ "Aborigine", 0 },
{ "\97V\96q\96¯", 0 },
{ "\97¬\98Q\8eÒ", 0 },
{ "\90æ\8bì\8eÒ", 0 } },
- "Anu", "_Ishtar", "Anshar", /* Babylonian */
+ "\83A\83k", "_\83C\83V\83\85\83^\83\8b", "\83A\83\93\83V\83\83\83\8b", /* Babylonian */
#endif
"Cav",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Caves of the Ancestors",
"the Dragon's Lair",
#else
A_INT,
SPE_DIG,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Healer", 0 },
{ { "Rhizotomist", 0 },
{ "Empiric", 0 },
{ "\88ã\8et\8eå\94C", 0 },
{ "\93à\89È\88ã", 0 },
{ "\8aO\89È\88ã", 0 } },
- "_Athena", "Hermes", "Poseidon", /* Greek */
+ "_\83A\83e\83i", "\83w\83\8b\83\81\83X", "\83|\83Z\83C\83h\83\93", /* Greek */
#endif
"Hea",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Temple of Epidaurus",
"the Temple of Coeus",
#else
A_WIS,
SPE_CURE_SICKNESS,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Knight", 0 },
{ { "Gallant", 0 },
{ "Esquire", 0 },
{ "\8fd\8bR\8em", 0 },
{ "\8cM\8bR\8em", 0 },
{ "\90¹\8bR\8em", 0 } },
- "Lugh", "_Brigit", "Manannan Mac Lir", /* Celtic */
+ "\83\8b\81[\83t", "_\83u\83\8a\83W\83b\83g", "\83}\83i\83\93\83i\83\93\81E\83}\83N\83\8a\81[\83\8b", /* Celtic */
#endif
"Kni",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"Camelot Castle",
"the Isle of Glass",
#else
A_WIS,
SPE_TURN_UNDEAD,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Monk", 0 },
{ { "Candidate", 0 },
{ "Novice", 0 },
{ "\96Ø\82Ì\8fK\82¢\8eè", 0 },
{ "\89Î\82Ì\8fK\82¢\8eè", 0 },
{ "\96Æ\8b\96\8aF\93`", 0 } },
- "Shan Lai Ching", "Chih Sung-tzu", "Huan Ti", /* Chinese */
+ "\8eR\97\8b\90¸", "\90Ô\8f¼\8eq", "\89©\92é", /* Chinese */
#endif
"Mon",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Monastery of Chan-Sune",
"the Monastery of the Earth-Lord",
#else
A_WIS,
SPE_RESTORE_ABILITY,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Priest", "Priestess" },
{ { "Aspirant", 0 },
{ "Acolyte", 0 },
0, 0, 0, /* deities from a randomly chosen other role will be used */
#endif
"Pri",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Great Temple",
"the Temple of Nalzok",
#else
-4 },
/* Note: Rogue precedes Ranger so that use of `-R' on the command line
retains its traditional meaning. */
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Rogue", 0 },
{ { "Footpad", 0 },
{ "Cutpurse", 0 },
{ "\93D\96_", 0 },
{ "\8b\93\90", 0 },
{ "\91å\93D\96_", 0 } },
- "Issek", "Mog", "Kos", /* Nehwon */
+ "\83C\83Z\83b\83N", "\83\82\83O", "\83R\83X", /* Nehwon */
#endif
"Rog",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Thieves' Guild Hall",
"the Assassins' Guild Hall",
#else
A_INT,
SPE_DETECT_TREASURE,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Ranger", 0 },
{
#if 0 /* OBSOLETE */
{ "\92\86\8b\89\8b|\95º", 0 },
{ "\8fã\8b\89\8b|\95º", 0 },
{ "\8fã\8b\89\8b|\95º", 0 } },
- "Mercury", "_Venus", "Mars", /* Roman/planets */
+ "\83}\81[\83L\83\85\83\8a\81[", "_\83r\81[\83i\83X", "\83}\81[\83Y", /* Roman/planets */
#endif
"Ran",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"Orion's camp",
"the cave of the wumpus",
#else
A_INT,
SPE_INVISIBILITY,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Samurai", 0 },
{ { "Hatamoto", 0 }, /* Banner Knight */
{ "Ronin", 0 }, /* no allegiance */
{ "\91å\96¼", "\8d\98\8c³" }, /* a samurai lord */
{ "\8cö\89Æ", 0 }, /* Noble of the Court */
{ "\8cö\89Æ", "\91å\89\9c" } }, /* supreme commander, warlord */
- "_Amaterasu Omikami", "Raijin", "Susanowo", /* Japanese */
+ "_\93V\8fÆ\91å\90_", "\97\8b\90_", "\90{\8d²\94V\92j", /* Japanese */
#endif
"Sam",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Castle of the Taro Clan",
"the Shogun's Castle",
#else
A_INT,
SPE_CLAIRVOYANCE,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Tourist", 0 },
{ { "Rambler", 0 },
{ "Sightseer", 0 },
{ "\8dq\8aC\8eÒ", 0 },
{ "\92T\8c\9f\89Æ", 0 },
{ "\96`\8c¯\8eÒ", 0 } },
- "Blind Io", "_The Lady", "Offler", /* Discworld */
+ "\96Ó\96Ú\82Ì\83C\83I", "_\81\83\8f\97\90_\81\84", "\83I\83t\83\89\81[", /* Discworld */
#endif
"Tou",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"Ankh-Morpork",
"the Thieves' Guild Hall",
#else
- "\96`\8c¯\8eÒ",
+ "\83A\83\93\83N\83\82\83\8b\83|\81[\83N",
"\93\90\91¯\83M\83\8b\83h",
#endif
PM_TOURIST,
A_INT,
SPE_CHARM_MONSTER,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Valkyrie", 0 },
{ { "Stripling", 0 },
{ "Skirmisher", 0 },
{ "\89p\97Y", 0 },
{ "\90æ\93±\8eÒ", 0 },
{ "\83\8d\81[\83h", "\83\8c\83f\83B" } },
- "Tyr", "Odin", "Loki", /* Norse */
+ "\83`\83\85\81[\83\8b", "\83I\81[\83f\83B\83\93", "\83\8d\83L", /* Norse */
#endif
"Val",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Shrine of Destiny",
"the cave of Surtur",
#else
A_WIS,
SPE_CONE_OF_COLD,
-4 },
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ { "Wizard", 0 },
{ { "Evoker", 0 },
{ "Conjurer", 0 },
{ "\96\82\8fp\8et", 0 },
{ "\96\82\96@\8eg\82¢", 0 },
{ "\91å\96\82\96@\8eg\82¢", 0 } },
- "Ptah", "Thoth", "Anhur", /* Egyptian */
+ "\83v\83^\83n", "\83g\81[\83g", "\83A\83\93\83t\83\8b", /* Egyptian */
#endif
"Wiz",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"the Lonely Tower",
"the Tower of Darkness",
#else
/* Table of all races */
const struct Race races[] = {
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"human",
"human",
"humanity",
"\90l\8aÔ",
#endif
"Hum",
-#if 0 /*JP*/
+#if 0 /*JP:T*/
{ "man", "woman" },
#else
{ "\92j", "\8f\97" },
{ 1, 0, 2, 0, 2, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"elf",
"elven",
"elvenkind",
{ 2, 0, 3, 0, 3, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"dwarf",
"dwarven",
"dwarvenkind",
{ 0, 0, 0, 0, 0, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"gnome",
"gnomish",
"gnomehood",
{ 2, 0, 2, 0, 2, 0 } /* Energy */
},
{
-#if 0 /*JP*/
+#if 0 /*JP:T*/
"orc",
"orcish",
"orcdom",
};
/* Table of all genders */
+/*JP:
+- steed.c kick_steed() He[] \82É\92l\82ª\83R\83s\81[\82³\82ê\82é\82Ì\82Å\92·\82³\82ð\95Ï\82¦\82½\82Æ\82«\82É\82Í
+ \8aY\93\96\95\94\82à\97v\8fC\90³\81B
+*/
const struct Gender genders[] = {
+#if 0 /*JP:T*/
{ "male", "he", "him", "his", "Mal", ROLE_MALE },
{ "female", "she", "her", "her", "Fem", ROLE_FEMALE },
{ "neuter", "it", "it", "its", "Ntr", ROLE_NEUTER }
+#else
+ { "\92j\90«", "\94Þ", "\94Þ", "\94Þ\82Ì", "Mal", ROLE_MALE },
+ { "\8f\97\90«", "\94Þ\8f\97", "\94Þ\8f\97", "\94Þ\8f\97\82Ì", "Fem", ROLE_FEMALE },
+ { "\92\86\90«", "\82»\82ê", "\82»\82ê", "\82»\82Ì", "Ntr", ROLE_NEUTER }
+#endif
};
/* Table of all alignments */
const struct Align aligns[] = {
+#if 0 /*JP:T*/
{ "law", "lawful", "Law", ROLE_LAWFUL, A_LAWFUL },
{ "balance", "neutral", "Neu", ROLE_NEUTRAL, A_NEUTRAL },
{ "chaos", "chaotic", "Cha", ROLE_CHAOTIC, A_CHAOTIC },
{ "evil", "unaligned", "Una", 0, A_NONE }
+#else
+ { "\92\81\8f\98", "\92\81\8f\98\82Ì", "Law", ROLE_LAWFUL, A_LAWFUL },
+ { "\92\86\97§", "\92\86\97§\82Ì", "Neu", ROLE_NEUTRAL, A_NEUTRAL },
+ { "\8d¬\93×", "\8d¬\93×\82Ì", "Cha", ROLE_CHAOTIC, A_CHAOTIC },
+ { "\96³\90S", "\96³\90S\82Ì", "Una", 0, A_NONE }
+#endif
};
/* Filters */
static struct {
boolean roles[SIZE(roles)];
short mask;
-} filter;
+} rfilter;
STATIC_DCL int NDECL(randrole_filtered);
STATIC_DCL char *FDECL(promptsep, (char *, int));
STATIC_DCL int FDECL(race_alignmentcount, (int));
/* used by str2XXX() */
+/*JP
static char NEARDATA randomstr[] = "random";
+*/
+static char NEARDATA randomstr[] = "\83\89\83\93\83_\83\80";
boolean
validrole(rolenum)
}
int
-randrole()
+randrole(for_display)
+boolean for_display;
{
- return rn2(SIZE(roles) - 1);
+ int res = SIZE(roles) - 1;
+
+ if (for_display)
+ res = rn2_on_display_rng(res);
+ else
+ res = rn2(res);
+ return res;
}
STATIC_OVL int
&& ok_gend(i, ROLE_NONE, ROLE_RANDOM, ROLE_NONE)
&& ok_align(i, ROLE_NONE, ROLE_NONE, ROLE_RANDOM))
set[n++] = i;
- return n ? set[rn2(n)] : randrole();
+ return n ? set[rn2(n)] : randrole(FALSE);
}
int
short allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1) {
- if (filter.roles[rolenum])
+ if (rfilter.roles[rolenum])
return FALSE;
allow = roles[rolenum].allow;
if (racenum >= 0 && racenum < SIZE(races) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < SIZE(roles) - 1; i++) {
- if (filter.roles[i])
+ if (rfilter.roles[i])
continue;
allow = roles[i].allow;
if (racenum >= 0 && racenum < SIZE(races) - 1
short allow;
if (racenum >= 0 && racenum < SIZE(races) - 1) {
- if (filter.mask & races[racenum].selfmask)
+ if (rfilter.mask & races[racenum].selfmask)
return FALSE;
allow = races[racenum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < SIZE(races) - 1; i++) {
- if (filter.mask & races[i].selfmask)
+ if (rfilter.mask & races[i].selfmask)
continue;
allow = races[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
}
}
-/* pick a random race subject to any rolenum/gendnum/alignnum constraints */
-/* If pickhow == PICK_RIGID a race is returned only if there is */
-/* a single possibility */
+/* Pick a random race subject to any rolenum/gendnum/alignnum constraints.
+ If pickhow == PICK_RIGID a race is returned only if there is
+ a single possibility. */
int
pick_race(rolenum, gendnum, alignnum, pickhow)
int rolenum, gendnum, alignnum, pickhow;
short allow;
if (gendnum >= 0 && gendnum < ROLE_GENDERS) {
- if (filter.mask & genders[gendnum].allow)
+ if (rfilter.mask & genders[gendnum].allow)
return FALSE;
allow = genders[gendnum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < ROLE_GENDERS; i++) {
- if (filter.mask & genders[i].allow)
+ if (rfilter.mask & genders[i].allow)
continue;
allow = genders[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
short allow;
if (alignnum >= 0 && alignnum < ROLE_ALIGNS) {
- if (filter.mask & aligns[alignnum].allow)
+ if (rfilter.mask & aligns[alignnum].allow)
return FALSE;
allow = aligns[alignnum].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
} else {
/* random; check whether any selection is possible */
for (i = 0; i < ROLE_ALIGNS; i++) {
- if (filter.mask & aligns[i].allow)
+ if (rfilter.mask & aligns[i].allow)
return FALSE;
allow = aligns[i].allow;
if (rolenum >= 0 && rolenum < SIZE(roles) - 1
}
}
-/* pick a random alignment subject to any rolenum/racenum/gendnum constraints
- */
-/* alignment and gender are not comparable (and also not constrainable) */
-/* If pickhow == PICK_RIGID an alignment is returned only if there is */
-/* a single possibility */
+/* Pick a random alignment subject to any rolenum/racenum/gendnum constraints;
+ alignment and gender are not comparable (and also not constrainable).
+ If pickhow == PICK_RIGID an alignment is returned only if there is
+ a single possibility. */
int
pick_align(rolenum, racenum, gendnum, pickhow)
int rolenum, racenum, gendnum, pickhow;
void
rigid_role_checks()
{
+ int tmp;
+
/* Some roles are limited to a single race, alignment, or gender and
* calling this routine prior to XXX_player_selection() will help
* prevent an extraneous prompt that actually doesn't allow
*/
if (flags.initrole == ROLE_RANDOM) {
/* If the role was explicitly specified as ROLE_RANDOM
- * via -uXXXX-@ then choose the role in here to narrow down
- * later choices. Pick a random role in this case.
+ * via -uXXXX-@ or OPTIONS=role:random then choose the role
+ * in here to narrow down later choices.
*/
flags.initrole = pick_role(flags.initrace, flags.initgend,
flags.initalign, PICK_RANDOM);
if (flags.initrole < 0)
flags.initrole = randrole_filtered();
}
+ if (flags.initrace == ROLE_RANDOM
+ && (tmp = pick_race(flags.initrole, flags.initgend,
+ flags.initalign, PICK_RANDOM)) != ROLE_NONE)
+ flags.initrace = tmp;
+ if (flags.initalign == ROLE_RANDOM
+ && (tmp = pick_align(flags.initrole, flags.initrace,
+ flags.initgend, PICK_RANDOM)) != ROLE_NONE)
+ flags.initalign = tmp;
+ if (flags.initgend == ROLE_RANDOM
+ && (tmp = pick_gend(flags.initrole, flags.initrace,
+ flags.initalign, PICK_RANDOM)) != ROLE_NONE)
+ flags.initgend = tmp;
+
if (flags.initrole != ROLE_NONE) {
if (flags.initrace == ROLE_NONE)
flags.initrace = pick_race(flags.initrole, flags.initgend,
boolean reslt = TRUE;
if ((i = str2role(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.roles[i] = TRUE;
+ rfilter.roles[i] = TRUE;
else if ((i = str2race(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.mask |= races[i].selfmask;
+ rfilter.mask |= races[i].selfmask;
else if ((i = str2gend(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.mask |= genders[i].allow;
+ rfilter.mask |= genders[i].allow;
else if ((i = str2align(bufp)) != ROLE_NONE && i != ROLE_RANDOM)
- filter.mask |= aligns[i].allow;
+ rfilter.mask |= aligns[i].allow;
else
reslt = FALSE;
return reslt;
{
int i;
- if (filter.mask)
+ if (rfilter.mask)
return TRUE;
for (i = 0; i < SIZE(roles); ++i)
- if (filter.roles[i])
+ if (rfilter.roles[i])
return TRUE;
return FALSE;
}
int i;
for (i = 0; i < SIZE(roles); ++i)
- filter.roles[i] = FALSE;
- filter.mask = 0;
+ rfilter.roles[i] = FALSE;
+ rfilter.mask = 0;
}
#define BP_ALIGN 0
char *buf;
int num_post_attribs;
{
+#if 0 /*JP*/
const char *conjuct = "and ";
if (num_post_attribs > 1 && post_attribs < num_post_attribs
--post_attribs;
if (!post_attribs && num_post_attribs > 1)
Strcat(buf, conjuct);
+#else
+ /*JP: \93ú\96{\8cê\82Å\82Í "A, B, and C" \82Æ\82¢\82¤\8f\88\97\9d\82Í\95s\97v */
+ if(num_post_attribs > post_attribs){
+ Strcat(buf, "\81C");
+ }
+ --post_attribs;
+#endif
return buf;
}
{
int k, gendercount = 0, aligncount = 0;
char buf[BUFSZ];
+/*JP
static char err_ret[] = " character's";
+*/
+ static char err_ret[] = "\83L\83\83\83\89\83N\83^\81[\82Ì";
+#if 0 /*JP*/
boolean donefirst = FALSE;
+#endif
if (!suppliedbuf || buflen < 1)
return err_ret;
&& ok_align(rolenum, racenum, gendnum, alignnum)) {
/* if race specified, and multiple choice of alignments for it */
if ((racenum >= 0) && (aligncount > 1)) {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
Strcat(buf, aligns[alignnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
Strcat(buf, aligns[alignnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
} else {
/* in case we got here by failing the ok_align() test */
and name of role itself does not distinguish gender */
if ((rolenum != ROLE_NONE) && (gendercount > 1)
&& !roles[rolenum].name.f) {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
Strcat(buf, genders[gendnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
} else {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
Strcat(buf, genders[gendnum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
} else {
/* if gender not specified, but role is specified
if (racenum != ROLE_NONE && racenum != ROLE_RANDOM) {
if (validrole(rolenum)
&& ok_race(rolenum, racenum, gendnum, alignnum)) {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
Strcat(buf, (rolenum == ROLE_NONE) ? races[racenum].noun
: races[racenum].adj);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else if (!validrole(rolenum)) {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
Strcat(buf, races[racenum].noun);
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else {
pa[BP_RACE] = 1;
post_attribs++;
/* <your lawful female gnomish> || <your lawful female gnome> */
if (validrole(rolenum)) {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
if (gendnum != ROLE_NONE) {
if (gendnum == 1 && roles[rolenum].name.f)
Strcat(buf, roles[rolenum].name.f);
} else
Strcat(buf, roles[rolenum].name.m);
}
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
} else if (rolenum == ROLE_NONE) {
pa[BP_ROLE] = 1;
post_attribs++;
if ((racenum == ROLE_NONE || racenum == ROLE_RANDOM)
&& !validrole(rolenum)) {
+#if 0 /*JP*/
if (donefirst)
Strcat(buf, " ");
+#endif
+/*JP
Strcat(buf, "character");
+*/
+ Strcat(buf, "\83L\83\83\83\89\83N\83^\81[");
+#if 0 /*JP*/
donefirst = TRUE;
+#endif
}
/* <your lawful female gnomish cavewoman> || <your lawful female gnome>
* || <your lawful female character>
char *buf;
int buflen, rolenum, racenum, gendnum, alignnum;
{
+/*JP
const char *defprompt = "Shall I pick a character for you? [ynaq] ";
+*/
+ const char *defprompt = "\93K\93\96\82É\83L\83\83\83\89\83N\83^\81[\82ð\91I\82ñ\82Å\82æ\82¢\82Å\82·\82©\81H[ynaq] ";
int num_post_attribs = 0;
+#if 0 /*JP*/
char tmpbuf[BUFSZ], *p;
+#else
+ char tmpbuf[BUFSZ];
+#endif
if (buflen < QBUFSZ)
return (char *) defprompt;
+#if 0 /*JP*/
Strcpy(tmpbuf, "Shall I pick ");
if (racenum != ROLE_NONE || validrole(rolenum))
Strcat(tmpbuf, "your ");
- else {
+ else
Strcat(tmpbuf, "a ");
- }
+#else
+ Strcpy(tmpbuf, "");
+#endif
/* <your> */
(void) root_plselection_prompt(eos(tmpbuf), buflen - strlen(tmpbuf),
rolenum, racenum, gendnum, alignnum);
+#if 0 /*JP*//*\93ú\96{\8cê\82Å\82Í\95s\97v*/
+ /* "Shall I pick a character's role, race, gender, and alignment for you?"
+ plus " [ynaq] (y)" is a little too long for a conventional 80 columns;
+ also, "pick a character's <anything>" sounds a bit stilted */
+ strsubst(tmpbuf, "pick a character", "pick character");
+#endif
+#if 0 /*JP*/
Sprintf(buf, "%s", s_suffix(tmpbuf));
+#else
+ Sprintf(buf, "%s\82Ì", tmpbuf);
+#endif
+#if 0 /*JP:\93ú\96{\8cê\82Å\82Í\95s\97v*/
/* don't bother splitting caveman/cavewoman or priest/priestess
in order to apply possessive suffix to both halves, but do
change "priest/priestess'" to "priest/priestess's" */
if ((p = strstri(buf, "priest/priestess'")) != 0
&& p[sizeof "priest/priestess'" - sizeof ""] == '\0')
strkitten(buf, 's');
+#endif
/* buf should now be:
* <your lawful female gnomish cavewoman's>
* Now append the post attributes to it
*/
num_post_attribs = post_attribs;
- if (post_attribs) {
+ if (!num_post_attribs) {
+ /* some constraints might have been mutually exclusive, in which case
+ some prompting that would have been omitted is needed after all */
+ if (flags.initrole == ROLE_NONE && !pa[BP_ROLE])
+ pa[BP_ROLE] = ++post_attribs;
+ if (flags.initrace == ROLE_NONE && !pa[BP_RACE])
+ pa[BP_RACE] = ++post_attribs;
+ if (flags.initalign == ROLE_NONE && !pa[BP_ALIGN])
+ pa[BP_ALIGN] = ++post_attribs;
+ if (flags.initgend == ROLE_NONE && !pa[BP_GEND])
+ pa[BP_GEND] = ++post_attribs;
+ num_post_attribs = post_attribs;
+ }
+ if (num_post_attribs) {
if (pa[BP_RACE]) {
(void) promptsep(eos(buf), num_post_attribs);
+/*JP
Strcat(buf, "race");
+*/
+ Strcat(buf, "\8eí\91°");
}
if (pa[BP_ROLE]) {
(void) promptsep(eos(buf), num_post_attribs);
+/*JP
Strcat(buf, "role");
+*/
+ Strcat(buf, "\90E\8bÆ");
}
if (pa[BP_GEND]) {
(void) promptsep(eos(buf), num_post_attribs);
+/*JP
Strcat(buf, "gender");
+*/
+ Strcat(buf, "\90«\95Ê");
}
if (pa[BP_ALIGN]) {
(void) promptsep(eos(buf), num_post_attribs);
+/*JP
Strcat(buf, "alignment");
+*/
+ Strcat(buf, "\91®\90«");
}
}
+/*JP
Strcat(buf, " for you? [ynaq] ");
+*/
+ Strcat(buf, "\82ð\93K\93\96\82É\91I\82ñ\82Å\82æ\82ë\82µ\82¢\82Å\82·\82©\81H[ynq] ");
return buf;
}
char *sptr, *eptr;
int i;
-#ifdef GENERIC_USERNAMES
- {
- /* some generic user names will be ignored in favor of prompting */
- const char *uptr = GENERIC_USERNAMES;
-
- i = (int) strlen(plname);
- if ((sptr = strstri(uptr, plname)) != 0
- && (sptr == uptr || sptr[-1] == ' ')
- && (sptr[i] == ' ' || sptr[i] == '\0'))
- *plname = '\0'; /* call askname() */
+ /* some generic user names will be ignored in favor of prompting */
+ if (sysopt.genericusers) {
+ if (*sysopt.genericusers == '*') {
+ *plname = '\0';
+ } else {
+ i = (int) strlen(plname);
+ if ((sptr = strstri(sysopt.genericusers, plname)) != 0
+ && (sptr == sysopt.genericusers || sptr[-1] == ' ')
+ && (sptr[i] == ' ' || sptr[i] == '\0'))
+ *plname = '\0'; /* call askname() */
+ }
}
-#endif
do {
if (!*plname)
- askname(); /* fill plname[] if necessary */
+ askname(); /* fill plname[] if necessary, or set defer_plname */
/* Look for tokens delimited by '-' */
if ((eptr = index(plname, '-')) != (char *) 0)
else if ((i = str2align(sptr)) != ROLE_NONE)
flags.initalign = i;
}
- } while (!*plname);
+ } while (!*plname && !iflags.defer_plname);
/* commas in the plname confuse the record file, convert to spaces */
for (sptr = plname; *sptr; sptr++) {
int which;
winid where;
{
+/*JP
static const char NEARDATA choosing[] = " choosing now",
+*/
+ static const char NEARDATA choosing[] = " \8c»\8dÝ\91I\91ð\92\86",
+/*JP
not_yet[] = " not yet specified",
+*/
+ not_yet[] = " \96¢\91I\91ð",
+/*JP
rand_choice[] = " random";
+*/
+ rand_choice[] = " \83\89\83\93\83_\83\80";
char buf[BUFSZ];
int r, c, g, a, allowmask;
/* [g and a don't constrain anything sufficiently
to narrow something done to a single choice] */
+/*JP
Sprintf(buf, "%12s ", "name:");
+*/
+ Sprintf(buf, "%12s ", "\96¼\91O:");
Strcat(buf, (which == RS_NAME) ? choosing : !*plname ? not_yet : plname);
putstr(where, 0, buf);
+/*JP
Sprintf(buf, "%12s ", "role:");
+*/
+ Sprintf(buf, "%12s ", "\90E\8bÆ:");
Strcat(buf, (which == RS_ROLE) ? choosing : (r == ROLE_NONE)
? not_yet
: (r == ROLE_RANDOM)
Sprintf(eos(buf), "/%s", roles[r].name.f);
}
putstr(where, 0, buf);
+/*JP
Sprintf(buf, "%12s ", "race:");
+*/
+ Sprintf(buf, "%12s ", "\8eí\91°:");
Strcat(buf, (which == RS_RACE) ? choosing : (c == ROLE_NONE)
? not_yet
: (c == ROLE_RANDOM)
? rand_choice
: races[c].noun);
putstr(where, 0, buf);
+/*JP
Sprintf(buf, "%12s ", "gender:");
+*/
+ Sprintf(buf, "%12s ", "\90«\95Ê:");
Strcat(buf, (which == RS_GENDER) ? choosing : (g == ROLE_NONE)
? not_yet
: (g == ROLE_RANDOM)
? rand_choice
: genders[g].adj);
putstr(where, 0, buf);
+/*JP
Sprintf(buf, "%12s ", "alignment:");
+*/
+ Sprintf(buf, "%12s ", "\91®\90«:");
+#if 0 /*JP:\93ú\96{\8cê\82Å\82Í\96¼\8e\8c\82ª\8e©\91R*/
Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
? not_yet
: (a == ROLE_RANDOM)
? rand_choice
: aligns[a].adj);
+#else
+ Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
+ ? not_yet
+ : (a == ROLE_RANDOM)
+ ? rand_choice
+ : aligns[a].noun);
+#endif
putstr(where, 0, buf);
}
/* add a "pick alignment first"-type entry to the specified menu */
void
-role_menu_extra(which, where)
+role_menu_extra(which, where, preselect)
int which;
winid where;
+boolean preselect;
{
static NEARDATA const char RS_menu_let[] = {
'=', /* name */
c = flags.initrace;
switch (which) {
case RS_NAME:
+/*JP
what = "name";
+*/
+ what = "\96¼\91O";
break;
case RS_ROLE:
+/*JP
what = "role";
+*/
+ what = "\90E\8bÆ";
f = r;
for (i = 0; i < SIZE(roles); ++i)
- if (i != f && !filter.roles[i])
+ if (i != f && !rfilter.roles[i])
break;
if (i == SIZE(roles)) {
+/*JP
constrainer = "filter";
+*/
+ constrainer = "\8di\82è\8d\9e\82Ý";
+/*JP
forcedvalue = "role";
+*/
+ forcedvalue = "\90E\8bÆ";
}
break;
case RS_RACE:
+/*JP
what = "race";
+*/
+ what = "\8eí\91°";
f = flags.initrace;
c = ROLE_NONE; /* override player's setting */
if (r >= 0) {
if (allowmask == MH_HUMAN)
c = 0; /* races[human] */
if (c >= 0) {
+/*JP
constrainer = "role";
+*/
+ constrainer = "\90E\8bÆ";
forcedvalue = races[c].noun;
} else if (f >= 0
- && (allowmask & ~filter.mask) == races[f].selfmask) {
+ && (allowmask & ~rfilter.mask) == races[f].selfmask) {
/* if there is only one race choice available due to user
options disallowing others, race menu entry is disabled */
+/*JP
constrainer = "filter";
+*/
+ constrainer = "\8di\82è\8d\9e\82Ý";
+/*JP
forcedvalue = "race";
+*/
+ forcedvalue = "\8eí\91°";
}
}
break;
case RS_GENDER:
+/*JP
what = "gender";
+*/
+ what = "\90«\95Ê";
f = flags.initgend;
g = ROLE_NONE;
if (r >= 0) {
else if (allowmask == ROLE_FEMALE)
g = 1; /* genders[female] */
if (g >= 0) {
+/*JP
constrainer = "role";
+*/
+ constrainer = "\90E\8bÆ";
forcedvalue = genders[g].adj;
} else if (f >= 0
- && (allowmask & ~filter.mask) == genders[f].allow) {
+ && (allowmask & ~rfilter.mask) == genders[f].allow) {
/* if there is only one gender choice available due to user
options disallowing other, gender menu entry is disabled */
+/*JP
constrainer = "filter";
+*/
+ constrainer = "\8di\82è\8d\9e\82Ý";
+/*JP
forcedvalue = "gender";
+*/
+ forcedvalue = "\90«\95Ê";
}
}
break;
case RS_ALGNMNT:
+/*JP
what = "alignment";
+*/
+ what = "\91®\90«";
f = flags.initalign;
a = ROLE_NONE;
if (r >= 0) {
else if (allowmask == AM_CHAOTIC)
a = 2; /* aligns[chaotic] */
if (a >= 0)
+/*JP
constrainer = "role";
+*/
+ constrainer = "\90E\8bÆ";
}
if (c >= 0 && !constrainer) {
allowmask = races[c].allow & ROLE_ALIGNMASK;
else if (allowmask == AM_CHAOTIC)
a = 2; /* aligns[chaotic] */
if (a >= 0)
+/*JP
constrainer = "race";
+*/
+ constrainer = "\8eí\91°";
}
if (f >= 0 && !constrainer
- && (ROLE_ALIGNMASK & ~filter.mask) == aligns[f].allow) {
+ && (ROLE_ALIGNMASK & ~rfilter.mask) == aligns[f].allow) {
/* if there is only one alignment choice available due to user
options disallowing others, algn menu entry is disabled */
+/*JP
constrainer = "filter";
+*/
+ constrainer = "\8di\82è\8d\9e\82Ý";
+/*JP
forcedvalue = "alignment";
+*/
+ forcedvalue = "\91®\90«";
}
if (a >= 0)
+#if 0 /*JP:\93ú\96{\8cê\82Å\82Í\96¼\8e\8c\82ª\8e©\91R*/
forcedvalue = aligns[a].adj;
+#else
+ forcedvalue = aligns[a].noun;
+#endif
break;
}
if (constrainer) {
any.a_int = 0;
/* use four spaces of padding to fake a grayed out menu choice */
+/*JP
Sprintf(buf, "%4s%s forces %s", "", constrainer, forcedvalue);
- add_menu(where, NO_GLYPH, &any, ' ', 0, ATR_NONE, buf,
+*/
+ Sprintf(buf, "%4s\82±\82Ì%s\82Å\82Í%s\82Ì\82Ý", "", constrainer, forcedvalue);
+ add_menu(where, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
MENU_UNSELECTED);
} else if (what) {
any.a_int = RS_menu_arg(which);
+/*JP
Sprintf(buf, "Pick%s %s first", (f >= 0) ? " another" : "", what);
+*/
+ Sprintf(buf, "%s%s\82ð\90æ\82É\91I\82Ô", (f >= 0) ? "\91¼\82Ì" : "", what);
add_menu(where, NO_GLYPH, &any, RS_menu_let[which], 0, ATR_NONE, buf,
MENU_UNSELECTED);
} else if (which == RS_filter) {
any.a_int = RS_menu_arg(RS_filter);
+#if 0 /*JP:T*/
add_menu(where, NO_GLYPH, &any, '~', 0, ATR_NONE,
"Reset role/race/&c filtering", MENU_UNSELECTED);
+#else
+ add_menu(where, NO_GLYPH, &any, '~', 0, ATR_NONE,
+ "\90E\8bÆ/\8eí\91°\82È\82Ç\82Ì\8di\82è\8d\9e\82Ý\82ð\89ð\8f\9c\82·\82é", MENU_UNSELECTED);
+#endif
} else if (which == ROLE_RANDOM) {
any.a_int = ROLE_RANDOM;
+#if 0 /*JP:T*/
add_menu(where, NO_GLYPH, &any, '*', 0, ATR_NONE, "Random",
+ preselect ? MENU_SELECTED : MENU_UNSELECTED);
+#else
+ add_menu(where, NO_GLYPH, &any, '*', 0, ATR_NONE, "\83\89\83\93\83_\83\80",
MENU_UNSELECTED);
+#endif
} else if (which == ROLE_NONE) {
any.a_int = ROLE_NONE;
+#if 0 /*JP:T*/
add_menu(where, NO_GLYPH, &any, 'q', 0, ATR_NONE, "Quit",
+ preselect ? MENU_SELECTED : MENU_UNSELECTED);
+#else
+ add_menu(where, NO_GLYPH, &any, 'q', 0, ATR_NONE, "\94²\82¯\82é",
MENU_UNSELECTED);
+#endif
} else {
impossible("role_menu_extra: bad arg (%d)", which);
}
if (flags.pantheon == -1) { /* new game */
flags.pantheon = flags.initrole; /* use own gods */
while (!roles[flags.pantheon].lgod) /* unless they're missing */
- flags.pantheon = randrole();
+ flags.pantheon = randrole(FALSE);
}
if (!urole.lgod) {
urole.lgod = roles[flags.pantheon].lgod;
urole.cgod = roles[flags.pantheon].cgod;
}
/* 0 or 1; no gods are neuter, nor is gender randomized */
+/*JP
quest_status.godgend = !strcmpi(align_gtitle(alignmnt), "goddess");
+*/
+ quest_status.godgend = !strcmpi(align_gtitle(alignmnt), "\8f\97\90_");
+#if 0
+/*
+ * Disable this fixup so that mons[] can be const. The only
+ * place where it actually matters for the hero is in set_uasmon()
+ * and that can use mons[race] rather than mons[role] for this
+ * particular property. Despite the comment, it is checked--where
+ * needed--via instrinsic 'Infravision' which set_uasmon() manages.
+ */
/* Fix up infravision */
if (mons[urace.malenum].mflags3 & M3_INFRAVISION) {
/* although an infravision intrinsic is possible, infravision
if (urole.femalenum != NON_PM)
mons[urole.femalenum].mflags3 |= M3_INFRAVISION;
}
+#endif /*0*/
/* Artifacts are fixed in hack_artifacts() */
Hello(mtmp)
struct monst *mtmp;
{
+#if 0 /*JP*/
switch (Role_switch) {
case PM_KNIGHT:
return "Salutations"; /* Olde English */
default:
return "Hello";
}
+#else
+/*
+ \82 \82¢\82³\82Â\82Í\93ú\96{\8cê\82Æ\82µ\82Ä\8e©\91R\82É\82È\82é\82æ\82¤\91å\82«\82\8ed\97l\82ð\95Ï\8dX
+*/
+ static char helo_buf[BUFSZ];
+
+ switch (Role_switch) {
+ case PM_KNIGHT:
+ Sprintf(helo_buf, "\82æ\82\82¼\8eQ\82Á\82½%s\82æ", plname);
+ break;
+ case PM_SAMURAI:
+ Sprintf(helo_buf, "\82æ\82\82¼\8eQ\82ç\82ê\82½%s\82æ", plname);
+ break;
+ case PM_TOURIST:
+ Sprintf(helo_buf, "\83A\83\8d\81[\83n%s", plname);
+ break;
+ case PM_VALKYRIE:
+ Sprintf(helo_buf, "\8d°\82Ì\8eç\8cì\8eÒ%s\82æ", plname);
+ break;
+ default:
+ Sprintf(helo_buf, "\82æ\82¤\82±\82»%s", plname);
+ break;
+ }
+
+ return helo_buf;
+#endif
}
const char *
Goodbye()
{
+#if 0 /*JP*/
switch (Role_switch) {
case PM_KNIGHT:
return "Fare thee well"; /* Olde English */
default:
return "Goodbye";
}
+#else
+ static char helo_buf[BUFSZ];
+
+ switch (Role_switch) {
+ case PM_KNIGHT:
+ Sprintf(helo_buf, "\82³\82ç\82Î\8chåi\82È\82é");
+ break;
+ case PM_SAMURAI:
+ Sprintf(helo_buf, "\82³\82ç\82Î\95\90\8em\93¹\82ð\8eu\82·");
+ break;
+ case PM_TOURIST:
+ Sprintf(helo_buf, "\83A\83\8d\81[\83n");
+ break;
+ case PM_VALKYRIE:
+ Sprintf(helo_buf, "\82³\82ç\82Î\8d°\82Ì\8eç\8cì\8eÒ");
+ break;
+ default:
+ Sprintf(helo_buf, "\82³\82æ\82¤\82È\82ç");
+ break;
+ }
+
+ return helo_buf;
+#endif
}
/* role.c */