Source:NetHack 3.3.0/sounds.c

From NetHackWiki
Revision as of 06:21, 19 November 2008 by Erik Warmelink (talk | contribs) (link to sounds.c (a file might be split or renamed, but sounds.c is pretty stable): teach searchengines about the newer version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to sounds.c from the source code of NetHack 3.3.0. To link to a particular line, write [[NetHack 3.3.0/sounds.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code, probably sounds.c

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: @(#)sounds.c	3.3	97/05/25	*/
2.    /*	Copyright (c) 1989 Janet Walz, Mike Threepoint */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #include "hack.h"
6.    #include "edog.h"
7.    
8.    #ifdef OVLB
9.    
10.   static int FDECL(domonnoise,(struct monst *));
11.   static int NDECL(dochat);
12.   
13.   #endif /* OVLB */
14.   
15.   #ifdef OVL0
16.   
17.   static int FDECL(mon_in_room, (struct monst *,int));
18.   
19.   /* this easily could be a macro, but it might overtax dumb compilers */
20.   static int
21.   mon_in_room(mon, rmtyp)
22.   struct monst *mon;
23.   int rmtyp;
24.   {
25.       int rno = levl[mon->mx][mon->my].roomno;
26.   
27.       return rooms[rno - ROOMOFFSET].rtype == rmtyp;
28.   }
29.   
30.   void
31.   dosounds()
32.   {
33.       register struct mkroom *sroom;
34.       register int hallu, vx, vy;
35.   #if defined(AMIGA) && defined(AZTEC_C_WORKAROUND)
36.       int xx;
37.   #endif
38.       struct monst *mtmp;
39.   
40.       if (!flags.soundok || u.uswallow || Underwater) return;
41.   
42.       hallu = Hallucination ? 1 : 0;
43.   
44.       if (level.flags.nfountains && !rn2(400)) {
45.   	static const char *fountain_msg[4] = {
46.   		"bubbling water.",
47.   		"water falling on coins.",
48.   		"the splashing of a naiad.",
49.   		"a soda fountain!",
50.   	};
51.   	You_hear(fountain_msg[rn2(3)+hallu]);
52.       }
53.   #ifdef SINK
54.       if (level.flags.nsinks && !rn2(300)) {
55.   	static const char *sink_msg[3] = {
56.   		"a slow drip.",
57.   		"a gurgling noise.",
58.   		"dishes being washed!",
59.   	};
60.   	You_hear(sink_msg[rn2(2)+hallu]);
61.       }
62.   #endif
63.       if (level.flags.has_court && !rn2(200)) {
64.   	static const char *throne_msg[4] = {
65.   		"the tones of courtly conversation.",
66.   		"a sceptre pounded in judgment.",
67.   		"Someone shouts \"Off with %s head!\"",
68.   		"Queen Beruthiel's cats!",
69.   	};
70.   	for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
71.   	    if ((mtmp->msleeping ||
72.   			is_lord(mtmp->data) || is_prince(mtmp->data)) &&
73.   		!is_animal(mtmp->data) &&
74.   		mon_in_room(mtmp, COURT)) {
75.   		/* finding one is enough, at least for now */
76.   		int which = rn2(3)+hallu;
77.   
78.   		if (which != 2) You_hear(throne_msg[which]);
79.   		else		pline(throne_msg[2], his[flags.female]);
80.   		return;
81.   	    }
82.       }
83.       if (level.flags.has_swamp && !rn2(200)) {
84.   	static const char *swamp_msg[3] = {
85.   		"hear mosquitoes!",
86.   		"smell marsh gas!",	/* so it's a smell...*/
87.   		"hear Donald Duck!",
88.   	};
89.   	You(swamp_msg[rn2(2)+hallu]);
90.   	return;
91.       }
92.       if (level.flags.has_vault && !rn2(200)) {
93.   	if (!(sroom = search_special(VAULT))) {
94.   	    /* strange ... */
95.   	    level.flags.has_vault = 0;
96.   	    return;
97.   	}
98.   	if(gd_sound())
99.   	    switch (rn2(2)+hallu) {
100.  		case 1: {
101.  		    boolean gold_in_vault = FALSE;
102.  
103.  		    for (vx = sroom->lx;vx <= sroom->hx; vx++)
104.  			for (vy = sroom->ly; vy <= sroom->hy; vy++)
105.  			    if (g_at(vx, vy))
106.  				gold_in_vault = TRUE;
107.  #if defined(AMIGA) && defined(AZTEC_C_WORKAROUND)
108.  		    /* Bug in aztec assembler here. Workaround below */
109.  		    xx = ROOM_INDEX(sroom) + ROOMOFFSET;
110.  		    xx = (xx != vault_occupied(u.urooms));
111.  		    if(xx)
112.  #else
113.  		    if (vault_occupied(u.urooms) !=
114.  			 (ROOM_INDEX(sroom) + ROOMOFFSET))
115.  #endif /* AZTEC_C_WORKAROUND */
116.  		    {
117.  			if (gold_in_vault)
118.  			    You_hear(!hallu ? "someone counting money." :
119.  				"the quarterback calling the play.");
120.  			else
121.  			    You_hear("someone searching.");
122.  			break;
123.  		    }
124.  		    /* fall into... (yes, even for hallucination) */
125.  		}
126.  		case 0:
127.  		    You_hear("the footsteps of a guard on patrol.");
128.  		    break;
129.  		case 2:
130.  		    You_hear("Ebenezer Scrooge!");
131.  		    break;
132.  	    }
133.  	return;
134.      }
135.      if (level.flags.has_beehive && !rn2(200)) {
136.  	for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
137.  	    if ((mtmp->data->mlet == S_ANT && is_flyer(mtmp->data)) &&
138.  		mon_in_room(mtmp, BEEHIVE)) {
139.  		switch (rn2(2)+hallu) {
140.  		    case 0:
141.  			You_hear("a low buzzing.");
142.  			break;
143.  		    case 1:
144.  			You_hear("an angry drone.");
145.  			break;
146.  		    case 2:
147.  			You_hear("bees in your %sbonnet!",
148.  			    uarmh ? "" : "(nonexistent) ");
149.  			break;
150.  		}
151.  		return;
152.  	    }
153.      }
154.      if (level.flags.has_morgue && !rn2(200)) {
155.  	for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
156.  	    if (is_undead(mtmp->data) &&
157.  		mon_in_room(mtmp, MORGUE)) {
158.  		switch (rn2(2)+hallu) {
159.  		    case 0:
160.  			You("suddenly realize it is unnaturally quiet.");
161.  			break;
162.  		    case 1:
163.  			pline_The("%s on the back of your %s stands up.",
164.  				body_part(HAIR), body_part(NECK));
165.  			break;
166.  		    case 2:
167.  			pline_The("%s on your %s seems to stand up.",
168.  				body_part(HAIR), body_part(HEAD));
169.  			break;
170.  		}
171.  		return;
172.  	    }
173.      }
174.      if (level.flags.has_barracks && !rn2(200)) {
175.  	static const char *barracks_msg[4] = {
176.  		"blades being honed.",
177.  		"loud snoring.",
178.  		"dice being thrown.",
179.  		"General MacArthur!",
180.  	};
181.  	int count = 0;
182.  
183.  	for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
184.  	    if (is_mercenary(mtmp->data) &&
185.  #if 0		/* don't bother excluding these */
186.  		!strstri(mtmp->data->mname, "watch") &&
187.  		!strstri(mtmp->data->mname, "guard") &&
188.  #endif
189.  		mon_in_room(mtmp, BARRACKS) &&
190.  		/* sleeping implies not-yet-disturbed (usually) */
191.  		(mtmp->msleeping || ++count > 5)) {
192.  		You_hear(barracks_msg[rn2(3)+hallu]);
193.  		return;
194.  	    }
195.      }
196.      if (level.flags.has_zoo && !rn2(200)) {
197.  	static const char *zoo_msg[3] = {
198.  		"a sound reminiscent of an elephant stepping on a peanut.",
199.  		"a sound reminiscent of a seal barking.",
200.  		"Doctor Doolittle!",
201.  	};
202.  	for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
203.  	    if ((mtmp->msleeping || is_animal(mtmp->data)) &&
204.  		    mon_in_room(mtmp, ZOO)) {
205.  		You_hear(zoo_msg[rn2(2)+hallu]);
206.  		return;
207.  	    }
208.      }
209.      if (level.flags.has_shop && !rn2(200)) {
210.  	if (!(sroom = search_special(ANY_SHOP))) {
211.  	    /* strange... */
212.  	    level.flags.has_shop = 0;
213.  	    return;
214.  	}
215.  	if (tended_shop(sroom) &&
216.  		!index(u.ushops, ROOM_INDEX(sroom) + ROOMOFFSET)) {
217.  	    static const char *shop_msg[3] = {
218.  		    "someone cursing shoplifters.",
219.  		    "the chime of a cash register.",
220.  		    "Neiman and Marcus arguing!",
221.  	    };
222.  	    You_hear(shop_msg[rn2(2)+hallu]);
223.  	}
224.  	return;
225.      }
226.      if (Is_oracle_level(&u.uz) && !rn2(400)) {
227.  	/* make sure the Oracle is still here */
228.  	for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
229.  	    if (mtmp->data == &mons[PM_ORACLE])
230.  		break;
231.  	/* and don't produce silly effects when she's clearly visible */
232.  	if (mtmp && (hallu || !canseemon(mtmp))) {
233.  	    static const char *ora_msg[5] = {
234.  		    "a strange wind.",		/* Jupiter at Dodona */
235.  		    "convulsive ravings.",	/* Apollo at Delphi */
236.  		    "snoring snakes.",		/* AEsculapius at Epidaurus */
237.  		    "someone say \"No more woodchucks!\"",
238.  		    "a loud ZOT!"		/* both rec.humor.oracle */
239.  	    };
240.  	    You_hear(ora_msg[rn2(3)+hallu*2]);
241.  	}
242.  	return;
243.      }
244.  }
245.  
246.  #endif /* OVL0 */
247.  #ifdef OVLB
248.  
249.  static const char *h_sounds[] = {
250.      "beep", "boing", "sing", "belche", "creak", "cough", "rattle",
251.      "ululate", "pop", "jingle", "sniffle", "tinkle", "eep"
252.  };
253.  
254.  const char *
255.  growl_sound(mtmp)
256.  register struct monst *mtmp;
257.  {
258.  	const char *ret;
259.  
260.  	switch (mtmp->data->msound) {
261.  	case MS_MEW:
262.  	case MS_HISS:
263.  	    ret = "hiss";
264.  	    break;
265.  	case MS_BARK:
266.  	case MS_GROWL:
267.  	    ret = "growl";
268.  	    break;
269.  	case MS_ROAR:
270.  	    ret = "roar";
271.  	    break;
272.  	case MS_BUZZ:
273.  	    ret = "buzz";
274.  	    break;
275.  	case MS_SQEEK:
276.  	    ret = "squeal";
277.  	    break;
278.  	case MS_SQAWK:
279.  	    ret = "screech";
280.  	    break;
281.  	case MS_NEIGH:
282.  	    ret = "neigh";
283.  	    break;
284.  	case MS_WAIL:
285.  	    ret = "wail";
286.  	    break;
287.  	case MS_SILENT:
288.  		ret = "commotion";
289.  		break;
290.  	default:
291.  		ret = "scream";
292.  	}
293.  	return ret;
294.  }
295.  
296.  /* the sounds of a seriously abused pet, including player attacking it */
297.  void
298.  growl(mtmp)
299.  register struct monst *mtmp;
300.  {
301.      register const char *growl_verb = 0;
302.  
303.      if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
304.  	return;
305.  
306.      /* presumably nearness and soundok checks have already been made */
307.      if (Hallucination)
308.  	growl_verb = h_sounds[rn2(SIZE(h_sounds))];
309.      else
310.  	growl_verb = growl_sound(mtmp);
311.      if (growl_verb) {
312.  	pline("%s %s!", Monnam(mtmp), makeplural(growl_verb));
313.  	if(flags.run) nomul(0);
314.  	wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 18);
315.      }
316.  }
317.  
318.  /* the sounds of mistreated pets */
319.  void
320.  yelp(mtmp)
321.  register struct monst *mtmp;
322.  {
323.      register const char *yelp_verb = 0;
324.  
325.      if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
326.  	return;
327.  
328.      /* presumably nearness and soundok checks have already been made */
329.      if (Hallucination)
330.  	yelp_verb = h_sounds[rn2(SIZE(h_sounds))];
331.      else switch (mtmp->data->msound) {
332.  	case MS_MEW:
333.  	    yelp_verb = "yowl";
334.  	    break;
335.  	case MS_BARK:
336.  	case MS_GROWL:
337.  	    yelp_verb = "yelp";
338.  	    break;
339.  	case MS_ROAR:
340.  	    yelp_verb = "snarl";
341.  	    break;
342.  	case MS_SQEEK:
343.  	    yelp_verb = "squeal";
344.  	    break;
345.  	case MS_SQAWK:
346.  	    yelp_verb = "screak";
347.  	    break;
348.  	case MS_WAIL:
349.  	    yelp_verb = "wail";
350.  	    break;
351.      }
352.      if (yelp_verb) {
353.  	pline("%s %ss!", Monnam(mtmp), yelp_verb);
354.  	if(flags.run) nomul(0);
355.  	wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 12);
356.      }
357.  }
358.  
359.  /* the sounds of distressed pets */
360.  void
361.  whimper(mtmp)
362.  register struct monst *mtmp;
363.  {
364.      register const char *whimper_verb = 0;
365.  
366.      if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
367.  	return;
368.  
369.      /* presumably nearness and soundok checks have already been made */
370.      if (Hallucination)
371.  	whimper_verb = h_sounds[rn2(SIZE(h_sounds))];
372.      else switch (mtmp->data->msound) {
373.  	case MS_MEW:
374.  	case MS_GROWL:
375.  	    whimper_verb = "whimper";
376.  	    break;
377.  	case MS_BARK:
378.  	    whimper_verb = "whine";
379.  	    break;
380.  	case MS_SQEEK:
381.  	    whimper_verb = "squeal";
382.  	    break;
383.      }
384.      if (whimper_verb) {
385.  	pline("%s %ss.", Monnam(mtmp), whimper_verb);
386.  	if(flags.run) nomul(0);
387.  	wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6);
388.      }
389.  }
390.  
391.  /* pet makes "I'm hungry" noises */
392.  void
393.  beg(mtmp)
394.  register struct monst *mtmp;
395.  {
396.      if (mtmp->msleeping || !mtmp->mcanmove ||
397.  	    !(carnivorous(mtmp->data) || herbivorous(mtmp->data)))
398.  	return;
399.  
400.      /* presumably nearness and soundok checks have already been made */
401.      if (mtmp->data->msound != MS_SILENT && mtmp->data->msound <= MS_ANIMAL)
402.  	(void) domonnoise(mtmp);
403.      else if (mtmp->data->msound >= MS_HUMANOID) {
404.  	if (!canspotmon(mtmp))
405.  	    map_invisible(mtmp->mx, mtmp->my);
406.  	verbalize("I'm hungry.");
407.      }
408.  }
409.  
410.  static int
411.  domonnoise(mtmp)
412.  register struct monst *mtmp;
413.  {
414.      register const char *pline_msg = 0,	/* Monnam(mtmp) will be prepended */
415.  			*verbl_msg = 0;	/* verbalize() */
416.      struct permonst *ptr = mtmp->data;
417.  
418.      /* presumably nearness and sleep checks have already been made */
419.      if (!flags.soundok) return(0);
420.  
421.      switch (ptr->msound) {
422.  	case MS_ORACLE:
423.  	    return doconsult(mtmp);
424.  	case MS_PRIEST:
425.  	    priest_talk(mtmp);
426.  	    break;
427.  	case MS_LEADER:
428.  	case MS_NEMESIS:
429.  	case MS_GUARDIAN:
430.  	    quest_chat(mtmp);
431.  	    break;
432.  	case MS_SELL: /* pitch, pay, total */
433.  	    shk_chat(mtmp);
434.  	    break;
435.  	case MS_VAMPIRE:
436.  	    if (mtmp->mpeaceful)
437.  	    	verbl_msg = "I only drink... potions.";
438.  	    else
439.  	    	verbl_msg = "I vant to suck your blood!";
440.  	    break;
441.  	case MS_WERE:
442.  	    if (flags.moonphase == FULL_MOON && (night() ^ !rn2(13))) {
443.  		pline("%s throws back %s head and lets out a blood curdling %s!",
444.  		      Monnam(mtmp), his[pronoun_gender(mtmp)],
445.  		      ptr == &mons[PM_HUMAN_WERERAT] ? "shriek" : "howl");
446.  		wake_nearto(mtmp->mx, mtmp->my, 11*11);
447.  	    } else
448.  		pline_msg =
449.  		     "whispers inaudibly.  All you can make out is \"moon\".";
450.  	    break;
451.  	case MS_SILENT:
452.  	    return 0;
453.  	case MS_BARK:
454.  	    if (flags.moonphase == FULL_MOON && night()) {
455.  		pline_msg = "howls.";
456.  	    } else if (mtmp->mpeaceful) {
457.  		if (mtmp->mtame &&
458.  			(mtmp->mconf || mtmp->mflee || mtmp->mtrapped ||
459.  			 moves > EDOG(mtmp)->hungrytime || mtmp->mtame < 5))
460.  		    pline_msg = "whines.";
461.  		else if (mtmp->mtame && EDOG(mtmp)->hungrytime > moves + 1000)
462.  		    pline_msg = "yips.";
463.  		else
464.  		    pline_msg = "barks.";
465.  	    } else {
466.  		pline_msg = "growls.";
467.  	    }
468.  	    break;
469.  	case MS_MEW:
470.  	    if (mtmp->mtame) {
471.  		if (mtmp->mconf || mtmp->mflee || mtmp->mtrapped ||
472.  			mtmp->mtame < 5)
473.  		    pline_msg = "yowls.";
474.  		else if (moves > EDOG(mtmp)->hungrytime)
475.  		    pline_msg = "miaos.";
476.  		else if (EDOG(mtmp)->hungrytime > moves + 1000)
477.  		    pline_msg = "purrs.";
478.  		else
479.  		    pline_msg = "mews.";
480.  		break;
481.  	    } /* else FALLTHRU */
482.  	case MS_GROWL:
483.  	    pline_msg = mtmp->mpeaceful ? "snarls." : "growls!";
484.  	    break;
485.  	case MS_ROAR:
486.  	    pline_msg = mtmp->mpeaceful ? "snarls." : "roars!";
487.  	    break;
488.  	case MS_SQEEK:
489.  	    pline_msg = "squeaks.";
490.  	    break;
491.  	case MS_SQAWK:
492.  	    if (mtmp->data == &mons[PM_RAVEN] && !mtmp->mpeaceful)
493.  	    	verbl_msg = "Nevermore!";
494.  	    else
495.  	    	pline_msg = "squawks.";
496.  	    break;
497.  	case MS_HISS:
498.  	    if (!mtmp->mpeaceful)
499.  		pline_msg = "hisses!";
500.  	    else return 0;	/* no sound */
501.  	    break;
502.  	case MS_BUZZ:
503.  	    pline_msg = mtmp->mpeaceful ? "drones." : "buzzes angrily.";
504.  	    break;
505.  	case MS_GRUNT:
506.  	    pline_msg = "grunts.";
507.  	    break;
508.  	case MS_NEIGH:
509.  	    if (mtmp->mtame < 5)
510.  		pline_msg = "neighs.";
511.  	    else if (moves > EDOG(mtmp)->hungrytime)
512.  		pline_msg = "whinnies.";
513.  	    else
514.  		pline_msg = "whickers.";
515.  	    break;
516.  	case MS_WAIL:
517.  	    pline_msg = "wails mournfully.";
518.  	    break;
519.  	case MS_GURGLE:
520.  	    pline_msg = "gurgles.";
521.  	    break;
522.  	case MS_BURBLE:
523.  	    pline_msg = "burbles.";
524.  	    break;
525.  	case MS_SHRIEK:
526.  	    pline_msg = "shrieks.";
527.  	    aggravate();
528.  	    break;
529.  	case MS_IMITATE:
530.  	    pline_msg = "imitates you.";
531.  	    break;
532.  	case MS_BONES:
533.  	    pline("%s rattles noisily.", Monnam(mtmp));
534.  	    You("freeze for a moment.");
535.  	    nomul(-2);
536.  	    break;
537.  	case MS_LAUGH:
538.  	    {
539.  		static const char *laugh_msg[4] = {
540.  		    "giggles.", "chuckles.", "snickers.", "laughs.",
541.  		};
542.  		pline_msg = laugh_msg[rn2(4)];
543.  	    }
544.  	    break;
545.  	case MS_MUMBLE:
546.  	    pline_msg = "mumbles incomprehensibly.";
547.  	    break;
548.  	case MS_DJINNI:
549.  	    if (mtmp->mtame) {
550.  		verbl_msg = "Sorry, I'm all out of wishes.";
551.  	    } else if (mtmp->mpeaceful) {
552.  		if (ptr == &mons[PM_WATER_DEMON])
553.  		    pline_msg = "gurgles.";
554.  		else
555.  		    verbl_msg = "I'm free!";
556.  	    } else verbl_msg = "This will teach you not to disturb me!";
557.  	    break;
558.  	case MS_BOAST:	/* giants */
559.  	    if (!mtmp->mpeaceful) {
560.  		switch (rn2(4)) {
561.  		case 0: pline("%s boasts about %s gem collection.",
562.  			      Monnam(mtmp), his[pronoun_gender(mtmp)]);
563.  			break;
564.  		case 1: pline_msg = "complains about a diet of mutton.";
565.  			break;
566.  	       default: pline_msg = "shouts \"Fee Fie Foe Foo!\" and guffaws.";
567.  			wake_nearto(mtmp->mx, mtmp->my, 7*7);
568.  			break;
569.  		}
570.  		break;
571.  	    }
572.  	    /* else FALLTHRU */
573.  	case MS_HUMANOID:
574.  	    if (!mtmp->mpeaceful) {
575.  		if (In_endgame(&u.uz) && is_mplayer(ptr)) {
576.  		    mplayer_talk(mtmp);
577.  		    break;
578.  		} else return 0;	/* no sound */
579.  	    }
580.  	    /* Generic peaceful humanoid behaviour. */
581.  	    if (mtmp->mflee)
582.  		pline_msg = "wants nothing to do with you.";
583.  	    else if (mtmp->mhp < mtmp->mhpmax/4)
584.  		pline_msg = "moans.";
585.  	    else if (mtmp->mconf || mtmp->mstun)
586.  		verbl_msg = !rn2(3) ? "Huh?" : rn2(2) ? "What?" : "Eh?";
587.  	    else if (!mtmp->mcansee)
588.  		verbl_msg = "I can't see!";
589.  	    else if (mtmp->mtrapped)
590.  		verbl_msg = "I'm trapped!";
591.  	    else if (mtmp->mhp < mtmp->mhpmax/2)
592.  		pline_msg = "asks for a potion of healing.";
593.  	    else if (mtmp->mtame && moves > EDOG(mtmp)->hungrytime)
594.  		verbl_msg = "I'm hungry.";
595.  	    /* Specific monsters' interests */
596.  	    else if (is_elf(ptr))
597.  		pline_msg = "curses orcs.";
598.  	    else if (is_dwarf(ptr))
599.  		pline_msg = "talks about mining.";
600.  	    else if (likes_magic(ptr))
601.  		pline_msg = "talks about spellcraft.";
602.  	    else if (ptr->mlet == S_CENTAUR)
603.  		pline_msg = "discusses hunting.";
604.  	    else switch (monsndx(ptr)) {
605.  		case PM_HOBBIT:
606.  		    pline_msg = (mtmp->mhpmax - mtmp->mhp >= 10) ?
607.  				"complains about unpleasant dungeon conditions."
608.  				: "asks you about the One Ring.";
609.  		    break;
610.  		case PM_ARCHEOLOGIST:
611.      pline_msg = "describes a recent article in \"Spelunker Today\" magazine.";
612.  		    break;
613.  #ifdef TOURIST
614.  		case PM_TOURIST:
615.  		    verbl_msg = "Aloha.";
616.  		    break;
617.  #endif
618.  		default:
619.  		    pline_msg = "discusses dungeon exploration.";
620.  		    break;
621.  	    }
622.  	    break;
623.  	case MS_SEDUCE:
624.  #ifdef SEDUCE
625.  	    if (ptr->mlet != S_NYMPH &&
626.  		could_seduce(mtmp, &youmonst, (struct attack *)0) == 1) {
627.  			(void) doseduce(mtmp);
628.  			break;
629.  	    }
630.  	    switch ((poly_gender() != (int) mtmp->female) ? rn2(3) : 0) {
631.  #else
632.  	    switch ((poly_gender() == 0) ? rn2(3) : 0) {
633.  #endif
634.  		case 2:
635.  			verbl_msg = "Hello, sailor.";
636.  			break;
637.  		case 1:
638.  			pline_msg = "comes on to you.";
639.  			break;
640.  		default:
641.  			pline_msg = "cajoles you.";
642.  	    }
643.  	    break;
644.  #ifdef KOPS
645.  	case MS_ARREST:
646.  	    if (mtmp->mpeaceful)
647.  		verbalize("Just the facts, %s.",
648.  		      flags.female ? "Ma'am" : "Sir");
649.  	    else {
650.  		static const char *arrest_msg[3] = {
651.  		    "Anything you say can be used against you.",
652.  		    "You're under arrest!",
653.  		    "Stop in the name of the Law!",
654.  		};
655.  		verbl_msg = arrest_msg[rn2(3)];
656.  	    }
657.  	    break;
658.  #endif
659.  	case MS_BRIBE:
660.  	    if (mtmp->mpeaceful && !mtmp->mtame) {
661.  		(void) demon_talk(mtmp);
662.  		break;
663.  	    }
664.  	    /* fall through */
665.  	case MS_CUSS:
666.  	    if (!mtmp->mpeaceful)
667.  		cuss(mtmp);
668.  	    break;
669.  	case MS_SPELL:
670.  	    /* deliberately vague, since it's not actually casting any spell */
671.  	    pline_msg = "seems to mutter a cantrip.";
672.  	    break;
673.  	case MS_NURSE:
674.  	    if (uwep && (uwep->oclass == WEAPON_CLASS || is_weptool(uwep)))
675.  		verbl_msg = "Put that weapon away before you hurt someone!";
676.  	    else if (uarmc || uarm || uarmh || uarms || uarmg || uarmf)
677.  		verbl_msg = Role_if(PM_HEALER) ?
678.  			  "Doc, I can't help you unless you cooperate." :
679.  			  "Please undress so I can examine you.";
680.  #ifdef TOURIST
681.  	    else if (uarmu)
682.  		verbl_msg = "Take off your shirt, please.";
683.  #endif
684.  	    else verbl_msg = "Relax, this won't hurt a bit.";
685.  	    break;
686.  	case MS_GUARD:
687.  	    if (u.ugold)
688.  		verbl_msg = "Please drop that gold and follow me.";
689.  	    else
690.  		verbl_msg = "Please follow me.";
691.  	    break;
692.  	case MS_SOLDIER:
693.  	    {
694.  		static const char *soldier_foe_msg[3] = {
695.  		    "Resistance is useless!",
696.  		    "You're dog meat!",
697.  		    "Surrender!",
698.  		},		  *soldier_pax_msg[3] = {
699.  		    "What lousy pay we're getting here!",
700.  		    "The food's not fit for Orcs!",
701.  		    "My feet hurt, I've been on them all day!",
702.  		};
703.  		verbl_msg = mtmp->mpeaceful ? soldier_pax_msg[rn2(3)]
704.  					    : soldier_foe_msg[rn2(3)];
705.  	    }
706.  	    break;
707.  	case MS_RIDER:
708.  	    if (ptr == &mons[PM_DEATH] && !rn2(10))
709.  		pline_msg = "is busy reading a copy of Sandman #8.";
710.  	    else verbl_msg = "Who do you think you are, War?";
711.  	    break;
712.      }
713.  
714.      if (!canspotmon(mtmp))
715.  	map_invisible(mtmp->mx, mtmp->my);
716.      if (pline_msg) pline("%s %s", Monnam(mtmp), pline_msg);
717.      else if (verbl_msg) verbalize(verbl_msg);
718.      return(1);
719.  }
720.  
721.  
722.  int
723.  dotalk()
724.  {
725.      int result;
726.      boolean save_soundok = flags.soundok;
727.      flags.soundok = 1;	/* always allow sounds while chatting */
728.      result = dochat();
729.      flags.soundok = save_soundok;
730.      return result;
731.  }
732.  
733.  static int
734.  dochat()
735.  {
736.      register struct monst *mtmp;
737.      register int tx,ty;
738.      struct obj *otmp;
739.  
740.      if (youmonst.data->msound == MS_SILENT) {
741.  	pline("As %s, you cannot speak.", an(youmonst.data->mname));
742.  	return(0);
743.      }
744.      if (Strangled) {
745.  	You_cant("speak.  You're choking!");
746.  	return(0);
747.      }
748.      if (u.uswallow) {
749.  	pline("They won't hear you out there.");
750.  	return(0);
751.      }
752.      if (Underwater) {
753.  	Your("speech is unintelligible underwater.");
754.  	return(0);
755.      }
756.  
757.      if (!Blind && (otmp = shop_object(u.ux, u.uy)) != (struct obj *)0) {
758.  	/* standing on something in a shop and chatting causes the shopkeeper
759.  	   to describe the price(s).  This can inhibit other chatting inside
760.  	   a shop, but that shouldn't matter much.  shop_object() returns an
761.  	   object iff inside a shop and the shopkeeper is present and willing
762.  	   (not angry) and able (not asleep) to speak and the position contains
763.  	   any objects other than just gold.
764.  	*/
765.  	price_quote(otmp);
766.  	return(1);
767.      }
768.  
769.      (void) getdir("Talk to whom? [in what direction]");
770.  
771.      if (u.dz) {
772.  	pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down");
773.  	return(0);
774.      }
775.  
776.      if (u.dx == 0 && u.dy == 0) {
777.  /*
778.   * Let's not include this.  It raises all sorts of questions: can you wear
779.   * 2 helmets, 2 amulets, 3 pairs of gloves or 6 rings as a marilith,
780.   * etc...  --KAA
781.  	if (u.umonnum == PM_ETTIN) {
782.  	    You("discover that your other head makes boring conversation.");
783.  	    return(1);
784.  	}
785.  */
786.  	pline("Talking to yourself is a bad habit for a dungeoneer.");
787.  	return(0);
788.      }
789.  
790.      tx = u.ux+u.dx; ty = u.uy+u.dy;
791.      mtmp = m_at(tx, ty);
792.  
793.      if (!mtmp || mtmp->mundetected ||
794.  		mtmp->m_ap_type == M_AP_FURNITURE ||
795.  		mtmp->m_ap_type == M_AP_OBJECT)
796.  	return(0);
797.  
798.      /* sleeping monsters won't talk, except priests (who wake up) */
799.      if ((!mtmp->mcanmove || mtmp->msleeping) && !mtmp->ispriest) {
800.  	/* If it is unseen, the player can't tell the difference between
801.  	   not noticing him and just not existing, so skip the message. */
802.  	if (canspotmon(mtmp))
803.  	    pline("%s seems not to notice you.", Monnam(mtmp));
804.  	return(0);
805.      }
806.  
807.      if (mtmp->mtame && mtmp->meating) {
808.  	if (!canspotmon(mtmp))
809.  	    map_invisible(mtmp->mx, mtmp->my);
810.  	pline("%s is eating noisily.", Monnam(mtmp));
811.  	return (0);
812.      }
813.  
814.      return domonnoise(mtmp);
815.  }
816.  
817.  #endif /* OVLB */
818.  
819.  /*sounds.c*/