Source:NetHack 3.2.0/sounds.c

From NetHackWiki
Revision as of 09:34, 4 March 2008 by Kernigh bot (talk | contribs) (NetHack 3.2.0/sounds.c moved to Source:NetHack 3.2.0/sounds.c: Robot: moved page)
(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.2.0. To link to a particular line, write [[NetHack 3.2.0/sounds.c#line123]], for example.

Warning! This is the source code from an old release. For the latest release, 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: @(#)sounds.c	3.2	95/10/20	*/
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->msleep ||
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->msleep || ++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->msleep || 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->msleep || !mtmp->mcanmove || !mtmp->data->msound) return;
304.  
305.      /* presumably nearness and soundok checks have already been made */
306.      if (Hallucination)
307.  	growl_verb = h_sounds[rn2(SIZE(h_sounds))];
308.      else
309.  	growl_verb = growl_sound(mtmp);
310.      if (growl_verb) {
311.  	pline("%s %s!", Monnam(mtmp), makeplural(growl_verb));
312.  	if(flags.run) nomul(0);
313.  	wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 18);
314.      }
315.  }
316.  
317.  /* the sounds of mistreated pets */
318.  void
319.  yelp(mtmp)
320.  register struct monst *mtmp;
321.  {
322.      register const char *yelp_verb = 0;
323.  
324.      if (mtmp->msleep || !mtmp->mcanmove || !mtmp->data->msound) return;
325.  
326.      /* presumably nearness and soundok checks have already been made */
327.      if (Hallucination)
328.  	yelp_verb = h_sounds[rn2(SIZE(h_sounds))];
329.      else switch (mtmp->data->msound) {
330.  	case MS_MEW:
331.  	    yelp_verb = "yowl";
332.  	    break;
333.  	case MS_BARK:
334.  	case MS_GROWL:
335.  	    yelp_verb = "yelp";
336.  	    break;
337.  	case MS_ROAR:
338.  	    yelp_verb = "snarl";
339.  	    break;
340.  	case MS_SQEEK:
341.  	    yelp_verb = "squeal";
342.  	    break;
343.  	case MS_SQAWK:
344.  	    yelp_verb = "screak";
345.  	    break;
346.  	case MS_WAIL:
347.  	    yelp_verb = "wail";
348.  	    break;
349.      }
350.      if (yelp_verb) {
351.  	pline("%s %ss!", Monnam(mtmp), yelp_verb);
352.  	if(flags.run) nomul(0);
353.  	wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 12);
354.      }
355.  }
356.  
357.  /* the sounds of distressed pets */
358.  void
359.  whimper(mtmp)
360.  register struct monst *mtmp;
361.  {
362.      register const char *whimper_verb = 0;
363.  
364.      if (mtmp->msleep || !mtmp->mcanmove || !mtmp->data->msound) return;
365.  
366.      /* presumably nearness and soundok checks have already been made */
367.      if (Hallucination)
368.  	whimper_verb = h_sounds[rn2(SIZE(h_sounds))];
369.      else switch (mtmp->data->msound) {
370.  	case MS_MEW:
371.  	case MS_GROWL:
372.  	    whimper_verb = "whimper";
373.  	    break;
374.  	case MS_BARK:
375.  	    whimper_verb = "whine";
376.  	    break;
377.  	case MS_SQEEK:
378.  	    whimper_verb = "squeal";
379.  	    break;
380.      }
381.      if (whimper_verb) {
382.  	pline("%s %ss.", Monnam(mtmp), whimper_verb);
383.  	if(flags.run) nomul(0);
384.  	wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6);
385.      }
386.  }
387.  
388.  /* pet makes "I'm hungry" noises */
389.  void
390.  beg(mtmp)
391.  register struct monst *mtmp;
392.  {
393.      if (mtmp->msleep || !mtmp->mcanmove ||
394.  	!(carnivorous(mtmp->data) || herbivorous(mtmp->data))) return;
395.      /* presumably nearness and soundok checks have already been made */
396.      if (mtmp->data->msound != MS_SILENT && mtmp->data->msound <= MS_ANIMAL)
397.  	(void) domonnoise(mtmp);
398.      else if (mtmp->data->msound >= MS_HUMANOID)
399.  	verbalize("I'm hungry.");
400.  }
401.  
402.  static int
403.  domonnoise(mtmp)
404.  register struct monst *mtmp;
405.  {
406.      register const char *pline_msg = 0;	/* Monnam(mtmp) will be prepended */
407.  
408.      /* presumably nearness and sleep checks have already been made */
409.      if (!flags.soundok) return(0);
410.  
411.      switch (mtmp->data->msound) {
412.  	case MS_ORACLE:
413.  	    return doconsult(mtmp);
414.  	case MS_PRIEST:
415.  	    priest_talk(mtmp);
416.  	    break;
417.  	case MS_LEADER:
418.  	case MS_NEMESIS:
419.  	case MS_GUARDIAN:
420.  	    quest_chat(mtmp);
421.  	    break;
422.  	case MS_SELL: /* pitch, pay, total */
423.  	    shk_chat(mtmp);
424.  	    break;
425.  	case MS_SILENT:
426.  	    break;
427.  	case MS_BARK:
428.  	    if (flags.moonphase == FULL_MOON && night()) {
429.  		pline_msg = "howls.";
430.  	    } else if (mtmp->mpeaceful) {
431.  		if (mtmp->mtame &&
432.  		    (mtmp->mconf || mtmp->mflee || mtmp->mtrapped ||
433.  		     moves > EDOG(mtmp)->hungrytime || mtmp->mtame < 5))
434.  		    pline_msg = "whines.";
435.  		else if (EDOG(mtmp)->hungrytime > moves + 1000)
436.  		    pline_msg = "yips.";
437.  		else
438.  		    pline_msg = "barks.";
439.  	    } else {
440.  		pline_msg = "growls.";
441.  	    }
442.  	    break;
443.  	case MS_MEW:
444.  	    if (mtmp->mtame) {
445.  		if (mtmp->mconf || mtmp->mflee || mtmp->mtrapped ||
446.  		    mtmp->mtame < 5)
447.  		    pline_msg = "yowls.";
448.  		else if (moves > EDOG(mtmp)->hungrytime)
449.  		    pline_msg = "miaos.";
450.  		else if (EDOG(mtmp)->hungrytime > moves + 1000)
451.  		    pline_msg = "purrs.";
452.  		else
453.  		    pline_msg = "mews.";
454.  		break;
455.  	    } /* else FALLTHRU */
456.  	case MS_GROWL:
457.  	    pline_msg = mtmp->mpeaceful ? "snarls." : "growls!";
458.  	    break;
459.  	case MS_ROAR:
460.  	    pline_msg = mtmp->mpeaceful ? "snarls." : "roars!";
461.  	    break;
462.  	case MS_SQEEK:
463.  	    pline_msg = "squeaks.";
464.  	    break;
465.  	case MS_SQAWK:
466.  	    pline_msg = "squawks.";
467.  	    break;
468.  	case MS_HISS:
469.  	    if (!mtmp->mpeaceful)
470.  		pline_msg = "hisses!";
471.  	    else return 0;	/* no sound */
472.  	    break;
473.  	case MS_BUZZ:
474.  	    pline_msg = mtmp->mpeaceful ? "drones." : "buzzes angrily.";
475.  	    break;
476.  	case MS_GRUNT:
477.  	    pline_msg = "grunts.";
478.  	    break;
479.  	case MS_NEIGH:
480.  	    if (mtmp->mtame < 5)
481.  		pline_msg = "neighs.";
482.  	    else if (moves > EDOG(mtmp)->hungrytime)
483.  		pline_msg = "whinnies.";
484.  	    else
485.  		pline_msg = "whickers.";
486.  	    break;
487.  	case MS_WAIL:
488.  	    pline_msg = "wails mournfully.";
489.  	    break;
490.  	case MS_GURGLE:
491.  	    pline_msg = "gurgles.";
492.  	    break;
493.  	case MS_BURBLE:
494.  	    pline_msg = "burbles.";
495.  	    break;
496.  	case MS_SHRIEK:
497.  	    pline_msg = "shrieks.";
498.  	    aggravate();
499.  	    break;
500.  	case MS_IMITATE:
501.  	    pline_msg = "imitates you.";
502.  	    break;
503.  	case MS_BONES:
504.  	    pline("%s rattles noisily.", Monnam(mtmp));
505.  	    You("freeze for a moment.");
506.  	    nomul(-2);
507.  	    break;
508.  	case MS_LAUGH:
509.  	    {
510.  		static const char *laugh_msg[4] = {
511.  		    "giggles.", "chuckles.", "snickers.", "laughs.",
512.  		};
513.  		pline_msg = laugh_msg[rn2(4)];
514.  	    }
515.  	    break;
516.  	case MS_MUMBLE:
517.  	    pline_msg = "mumbles incomprehensibly.";
518.  	    break;
519.  	case MS_DJINNI:
520.  	    if (mtmp->mtame) verbalize("Thank you for freeing me!");
521.  	    else if (mtmp->mpeaceful) verbalize("I'm free!");
522.  	    else verbalize("This will teach you not to disturb me!");
523.  	    break;
524.  	case MS_HUMANOID:
525.  	    if (!mtmp->mpeaceful) {
526.  		if (In_endgame(&u.uz) && is_mplayer(mtmp->data)) {
527.  		    mplayer_talk(mtmp);
528.  		    break;
529.  		} else {
530.  		    return 0;	/* no sound */
531.  		}
532.  	    }
533.  	    /* Generic peaceful humanoid behaviour. */
534.  	    if (mtmp->mflee)
535.  		pline_msg = "wants nothing to do with you.";
536.  	    else if (mtmp->mhp < mtmp->mhpmax/4)
537.  		pline_msg = "moans.";
538.  	    else if (mtmp->mconf || mtmp->mstun)
539.  		verbalize(!rn2(3) ? "Huh?" : rn2(2) ? "What?" : "Eh?");
540.  	    else if (!mtmp->mcansee)
541.  		verbalize("I can't see!");
542.  	    else if (mtmp->mtrapped)
543.  		verbalize("I'm trapped!");
544.  	    else if (mtmp->mhp < mtmp->mhpmax/2)
545.  		pline_msg = "asks for a potion of healing.";
546.  	    else if (mtmp->mtame && moves > EDOG(mtmp)->hungrytime)
547.  		verbalize("I'm hungry.");
548.  	    /* Specific monster's interests */
549.  	    else if (is_elf(mtmp->data))
550.  		pline_msg = "curses orcs.";
551.  	    else if (is_dwarf(mtmp->data))
552.  		pline_msg = "talks about mining.";
553.  	    else if (likes_magic(mtmp->data))
554.  		pline_msg = "talks about spellcraft.";
555.  	    else if (carnivorous(mtmp->data))
556.  		pline_msg = "discusses hunting.";
557.  	    else switch (monsndx(mtmp->data)) {
558.  		case PM_HOBBIT:
559.  		    pline_msg = (mtmp->mhpmax - mtmp->mhp >= 10) ?
560.  				"complains about unpleasant dungeon conditions."
561.  				: "asks you about the One Ring.";
562.  		    break;
563.  		case PM_ARCHEOLOGIST:
564.      pline_msg = "describes a recent article in \"Spelunker Today\" magazine.";
565.  		    break;
566.  #ifdef TOURIST
567.  		case PM_TOURIST:
568.  		    verbalize("Aloha.");
569.  		    break;
570.  #endif
571.  		default:
572.  		    pline_msg = "discusses dungeon exploration.";
573.  	    }
574.  	    break;
575.  	case MS_SEDUCE:
576.  #ifdef SEDUCE
577.  	    if (mtmp->data->mlet != S_NYMPH &&
578.  		could_seduce(mtmp, &youmonst, (struct attack *)0) == 1) {
579.  			(void) doseduce(mtmp);
580.  			break;
581.  	    }
582.  	    switch ((poly_gender() != mtmp->female) ? rn2(3) : 0) {
583.  #else
584.  	    switch ((poly_gender() == 0) ? rn2(3) : 0) {
585.  #endif
586.  		case 2:
587.  			verbalize("Hello, sailor.");
588.  			break;
589.  		case 1:
590.  			pline_msg = "comes on to you.";
591.  			break;
592.  		default:
593.  			pline_msg = "cajoles you.";
594.  	    }
595.  	    break;
596.  #ifdef KOPS
597.  	case MS_ARREST:
598.  	    if (mtmp->mpeaceful)
599.  		verbalize("Just the facts, %s.",
600.  		      flags.female ? "Ma'am" : "Sir");
601.  	    else {
602.  		static const char *arrest_msg[3] = {
603.  		    "Anything you say can be used against you.",
604.  		    "You're under arrest!",
605.  		    "Stop in the name of the Law!",
606.  		};
607.  		verbalize(arrest_msg[rn2(3)]);
608.  	    }
609.  	    break;
610.  #endif
611.  	case MS_BRIBE:
612.  	    if (mtmp->mpeaceful && !mtmp->mtame) {
613.  		(void) demon_talk(mtmp);
614.  		break;
615.  	    }
616.  	    /* fall through */
617.  	case MS_CUSS:
618.  	    if (!mtmp->mpeaceful)
619.  		cuss(mtmp);
620.  	    break;
621.  	case MS_NURSE:
622.  	    if (uwep && (uwep->oclass == WEAPON_CLASS || is_weptool(uwep)))
623.  		verbalize("Put that weapon away before you hurt someone!");
624.  	    else if (uarmc || uarm || uarmh || uarms || uarmg || uarmf)
625.  		verbalize(Role_is('H') ?
626.  			  "Doc, I can't help you unless you cooperate." :
627.  			  "Please undress so I can examine you.");
628.  #ifdef TOURIST
629.  	    else if (uarmu)
630.  		verbalize("Take off your shirt, please.");
631.  #endif
632.  	    else verbalize("Relax, this won't hurt a bit.");
633.  	    break;
634.  	case MS_GUARD:
635.  	    if (u.ugold)
636.  		verbalize("Please drop that gold and follow me.");
637.  	    else
638.  		verbalize("Please follow me.");
639.  	    break;
640.  	case MS_SOLDIER:
641.  	    {
642.  		static const char *soldier_foe_msg[3] = {
643.  		    "Resistance is useless!",
644.  		    "You're dog meat!",
645.  		    "Surrender!",
646.  		},		  *soldier_pax_msg[3] = {
647.  		    "What lousy pay we're getting here!",
648.  		    "The food's not fit for Orcs!",
649.  		    "My feet hurt, I've been on them all day!",
650.  		};
651.  		verbalize(mtmp->mpeaceful ? soldier_pax_msg[rn2(3)]
652.  					  : soldier_foe_msg[rn2(3)]);
653.  	    }
654.  	    break;
655.  	case MS_RIDER:
656.  	    if (mtmp->data == &mons[PM_DEATH] && mtmp->mpeaceful)
657.  		pline_msg = "is busy reading a copy of Sandman #9.";
658.  	    else verbalize("Who do you think you are, War?");
659.  	    break;
660.      }
661.  
662.      if (pline_msg) pline("%s %s", Monnam(mtmp), pline_msg);
663.      return(1);
664.  }
665.  
666.  
667.  int
668.  dotalk()
669.  {
670.      int result;
671.      boolean save_soundok = flags.soundok;
672.      flags.soundok = 1;	/* always allow sounds while chatting */
673.      result = dochat();
674.      flags.soundok = save_soundok;
675.      return result;
676.  }
677.  
678.  static int
679.  dochat()
680.  {
681.      register struct monst *mtmp;
682.      register int tx,ty;
683.      struct obj *otmp;
684.  
685.      if (uasmon->msound == MS_SILENT) {
686.  	pline("As %s, you cannot speak.", an(uasmon->mname));
687.  	return(0);
688.      }
689.      if (Strangled) {
690.  	You_cant("speak.  You're choking!");
691.  	return(0);
692.      }
693.      if (u.uswallow) {
694.  	pline("They won't hear you out there.");
695.  	return(0);
696.      }
697.      if (Underwater) {
698.  	Your("speech is unintelligible underwater.");
699.  	return(0);
700.      }
701.  
702.      if (!Blind && (otmp = shop_object(u.ux, u.uy)) != (struct obj *)0) {
703.  	/* standing on something in a shop and chatting causes the shopkeeper
704.  	   to describe the price(s).  This can inhibit other chatting inside
705.  	   a shop, but that shouldn't matter much.  shop_object() returns an
706.  	   object iff inside a shop and the shopkeeper is present and willing
707.  	   (not angry) and able (not asleep) to speak and the position contains
708.  	   any objects other than just gold.
709.  	*/
710.  	price_quote(otmp);
711.  	return(1);
712.      }
713.  
714.      (void) getdir("Talk to whom? [in what direction]");
715.  
716.      if (u.dz) {
717.  	pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down");
718.  	return(0);
719.      }
720.  
721.      if (u.dx == 0 && u.dy == 0) {
722.  /*
723.   * Let's not include this.  It raises all sorts of questions: can you wear
724.   * 2 helmets, 2 amulets, 3 pairs of gloves or 6 rings as a marilith,
725.   * etc...  --KAA
726.  	if (u.umonnum == PM_ETTIN) {
727.  	    You("discover that your other head makes boring conversation.");
728.  	    return(1);
729.  	}
730.  */
731.  	pline("Talking to yourself is a bad habit for a dungeoneer.");
732.  	return(0);
733.      }
734.  
735.      tx = u.ux+u.dx; ty = u.uy+u.dy;
736.      mtmp = m_at(tx, ty);
737.      if ((Blind && !Telepat) || !mtmp || mtmp->mundetected ||
738.  		mtmp->m_ap_type == M_AP_FURNITURE ||
739.  		mtmp->m_ap_type == M_AP_OBJECT) {
740.  	pline("I see nobody there.");
741.  	return(0);
742.      }
743.      /* sleeping monsters won't talk, except priests (who wake up) */
744.      if ((!mtmp->mcanmove || mtmp->msleep) && !mtmp->ispriest) {
745.  	pline("%s seems not to notice you.", Monnam(mtmp));
746.  	return(0);
747.      }
748.  
749.      if (mtmp->mtame && mtmp->meating) {
750.  	pline("%s is eating noisily.", Monnam(mtmp));
751.  	return (0);
752.      }
753.  
754.      return domonnoise(mtmp);
755.  }
756.  
757.  #endif /* OVLB */
758.  
759.  /*sounds.c*/