Source:NetHack 3.1.0/do name.c

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to do_name.c from the source code of NetHack 3.1.0.

Warning! This is the source code from an old release. For newer releases, see Source code

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

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