diff -ruN nethack-3.4.3.orig/include/extern.h nethack-3.4.3/include/extern.h --- nethack-3.4.3.orig/include/extern.h Sun Dec 7 18:39:13 2003 +++ nethack-3.4.3/include/extern.h Sat Dec 11 23:58:24 2004 @@ -812,6 +812,7 @@ E void NDECL(free_invbuf); E void NDECL(reassign); E int NDECL(doorganize); +E int NDECL(dochangetitle); E int FDECL(count_unpaid, (struct obj *)); E int FDECL(count_buc, (struct obj *,int)); E void FDECL(carry_obj_effects, (struct obj *)); diff -ruN nethack-3.4.3.orig/include/you.h nethack-3.4.3/include/you.h --- nethack-3.4.3.orig/include/you.h Sun Dec 7 18:39:13 2003 +++ nethack-3.4.3/include/you.h Sat Dec 11 23:58:24 2004 @@ -303,7 +303,7 @@ Bitfield(uinvulnerable,1); /* you're invulnerable (praying) */ Bitfield(uburied,1); /* you're buried */ Bitfield(uedibility,1); /* blessed food detection; sense unsafe food */ - /* 1 free bit! */ + Bitfield(customtitle,1); /* currently have a custom title */ unsigned udg_cnt; /* how long you have been demigod */ struct u_event uevent; /* certain events have happened */ @@ -360,6 +360,7 @@ xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */ struct skills weapon_skills[P_NUM_SKILLS]; boolean twoweap; /* KMH -- Using two-weapon combat */ + char title[20]; }; /* end of `struct you' */ diff -ruN nethack-3.4.3.orig/src/botl.c nethack-3.4.3/src/botl.c --- nethack-3.4.3.orig/src/botl.c Sun Dec 7 18:39:13 2003 +++ nethack-3.4.3/src/botl.c Sat Dec 11 23:58:15 2004 @@ -71,6 +71,8 @@ register struct Role *role; register int i; + if (u.customtitle) + return (u.title); /* Find the role */ for (role = (struct Role *) roles; role->name.m; role++) diff -ruN nethack-3.4.3.orig/src/cmd.c nethack-3.4.3/src/cmd.c --- nethack-3.4.3.orig/src/cmd.c Sun Dec 7 18:39:13 2003 +++ nethack-3.4.3/src/cmd.c Sat Dec 11 23:58:15 2004 @@ -97,6 +97,7 @@ extern int NDECL(dowieldquiver); /**/ extern int NDECL(dozap); /**/ extern int NDECL(doorganize); /**/ +extern int NDECL(dochangetitle); /**/ #endif /* DUMB */ #ifdef OVL1 @@ -1381,6 +1382,7 @@ {'a', FALSE, doapply}, {'A', FALSE, doddoremarm}, {M('a'), TRUE, doorganize}, + {M('e'), TRUE, dochangetitle}, /* 'b', 'B' : go sw */ {'c', FALSE, doclose}, {'C', TRUE, do_mname}, @@ -1476,6 +1478,7 @@ struct ext_func_tab extcmdlist[] = { {"adjust", "adjust inventory letters", doorganize, TRUE}, + {"changetitle", "change your title", dochangetitle, TRUE}, {"chat", "talk to someone", dotalk, TRUE}, /* converse? */ {"conduct", "list which challenges you have adhered to", doconduct, TRUE}, {"dip", "dip an object into something", dodip, FALSE}, diff -ruN nethack-3.4.3.orig/src/do_name.c nethack-3.4.3/src/do_name.c --- nethack-3.4.3.orig/src/do_name.c Sun Dec 7 18:39:13 2003 +++ nethack-3.4.3/src/do_name.c Sat Dec 11 23:58:15 2004 @@ -324,6 +324,29 @@ obj = oname(obj, buf); } +int +dochangetitle() { + char buf[BUFSZ]; + + if (u.ulevel == MAXULEV) { + getlin("What do you want to be called?", buf); + + if (strchr(buf, '%') == NULL) { + /* Chop it down to size and terminate. */ + strncpy(u.title, buf, sizeof(u.title) - 1); + u.title[sizeof(u.title) - 1] = '\0'; + + You("will now be known as %s the %s.", plname, u.title); + u.customtitle = 1; + flags.botl = 1; + } + else /* '%' does not belong in a name. */ + pline_The("voice of %s rings in your ears: I do not approve of such a foolish name.", align_gname(u.ualign.type)); + } + else + You("are not worthy of this request."); +} + /* * Allocate a new and possibly larger storage space for an obj. */ diff -ruN nethack-3.4.3.orig/src/exper.c nethack-3.4.3/src/exper.c --- nethack-3.4.3.orig/src/exper.c Sun Dec 7 18:39:13 2003 +++ nethack-3.4.3/src/exper.c Sat Dec 11 23:58:15 2004 @@ -161,6 +161,11 @@ if (u.uexp > 0) u.uexp = newuexp(u.ulevel) - 1; + + if (u.customtitle) { + u.customtitle = 0; + u.title[0] = '\0'; + } flags.botl = 1; }