home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Games / NetHack 3.1.3 / source / src / do_name.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-01  |  17.6 KB  |  713 lines  |  [TEXT/R*ch]

  1. /*    SCCS Id: @(#)do_name.c    3.1    93/05/15    */
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #include "hack.h"
  6.  
  7. #ifdef OVLB
  8.  
  9. static void FDECL(do_oname, (struct obj *));
  10.  
  11. void
  12. getpos(cc,force,goal)
  13. coord    *cc;
  14. boolean force;
  15. const char *goal;
  16. {
  17.     register int cx, cy, i, c;
  18.     int sidx, tx, ty;
  19.     int lastc, lastx, lasty;
  20.     const char *sdp = flags.num_pad ? ndir : sdir;
  21.  
  22.     if(flags.verbose) pline("(For instructions type a ?)");
  23.     cx = cc->x;
  24.     cy = cc->y;
  25.     lastc = -1;
  26.     lastx = lasty = 0;
  27. #ifdef CLIPPING
  28.     cliparound(cx, cy);
  29. #endif
  30.     curs(WIN_MAP, cx,cy);
  31.     flush_screen(0);
  32. #ifdef MAC
  33.     lock_mouse_cursor(TRUE);
  34. #endif
  35.     while((c = nh_poskey(&tx, &ty, &sidx)) != '.') {
  36.         if(c == '\033') {
  37.             cc->x = -10;
  38.         clear_nhwindow(WIN_MESSAGE);
  39.             return;
  40.         }
  41.     if(c == 0) {
  42.         /* a mouse click event, just assign and return */
  43.         cx = tx;
  44.         cy = ty;
  45.         break;
  46.     }
  47.     for(i=0; i<8; i++)
  48.         if (sdp[i] == c) {
  49.         if (1 <= cx + xdir[i] && cx + xdir[i] < COLNO)
  50.             cx += xdir[i];
  51.         if (0 <= cy + ydir[i] && cy + ydir[i] < ROWNO)
  52.             cy += ydir[i];
  53.         goto nxtc;
  54.         } else if (sdp[i] == lowc((char)c)) {
  55.         cx += xdir[i]*8;
  56.         cy += ydir[i]*8;
  57.         if(cx < 1) cx = 1;
  58.         if(cx > COLNO-1) cx = COLNO-1;
  59.         if(cy < 0) cy = 0;
  60.         if(cy > ROWNO-1) cy = ROWNO-1;
  61.         goto nxtc;
  62.         }
  63.  
  64.     if(c == '?'){
  65.         char sbuf[80];
  66.         winid tmpwin = create_nhwindow(NHW_MENU);
  67.         Sprintf(sbuf, "Use [%s] to move the cursor to %s.",
  68.           flags.num_pad ? "2468" : "hjkl", goal);
  69.         putstr(tmpwin, 0, sbuf);
  70.         putstr(tmpwin, 0,
  71.            "Use [HJKL] to move the cursor 8 units at a time.");
  72.         putstr(tmpwin, 0, "Or enter a background symbol (ex. <).");
  73.         putstr(tmpwin, 0, "Type a . when you are at the right place.");
  74.         if(!force)
  75.         putstr(tmpwin, 0, "Type Space or Escape when you're done.");
  76.         putstr(tmpwin, 0, "");
  77.         display_nhwindow(tmpwin, TRUE);
  78.         destroy_nhwindow(tmpwin);
  79.     } else {
  80.         if (!index(quitchars, c)) {
  81.         for(sidx = 1; sidx < sizeof(showsyms); sidx++)
  82.             if(defsyms[sidx].sym == c) {
  83.             /* sidx = cmap_to_glyph(sidx); */
  84.             if(sidx != lastc) {
  85.                 lasty = 0;
  86.                 lastx = 1;
  87.             }
  88.             lastc = sidx;
  89.             loopback:
  90.             for (ty = lasty; ty < ROWNO; ty++) {
  91.                 for (tx = lastx; tx < COLNO; tx++) {
  92.                 if (glyph_is_cmap(levl[tx][ty].glyph) &&
  93.      defsyms[sidx].sym == defsyms[glyph_to_cmap(levl[tx][ty].glyph)].sym) {
  94.                     cx = tx;
  95.                     lastx = tx+1;
  96.                     cy = ty;
  97.                     lasty = ty;
  98.                     goto nxtc;
  99.                 }
  100.                 }
  101.                 lastx = 1;
  102.             }
  103.             if(lasty != 0) {
  104.                 lasty = 0;
  105.                 lastx = 1;
  106.                 goto loopback;
  107.             }
  108.             pline("Can't find dungeon feature '%c'", c);
  109.             goto nxtc;
  110.             }
  111.  
  112.         pline("Unknown direction: '%s' (%s).",
  113.               visctrl((char)c),
  114.               force ?
  115.               flags.num_pad ? "use 2468 or ." :
  116.               "use hjkl or ." :
  117.               "aborted");
  118.         }
  119.         if(force) goto nxtc;
  120.         pline("Done.");
  121.         cc->x = -1;
  122.         cc->y = 0;
  123.         return;
  124.     }
  125.     nxtc:    ;
  126. #ifdef CLIPPING
  127.     cliparound(cx, cy);
  128. #endif
  129.     curs(WIN_MAP,cx,cy);
  130.     flush_screen(0);
  131.     }
  132. #ifdef MAC
  133.     lock_mouse_cursor(FALSE);
  134. #endif
  135.     cc->x = cx;
  136.     cc->y = cy;
  137.     return;
  138. }
  139.  
  140. struct monst *
  141. christen_monst(mtmp, name)
  142. struct monst *mtmp;
  143. const char *name;
  144. {
  145.     register int lth,i;
  146.     register struct monst *mtmp2;
  147.  
  148.     /* dogname and catname are 63-character arrays; the generic naming
  149.      * function do_mname() below also cut names off at 63 characters */
  150.     lth = strlen(name)+1;
  151.     if(lth > 63){
  152.         lth = 63;
  153.     }
  154.     mtmp2 = newmonst(mtmp->mxlth + lth);
  155.     *mtmp2 = *mtmp;
  156.     for(i=0; i<mtmp->mxlth; i++)
  157.         ((char *) mtmp2->mextra)[i] = ((char *) mtmp->mextra)[i];
  158.     mtmp2->mnamelth = lth;
  159.     (void)strncpy(NAME(mtmp2), name, lth);
  160.     NAME(mtmp2)[lth-1] = 0;
  161.     replmon(mtmp,mtmp2);
  162.     return(mtmp2);
  163. }
  164.  
  165. int
  166. do_mname()
  167. {
  168.     char buf[BUFSZ];
  169.     coord cc;
  170.     register int cx,cy;
  171.     register struct monst *mtmp;
  172.     register char *curr;
  173.     boolean blank;
  174.     char qbuf[QBUFSZ];
  175.  
  176.     if (Hallucination) {
  177.         You("would never recognize it anyway.");
  178.         return 0;
  179.     }
  180.     cc.x = u.ux;
  181.     cc.y = u.uy;
  182.     getpos(&cc, FALSE, "the monster you want to name");
  183.     cx = cc.x;
  184.     cy = cc.y;
  185.     if(cx < 0) return(0);
  186.     if (cx == u.ux && cy == u.uy) {
  187.         pline("This %s creature is called %s and cannot be renamed.",
  188.         ACURR(A_CHA) > 14 ?
  189.         (flags.female ? "beautiful" : "handsome") :
  190.         "ugly",
  191.         plname);
  192.         return(0);
  193.     }
  194.     mtmp = m_at(cx, cy);
  195.     if (!mtmp || (!sensemon(mtmp) &&
  196.             (!cansee(cx,cy) || mtmp->mundetected
  197.             || mtmp->m_ap_type == M_AP_FURNITURE
  198.             || mtmp->m_ap_type == M_AP_OBJECT
  199.             || (mtmp->minvis && !See_invisible)))) {
  200.         pline("I see no monster there.");
  201.         return(0);
  202.     }
  203.     Sprintf(qbuf, "What do you want to call %s?", x_monnam(mtmp, 0,
  204.         (char *)0, 1));
  205.     getlin(qbuf,buf);
  206.     if(!*buf || *buf == '\033') return(0);
  207.  
  208.     /* unnames monster if all spaces */
  209.     for (curr = buf, blank = 1; *curr; blank = (*curr++ == ' '));
  210.     if(blank) *buf = '\0';
  211.  
  212.      if(type_is_pname(mtmp->data))
  213.          pline("%s doesn't like being called names!", Monnam(mtmp));
  214.     else (void) christen_monst(mtmp, buf);
  215.     return(0);
  216. }
  217.  
  218. /*
  219.  * This routine changes the address of obj. Be careful not to call it
  220.  * when there might be pointers around in unknown places. For now: only
  221.  * when obj is in the inventory.
  222.  */
  223. static
  224. void
  225. do_oname(obj)
  226. register struct obj *obj;
  227. {
  228.     char buf[BUFSZ], qbuf[QBUFSZ];
  229.     register char *curr;
  230.  
  231.     Sprintf(qbuf, "What do you want to name %s?", doname(obj));
  232.     getlin(qbuf, buf);
  233.     if(!*buf || *buf == '\033')    return;
  234.  
  235.     /* strip trailing spaces; unnames item if all spaces */
  236.     for (curr = eos(buf); curr > buf; )
  237.         if (*--curr == ' ') *curr = '\0'; else break;
  238.  
  239.     if(obj->oartifact)
  240.         pline("The artifact seems to resist the attempt.");
  241.     else if (restrict_name(obj, buf) || exist_artifact(obj->otyp, buf)) {
  242.         int n = rn2((int)strlen(buf));
  243.         register char c1, c2;
  244.  
  245.         c1 = lowc(buf[n]);
  246.         do c2 = 'a' + rn2('z'-'a'); while (c1 == c2);
  247.         buf[n] = (buf[n] == c1) ? c2 : highc(c2);  /* keep same case */
  248.         pline("While engraving your %s slips.", body_part(HAND));
  249.         display_nhwindow(WIN_MESSAGE, FALSE);
  250.         You("engrave: \"%s\".",buf);
  251.         (void)oname(obj, buf, 1);
  252.     }
  253.     else
  254.         (void)oname(obj, buf, 1);
  255. }
  256.  
  257. struct obj *
  258. oname(obj, buf, ininv)
  259. register struct obj *obj;
  260. const char    *buf;
  261. register int ininv;
  262. {
  263.     register struct obj *otmp, *otmp2;
  264.     register int    lth;
  265.  
  266.     lth = *buf ? strlen(buf)+1 : 0;
  267.     if(lth > 63){
  268.         lth = 63;
  269.     }
  270.     /* if already properly named */
  271.     if(lth == obj->onamelth && (!lth || !strcmp(ONAME(obj),buf)))
  272.         return obj;
  273.  
  274.     /* If named artifact exists in the game, do not create another.
  275.      * Also trying to create an artifact shouldn't de-artifact
  276.      * it (e.g. Excalibur from prayer). In this case the object
  277.      * will retain its current name. */
  278.     if (obj->oartifact || exist_artifact(obj->otyp, buf))
  279.         return obj;
  280.  
  281.     otmp2 = newobj(lth);
  282.     *otmp2 = *obj;    /* the cobj pointer is copied to otmp2 */
  283.     otmp2->onamelth = lth;
  284.     artifact_exists(otmp2, buf, TRUE);
  285.  
  286. #ifdef __GNUC__
  287.     /* Avoid an old compiler bug (always gave empty name otherwise). */
  288.     if (buf) (void)donull();
  289. #endif
  290.     if(lth) {
  291.         (void)strncpy(ONAME(otmp2), buf, lth);
  292.         ONAME(otmp2)[lth-1] = 0;
  293.     }
  294.     if (obj->owornmask) {
  295.         /* Note: dying by burning in Hell causes problems if you
  296.          * try doing this when owornmask isn't set.
  297.          */
  298.         setworn((struct obj *)0, obj->owornmask);
  299.         setworn(otmp2, otmp2->owornmask);
  300.     }
  301.  
  302.     if (ininv) {
  303.         /* do freeinv(obj); etc. by hand in order to preserve
  304.            the position of this object in the inventory */
  305.         if(obj == invent) invent = otmp2;
  306.         else for(otmp = invent; ; otmp = otmp->nobj){
  307.             if(!otmp)
  308.                 panic("oname: cannot find obj.");
  309.             if(otmp->nobj == obj){
  310.                 otmp->nobj = otmp2;
  311.                 break;
  312.             }
  313.         }
  314.     }
  315.     /* obfree(obj, otmp2);    /* now unnecessary: no pointers on bill */
  316.     dealloc_obj(obj);    /* let us hope nobody else saved a pointer */
  317.     return otmp2;
  318. }
  319.  
  320. static NEARDATA const char callable[] = {
  321.     SCROLL_CLASS, POTION_CLASS, WAND_CLASS, RING_CLASS, AMULET_CLASS,
  322.     GEM_CLASS, SPBOOK_CLASS, ARMOR_CLASS, TOOL_CLASS, 0 };
  323.  
  324. int
  325. ddocall()
  326. {
  327.     register struct obj *obj;
  328. #ifdef REDO
  329.     char    ch;
  330. #endif
  331.     char allow_all[2];
  332.  
  333.     switch(
  334. #ifdef REDO
  335.         ch = 
  336. #endif
  337.         ynq("Name an individual object?")) {
  338.     case 'q':
  339.         break;
  340.     case 'y':
  341. #ifdef REDO
  342.         savech(ch);
  343. #endif
  344.         allow_all[0] = ALL_CLASSES; allow_all[1] = '\0';
  345.         obj = getobj(allow_all, "name");
  346.         if(obj) do_oname(obj);
  347.         break;
  348.     default :
  349. #ifdef REDO
  350.         savech(ch);
  351. #endif
  352.         obj = getobj(callable, "call");
  353.         if (obj) {
  354.             if (!obj->dknown) {
  355.                 You("would never recognize another one.");
  356.                 return 0;
  357.             }
  358.             docall(obj);
  359.         }
  360.         break;
  361.     }
  362.     return 0;
  363. }
  364.  
  365. void
  366. docall(obj)
  367. register struct obj *obj;
  368. {
  369.     char buf[BUFSZ], qbuf[QBUFSZ];
  370.     struct obj otemp;
  371.     register char **str1;
  372.     register char *str;
  373.     boolean blank;
  374.  
  375.     if (!obj->dknown) return; /* probably blind */
  376.     otemp = *obj;
  377.     otemp.quan = 1L;
  378.     otemp.onamelth = 0;
  379.     if (objects[otemp.otyp].oc_class == POTION_CLASS && otemp.corpsenm) {
  380.         /* kludge, meaning it's sink water */
  381.         Sprintf(qbuf,"Call a stream of %s fluid:",
  382.                 OBJ_DESCR(objects[otemp.otyp]));
  383.     } else
  384.         Sprintf(qbuf, "Call %s:", an(xname(&otemp)));
  385.     getlin(qbuf, buf);
  386.     if(!*buf || *buf == '\033')
  387.         return;
  388.  
  389.     /* clear old name */
  390.     str1 = &(objects[obj->otyp].oc_uname);
  391.     if(*str1) free((genericptr_t)*str1);
  392.  
  393.     /* uncalls item if all spaces */
  394.     for (str = buf, blank = 1; *str; blank = (*str++ == ' '));
  395.     if(blank) *buf = '\0';
  396.     if (!*buf) {
  397.         if (*str1)    /* had name, so possibly remove from disco[] */
  398.             undiscover_object(obj->otyp),  *str1 = NULL;
  399.     } else {
  400.         *str1 = strcpy((char *) alloc((unsigned)strlen(buf)+1), buf);
  401.         discover_object(obj->otyp, FALSE); /* possibly add to disco[] */
  402.     }
  403. }
  404.  
  405. #endif /*OVLB*/
  406. #ifdef OVL0
  407.  
  408. static const char *ghostnames[] = {
  409.     /* these names should have length < PL_NSIZ */
  410.     /* Capitalize the names for aesthetics -dgk */
  411.     "Adri", "Andries", "Andreas", "Bert", "David", "Dirk", "Emile",
  412.     "Frans", "Fred", "Greg", "Hether", "Jay", "John", "Jon", "Karnov",
  413.     "Kay", "Kenny", "Kevin", "Maud", "Michiel", "Mike", "Peter", "Robert",
  414.     "Ron", "Tom", "Wilmar", "Nick Danger", "Phoenix", "Jiro", "Mizue",
  415.     "Stephan", "Lance Braccus", "Shadowhawk"
  416. };
  417.  
  418. /* Monster naming functions:
  419.  * x_monnam is the generic monster-naming function.
  420.  * mon_nam: the rust monster  it  the invisible orc  Fido
  421.  * l_monnam:  rust monster    it  invisible orc      dog called fido
  422.  * Monnam:    The rust monster    It  The invisible orc  Fido
  423.  * Adjmonnam: The poor rust monster  It   The poor invisible orc  The poor Fido
  424.  * Amonnam:   A rust monster      It  An invisible orc   Fido
  425.  * a_monnam:  a rust monster      it  an invisible orc   Fido
  426.  */
  427.  
  428. char *
  429. x_monnam(mtmp, article, adjective, called)
  430. register struct monst *mtmp;
  431. /* Articles:
  432.  * 0: "the" in front of everything except names and "it"
  433.  * 1: "the" in front of everything except "it"; looks bad for names unless you
  434.  *    are also using an adjective.
  435.  * 2: "a" in front of everything except "it".
  436.  * 3: no article at all.
  437.  */
  438. int article, called;
  439. const char *adjective;
  440. {
  441. #ifdef LINT    /* static char buf[BUFSZ]; */
  442.     char buf[BUFSZ];
  443. #else
  444.     static char buf[BUFSZ];
  445. #endif
  446.     char *name = (mtmp->mnamelth && !Hallucination && !mtmp->isshk) ?
  447.                               NAME(mtmp) : 0;
  448.     int force_the = (!Hallucination && mtmp->data ==
  449.         &mons[PM_WIZARD_OF_YENDOR]);
  450.  
  451.     buf[0] = '\0';
  452.     if(mtmp->ispriest || mtmp->isminion) {
  453.         name = priestname(mtmp);
  454.         if (article == 3 && !strncmp(name, "the ", 4)) name += 4;
  455.         return name;
  456.     }
  457.     if(!canseemon(mtmp) && !sensemon(mtmp) &&
  458.                 !(u.uswallow && mtmp == u.ustuck) && !killer) {
  459.         if(!mtmp->wormno || (mtmp != m_at(bhitpos.x, bhitpos.y)) ||
  460.            !(cansee(bhitpos.x, bhitpos.y) && mon_visible(mtmp))) {
  461.         Strcpy(buf, "it");
  462.         return (buf);
  463.         }
  464.     }
  465.     if (mtmp->isshk) {
  466.         Strcpy(buf, shkname(mtmp));
  467.         if (mtmp->data == &mons[PM_SHOPKEEPER] && !mtmp->minvis)
  468.             return(buf);
  469.         /* For normal shopkeepers, just 'Asidonhopo'.
  470.          * For unusual ones, 'Asidonhopo the invisible shopkeeper'
  471.          * or 'Asidonhopo the blue dragon'.
  472.          */
  473.         Strcat(buf, " ");
  474.     }
  475.     if (force_the ||
  476.            ((article == 1 || ((!name || called) && article == 0)) &&
  477.            (Hallucination || !type_is_pname(mtmp->data))))
  478.         Strcat(buf, "the ");
  479.     if (adjective) {
  480.         Strcat(buf, adjective);
  481.         Strcat(buf, " ");
  482.     }
  483.     if (mtmp->minvis && !Blind)
  484.         Strcat(buf, "invisible ");
  485.     if (name && !called) {
  486.         Strcat(buf, name);
  487.         goto bot_nam;
  488.     }
  489.     if (mtmp->data == &mons[PM_GHOST] && !Hallucination) {
  490.         register const char *gn = (const char *) mtmp->mextra;
  491.         if(!*gn) {        /* might also look in scorefile */
  492.             gn = ghostnames[rn2(SIZE(ghostnames))];
  493.             Strcpy((char *) mtmp->mextra, !rn2(5) ? 
  494.                                (const char *)plname : gn);
  495.         }
  496.         Sprintf(buf, "%s ghost", s_suffix((char *) mtmp->mextra));
  497.     } else {
  498.             if(Hallucination)
  499.             Strcat(buf, rndmonnam());
  500.         else {
  501.             if(is_mplayer(mtmp->data) && !In_endgame(&u.uz)) { 
  502.                 char pbuf[BUFSZ];
  503.                     Strcpy(pbuf, rank_of((unsigned)mtmp->m_lev,
  504.                                       highc(mtmp->data->mname[0]), 
  505.                                   (boolean)mtmp->female));
  506.             Strcat(buf, lcase(pbuf));
  507.             } else
  508.                 Strcat(buf, mtmp->data->mname);
  509.         }
  510.     }
  511.     if(name) {
  512.         Strcat(buf, " called ");
  513.         Strcat(buf, NAME(mtmp));
  514.     }
  515. bot_nam:
  516.     if (article == 2 && !force_the && (!name || called) &&
  517.         (Hallucination || !type_is_pname(mtmp->data)))
  518.         return an(buf);
  519.     else
  520.         return(buf);
  521. }
  522.  
  523. #endif /* OVL0 */
  524. #ifdef OVLB
  525.  
  526. char *
  527. l_monnam(mtmp)
  528. register struct monst *mtmp;
  529. {
  530.     return(x_monnam(mtmp, 3, (char *)0, 1));
  531. }
  532.  
  533. #endif /* OVLB */
  534. #ifdef OVL0
  535.  
  536. char *
  537. mon_nam(mtmp)
  538. register struct monst *mtmp;
  539. {
  540.     return(x_monnam(mtmp, 0, (char *)0, 0));
  541. }
  542.  
  543. char *
  544. Monnam(mtmp)
  545. register struct monst *mtmp;
  546. {
  547.     register char *bp = mon_nam(mtmp);
  548.  
  549.     *bp = highc(*bp);
  550.     return(bp);
  551. }
  552.  
  553. #endif /* OVL0 */
  554. #ifdef OVLB
  555.  
  556. char *
  557. Adjmonnam(mtmp, adj)
  558. register struct monst *mtmp;
  559. register const char *adj;
  560. {
  561.     register char *bp = x_monnam(mtmp,1,adj,0);
  562.  
  563.     *bp = highc(*bp);
  564.     return(bp);
  565. }
  566.  
  567. char *
  568. a_monnam(mtmp)
  569. register struct monst *mtmp;
  570. {
  571.     return x_monnam(mtmp, 2, (char *)0, 0);
  572. }
  573.  
  574. char *
  575. Amonnam(mtmp)
  576. register struct monst *mtmp;
  577. {
  578.     register char *bp = a_monnam(mtmp);
  579.  
  580.     *bp = highc(*bp);
  581.     return(bp);
  582. }
  583.  
  584. static const char *bogusmons[] = {
  585.     "jumbo shrimp", "giant pigmy", "gnu", "killer penguin", 
  586.     "giant cockroach", "giant slug", "maggot", "pterodactyl",
  587.     "tyrannosaurus rex", "basilisk", "beholder", "nightmare",
  588.     "efreeti", "marid", "rot grub", "bookworm", "doppelganger",
  589.     "shadow", "hologram", "jester", "attorney", "sleazoid",
  590.     "killer tomato", "amazon", "robot", "battlemech",
  591.     "rhinovirus", "harpy", "lion-dog", "rat-ant",
  592.                         /* misc. */
  593.     "grue", "Christmas-tree monster", "luck sucker", "paskald",
  594.     "brogmoid", "dornbeast",        /* Quendor (Zork, &c.) */
  595.     "Ancient Multi-Hued Dragon", "Evil Iggy",
  596.                         /* Moria */
  597.     "emu", "kestrel", "xeroc", "venus flytrap",
  598.                         /* Rogue */
  599.     "creeping coins",            /* Wizardry */
  600.     "hydra", "siren",            /* Greek legend */
  601.     "killer bunny",                /* Monty Python */
  602.     "rodent of unusual size",        /* The Princess Bride */
  603.     "Smokey the bear",    /* "Only you can prevent forest fires!" */
  604.     "Luggage",                /* Discworld */
  605.     "Ent",                     /* Lord of the Rings */
  606.     "tangle tree", "nickelpede", "wiggle",    /* Xanth */
  607.     "white rabbit", "snark",        /* Lewis Carroll */
  608.     "pushmi-pullyu",            /* Dr. Doolittle */
  609.     "smurf",                /* The Smurfs */
  610.     "tribble", "Klingon", "Borg",        /* Star Trek */
  611.     "Ewok",                 /* Star Wars */
  612.     "Totoro",                /* Tonari no Totoro */
  613.     "ohmu",                 /* Nausicaa */
  614.     "Godzilla", "King Kong",        /* monster movies */
  615.     "earthquake beast",            /* old L of SH */
  616.     "Invid",                /* Robotech */
  617.     "Terminator",                /* The Terminator */
  618.     "boomer",                /* Bubblegum Crisis */
  619.     "Dalek",                /* Dr. Who ("Exterminate!") */
  620.     "microscopic space fleet", "Ravenous Bugblatter Beast of Traal",
  621.                         /* HGttG */
  622.     "teenage mutant ninja turtle",        /* TMNT */
  623.     "samurai rabbit",            /* Usagi Yojimbo */
  624.     "aardvark",                /* Cerebus */
  625.     "Audrey II",                /* Little Shop of Horrors */
  626.     "witch doctor", "one-eyed one-horned flying purple people eater",
  627.                         /* 50's rock 'n' roll */
  628.     "Barney the dinosaur"            /* saccharine kiddy TV */
  629. };
  630.  
  631. const char *
  632. rndmonnam() {  /* Random name of monster type, if hallucinating */
  633.     int name;
  634.  
  635.     do {
  636.         name = rn2(PM_ARCHEOLOGIST + SIZE(bogusmons));
  637.         /* archeologist: 1 past last valid monster */
  638.     } while(name < PM_ARCHEOLOGIST &&
  639.         (type_is_pname(&mons[name]) || (mons[name].geno & G_NOGEN)));
  640.     if (name >= PM_ARCHEOLOGIST) return bogusmons[name-PM_ARCHEOLOGIST];
  641.     return(mons[name].mname);
  642. }
  643.  
  644. #ifdef OVL2
  645.  
  646. static NEARDATA const char *hcolors[] = {
  647.     "ultraviolet", "infrared", "bluish-orange",
  648.     "reddish-green", "dark white", "light black", "sky blue-pink",
  649.     "salty", "sweet", "sour", "bitter",
  650.     "striped", "spiral", "swirly", "plaid", "checkered", "argyle",
  651.     "paisley", "blotchy", "guernsey-spotted", "polka-dotted",
  652.     "square", "round", "triangular",
  653.     "cabernet", "sangria", "fuchsia", "wisteria",
  654.     "lemon-lime", "strawberry-banana", "peppermint",
  655.     "romantic", "incandescent"
  656. };
  657.  
  658. const char *
  659. hcolor()
  660. {
  661.     return hcolors[rn2(SIZE(hcolors))];
  662. }
  663. #endif /* OVL2 */
  664.  
  665. const char *pronoun_pairs[][2] = {
  666.     {"him", "her"}, {"Him", "Her"}, {"his", "her"}, {"His", "Her"},
  667.     {"he", "she"}, {"He", "She"},
  668.     {0, 0}
  669. };
  670.  
  671. char *
  672. self_pronoun(str, pronoun)
  673. const char *str;
  674. const char *pronoun;
  675. {
  676.     static NEARDATA char buf[BUFSZ];
  677.     register int i;
  678.  
  679.     for(i=0; pronoun_pairs[i][0]; i++) {
  680.         if(!strncmp(pronoun, pronoun_pairs[i][0], 3)) {
  681.             Sprintf(buf, str, pronoun_pairs[i][flags.female]);
  682.             return buf;
  683.         }
  684.     }
  685.     impossible("never heard of pronoun %s?", pronoun);
  686.     Sprintf(buf, str, pronoun_pairs[i][0]);
  687.     return buf;
  688. }
  689.  
  690. #ifdef REINCARNATION
  691. const char *
  692. roguename() /* Name of a Rogue player */
  693. {
  694.     char *i, *opts;
  695.  
  696.     if ((opts = getenv("ROGUEOPTS")) != 0) {
  697.         for (i = opts; *i; i++)
  698.             if (!strncmp("name=",i,5)) {
  699.                 char *j;
  700.                 if ((j = index(i+5,',')) != 0)
  701.                     *j = (char)0;
  702.                 return i+5;
  703.             }
  704.     }
  705.     return rn2(3) ? (rn2(2) ? "Michael Toy" : "Kenneth Arnold")
  706.         : "Glenn Wichman";
  707. }
  708. #endif
  709.  
  710. #endif /* OVLB */
  711.  
  712. /*do_name.c*/
  713.