OSDN Git Service

patch artifact
[jnethack/source.git] / src / sounds.c
1 /* NetHack 3.6  sounds.c        $NHDT-Date: 1446713641 2015/11/05 08:54:01 $  $NHDT-Branch: master $:$NHDT-Revision: 1.74 $ */
2 /*      Copyright (c) 1989 Janet Walz, Mike Threepoint */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
8 /* JNetHack may be freely redistributed.  See license for details. */
9
10 #include "hack.h"
11
12 STATIC_DCL boolean FDECL(mon_is_gecko, (struct monst *));
13 STATIC_DCL int FDECL(domonnoise, (struct monst *));
14 STATIC_DCL int NDECL(dochat);
15 STATIC_DCL int FDECL(mon_in_room, (struct monst *, int));
16
17 /* this easily could be a macro, but it might overtax dumb compilers */
18 STATIC_OVL int
19 mon_in_room(mon, rmtyp)
20 struct monst *mon;
21 int rmtyp;
22 {
23     int rno = levl[mon->mx][mon->my].roomno;
24     if (rno >= ROOMOFFSET)
25         return rooms[rno - ROOMOFFSET].rtype == rmtyp;
26     return FALSE;
27 }
28
29 void
30 dosounds()
31 {
32     register struct mkroom *sroom;
33     register int hallu, vx, vy;
34 #if defined(AMIGA) && defined(AZTEC_C_WORKAROUND)
35     int xx;
36 #endif
37     struct monst *mtmp;
38
39     if (Deaf || !flags.acoustics || u.uswallow || Underwater)
40         return;
41
42     hallu = Hallucination ? 1 : 0;
43
44     if (level.flags.nfountains && !rn2(400)) {
45 #if 0 /*JP*/
46         static const char *const fountain_msg[4] = {
47             "bubbling water.", "water falling on coins.",
48             "the splashing of a naiad.", "a soda fountain!",
49 #else
50         static const char *const fountain_msg[4] = {
51             "\83S\83{\83S\83{\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D", "\83s\83`\83\83\83s\83`\83\83\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D",
52             "\83o\83V\83\83\83o\83V\83\83\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D", "\92Y\8e_\88ù\97¿\82Ì\83V\83\85\81[\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I",
53 #endif
54         };
55         You_hear1(fountain_msg[rn2(3) + hallu]);
56     }
57     if (level.flags.nsinks && !rn2(300)) {
58 #if 0 /*JP*/
59         static const char *const sink_msg[3] = {
60             "a slow drip.", "a gurgling noise.", "dishes being washed!",
61 #else
62         static const char *const sink_msg[3] = {
63             "\90\85\82ª\82Û\82½\82Û\82½\82Æ\97\8e\82¿\82é\89¹\82ð\95·\82¢\82½\81D",
64             "\82ª\82ç\82ª\82ç\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D",
65             "\8eM\82ð\90ô\82¤\89¹\82ð\95·\82¢\82½\81I",
66 #endif
67         };
68         You_hear1(sink_msg[rn2(2) + hallu]);
69     }
70     if (level.flags.has_court && !rn2(200)) {
71 #if 0 /*JP*/
72         static const char *const throne_msg[4] = {
73             "the tones of courtly conversation.",
74             "a sceptre pounded in judgment.",
75             "Someone shouts \"Off with %s head!\"", "Queen Beruthiel's cats!",
76 #else
77         static const char *const throne_msg[4] = {
78             "\8fã\95i\82È\98b\82µ\90º\82ð\95·\82¢\82½\81D",
79             "\8dÙ\94»\82Åâ\94\82ð\93Ë\82­\89¹\82ð\95·\82¢\82½\81D",
80             "\82¾\82ê\82©\82ª\81u\82»\82Ì\82à\82Ì\82Ì\8eñ\82ð\82Í\82Ë\82æ\81I\81v\82Æ\8b©\82Ô\90º\82ð\95·\82¢\82½\81D",
81             "\83x\83\8b\83V\83G\83\8b\89¤\94Ü\82Ì\94L\82Ì\90º\82ð\95·\82¢\82½\81I",
82 #endif
83         };
84         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
85             if (DEADMONSTER(mtmp))
86                 continue;
87             if ((mtmp->msleeping || is_lord(mtmp->data)
88                  || is_prince(mtmp->data)) && !is_animal(mtmp->data)
89                 && mon_in_room(mtmp, COURT)) {
90                 /* finding one is enough, at least for now */
91                 int which = rn2(3) + hallu;
92
93                 if (which != 2)
94                     You_hear1(throne_msg[which]);
95                 else
96                     pline(throne_msg[2], uhis());
97                 return;
98             }
99         }
100     }
101     if (level.flags.has_swamp && !rn2(200)) {
102 #if 0 /*JP*/
103         static const char *const swamp_msg[3] = {
104             "hear mosquitoes!", "smell marsh gas!", /* so it's a smell...*/
105             "hear Donald Duck!",
106 #else
107         static const char *const swamp_msg[3] = {
108             "\89á\82Ì\89H\89¹\82ð\95·\82¢\82½\81D",
109             "\95\85\82Á\82½\93õ\82¢\82ª\82µ\82½\81I",       /* so it's a smell...*/
110             "\83h\83i\83\8b\83h\83_\83b\83N\82Ì\90º\82ð\95·\82¢\82½\81I",
111 #endif
112         };
113         You1(swamp_msg[rn2(2) + hallu]);
114         return;
115     }
116     if (level.flags.has_vault && !rn2(200)) {
117         if (!(sroom = search_special(VAULT))) {
118             /* strange ... */
119             level.flags.has_vault = 0;
120             return;
121         }
122         if (gd_sound())
123             switch (rn2(2) + hallu) {
124             case 1: {
125                 boolean gold_in_vault = FALSE;
126
127                 for (vx = sroom->lx; vx <= sroom->hx; vx++)
128                     for (vy = sroom->ly; vy <= sroom->hy; vy++)
129                         if (g_at(vx, vy))
130                             gold_in_vault = TRUE;
131 #if defined(AMIGA) && defined(AZTEC_C_WORKAROUND)
132                 /* Bug in aztec assembler here. Workaround below */
133                 xx = ROOM_INDEX(sroom) + ROOMOFFSET;
134                 xx = (xx != vault_occupied(u.urooms));
135                 if (xx)
136 #else
137                 if (vault_occupied(u.urooms)
138                     != (ROOM_INDEX(sroom) + ROOMOFFSET))
139 #endif /* AZTEC_C_WORKAROUND */
140                 {
141                     if (gold_in_vault)
142 #if 0 /*JP*/
143                         You_hear(!hallu
144                                      ? "someone counting money."
145                                      : "the quarterback calling the play.");
146 #else
147                         You_hear(!hallu
148                                  ? "\92N\82©\82ª\82¨\8bà\82ð\90\94\82¦\82Ä\82¢\82é\89¹\82ð\95·\82¢\82½\81D"
149                                  : "\83N\83H\81[\83^\83o\83b\83N\82ª\8ew\8e¦\82ð\82·\82é\90º\82ð\95·\82¢\82½\81D");
150 #endif
151                     else
152 /*JP
153                         You_hear("someone searching.");
154 */
155                         You_hear("\92N\82©\82ª\91{\8dõ\82µ\82Ä\82¢\82é\89¹\82ð\95·\82¢\82½\81D");
156                     break;
157                 }
158                 /* fall into... (yes, even for hallucination) */
159             }
160             case 0:
161 /*JP
162                 You_hear("the footsteps of a guard on patrol.");
163 */
164                 You_hear("\8cx\94õ\88õ\82Ì\83p\83g\83\8d\81[\83\8b\82·\82é\89¹\82ð\95·\82¢\82½\81D");
165                 break;
166             case 2:
167 /*JP
168                 You_hear("Ebenezer Scrooge!");
169 */
170                 You_hear("\82±\82¿\8bT\82Ì\97¼\82³\82ñ\82Ì\90º\82ð\95·\82¢\82½\81I");
171                 break;
172             }
173         return;
174     }
175     if (level.flags.has_beehive && !rn2(200)) {
176         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
177             if (DEADMONSTER(mtmp))
178                 continue;
179             if ((mtmp->data->mlet == S_ANT && is_flyer(mtmp->data))
180                 && mon_in_room(mtmp, BEEHIVE)) {
181                 switch (rn2(2) + hallu) {
182                 case 0:
183 /*JP
184                     You_hear("a low buzzing.");
185 */
186                         You_hear("\82Ô\81[\82ñ\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D");
187                     break;
188                 case 1:
189 /*JP
190                     You_hear("an angry drone.");
191 */
192                         You_hear("\8b»\95±\82µ\82½\97Y\83o\83`\82Ì\89¹\82ð\95·\82¢\82½\81D");
193                     break;
194                 case 2:
195 #if 0 /*JP*/
196                     You_hear("bees in your %sbonnet!",
197                              uarmh ? "" : "(nonexistent) ");
198 #else
199                         You_hear("\83n\83`\82ª\82 \82È\82½\82Ì\96X\8eq%s\82Ì\92\86\82É\82¢\82é\89¹\82ð\95·\82¢\82½\81I",
200                             uarmh ? "" : "(\94í\82Á\82Ä\82È\82¢\82¯\82Ç)");
201 #endif
202                     break;
203                 }
204                 return;
205             }
206         }
207     }
208     if (level.flags.has_morgue && !rn2(200)) {
209         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
210             if (DEADMONSTER(mtmp))
211                 continue;
212             if ((is_undead(mtmp->data) || is_vampshifter(mtmp))
213                 && mon_in_room(mtmp, MORGUE)) {
214                 const char *hair = body_part(HAIR); /* hair/fur/scales */
215
216                 switch (rn2(2) + hallu) {
217                 case 0:
218 /*JP
219                     You("suddenly realize it is unnaturally quiet.");
220 */
221                     You("\95s\8e©\91R\82È\82­\82ç\82¢\90Ã\82©\82È\82Ì\82É\8bC\82Ã\82¢\82½\81D");
222                     break;
223                 case 1:
224 #if 0 /*JP*/
225                     pline_The("%s on the back of your %s %s up.", hair,
226                               body_part(NECK), vtense(hair, "stand"));
227 #else
228                     pline("\82 \82È\82½\82Ì%s\82Ì\82¤\82µ\82ë\82Ì%s\82ª\8bt\97§\82Á\82½\81D",
229                           body_part(NECK), body_part(HAIR));
230 #endif
231                     break;
232                 case 2:
233 #if 0 /*JP*/
234                     pline_The("%s on your %s %s to stand up.", hair,
235                               body_part(HEAD), vtense(hair, "seem"));
236 #else
237                     pline("\82 \82È\82½\82Ì%s\82Ì%s\82Í\8bt\97§\82Á\82½\81D",
238                           body_part(HEAD), body_part(HAIR));
239 #endif
240                     break;
241                 }
242                 return;
243             }
244         }
245     }
246     if (level.flags.has_barracks && !rn2(200)) {
247         static const char *const barracks_msg[4] = {
248 #if 0 /*JP*/
249             "blades being honed.", "loud snoring.", "dice being thrown.",
250             "General MacArthur!",
251 #else
252             "\90n\95¨\82ð\8c¤\82®\89¹\82ð\95·\82¢\82½\81D",
253             "\91å\82«\82È\82¢\82Ñ\82«\82ð\95·\82¢\82½\81D",
254             "\83_\83C\83X\82ª\90U\82ç\82ê\82é\89¹\82ð\95·\82¢\82½\81D",
255             "\83}\83b\83J\81[\83T\81[\8f«\8cR\82Ì\90º\82ð\95·\82¢\82½\81I",
256 #endif
257         };
258         int count = 0;
259
260         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
261             if (DEADMONSTER(mtmp))
262                 continue;
263             if (is_mercenary(mtmp->data)
264 #if 0 /* don't bother excluding these */
265                 && !strstri(mtmp->data->mname, "watch")
266                 && !strstri(mtmp->data->mname, "guard")
267 #endif
268                 && mon_in_room(mtmp, BARRACKS)
269                 /* sleeping implies not-yet-disturbed (usually) */
270                 && (mtmp->msleeping || ++count > 5)) {
271                 You_hear1(barracks_msg[rn2(3) + hallu]);
272                 return;
273             }
274         }
275     }
276     if (level.flags.has_zoo && !rn2(200)) {
277         static const char *const zoo_msg[3] = {
278 #if 0 /*JP*/
279             "a sound reminiscent of an elephant stepping on a peanut.",
280             "a sound reminiscent of a seal barking.", "Doctor Dolittle!",
281 #else
282             "\8fÛ\82ª\83s\81[\83i\83b\83c\82Ì\8fã\82Å\97x\82é\82æ\82¤\82È\89¹\82ð\95·\82¢\82½\81D",
283             "\83A\83V\83J\82ª\96i\82¦\82é\82æ\82¤\82È\89¹\82ð\95·\82¢\82½\81D",
284             "\83h\83\8a\83g\83\8b\90æ\90\82Ì\90º\82ð\95·\82¢\82½\81I",
285 #endif
286         };
287         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
288             if (DEADMONSTER(mtmp))
289                 continue;
290             if ((mtmp->msleeping || is_animal(mtmp->data))
291                 && mon_in_room(mtmp, ZOO)) {
292                 You_hear1(zoo_msg[rn2(2) + hallu]);
293                 return;
294             }
295         }
296     }
297     if (level.flags.has_shop && !rn2(200)) {
298         if (!(sroom = search_special(ANY_SHOP))) {
299             /* strange... */
300             level.flags.has_shop = 0;
301             return;
302         }
303         if (tended_shop(sroom)
304             && !index(u.ushops, (int) (ROOM_INDEX(sroom) + ROOMOFFSET))) {
305             static const char *const shop_msg[3] = {
306 #if 0 /*JP*/
307                 "someone cursing shoplifters.",
308                 "the chime of a cash register.", "Neiman and Marcus arguing!",
309 #else
310                 "\92N\82©\82ª\93D\96_\82ð\82Ì\82Ì\82µ\82é\90º\82ð\95·\82¢\82½\81D",
311                 "\83\8c\83W\82Ì\83`\81[\83\93\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D",
312                 "\83C\83g\81[\82Æ\83\88\81[\83J\83h\81[\82Ì\8bc\98_\82ð\95·\82¢\82½\81I",
313 #endif
314             };
315             You_hear1(shop_msg[rn2(2) + hallu]);
316         }
317         return;
318     }
319     if (level.flags.has_temple && !rn2(200)
320         && !(Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) {
321         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
322             if (DEADMONSTER(mtmp))
323                 continue;
324             if (mtmp->ispriest && inhistemple(mtmp)
325                 /* priest must be active */
326                 && mtmp->mcanmove && !mtmp->msleeping
327                 /* hero must be outside this temple */
328                 && temple_occupied(u.urooms) != EPRI(mtmp)->shroom)
329                 break;
330         }
331         if (mtmp) {
332             /* Generic temple messages; no attempt to match topic or tone
333                to the pantheon involved, let alone to the specific deity.
334                These are assumed to be coming from the attending priest;
335                asterisk means that the priest must be capable of speech;
336                pound sign (octathorpe,&c--don't go there) means that the
337                priest and the altar must not be directly visible (we don't
338                care if telepathy or extended detection reveals that the
339                priest is not currently standing on the altar; he's mobile). */
340             static const char *const temple_msg[] = {
341 #if 0 /*JP*/
342                 "*someone praising %s.", "*someone beseeching %s.",
343                 "#an animal carcass being offered in sacrifice.",
344                 "*a strident plea for donations.",
345 #else
346                 "*\92N\82©\82ª%s\82ð\8e^\94ü\82µ\82Ä\82¢\82é\82Ì\82ð\95·\82¢\82½\81D",
347                 "*\92N\82©\82ª%s\82ð\94M\96]\82µ\82Ä\82¢\82é\82Ì\82ð\95·\82¢\82½\81D",
348                 "#\93®\95¨\82Ì\8e\80\91Ì\82ð\90\82¯æÑ\82É\95ù\82°\82é\90º\82ð\95·\82¢\82½\81D",
349                 "*\8e·\9dX\82É\8añ\95t\82ð\97v\8b\81\82µ\82Ä\82¢\82é\82Ì\82ð\95·\82¢\82½\81D",
350 #endif
351             };
352             const char *msg;
353             int trycount = 0, ax = EPRI(mtmp)->shrpos.x,
354                 ay = EPRI(mtmp)->shrpos.y;
355             boolean speechless = (mtmp->data->msound <= MS_ANIMAL),
356                     in_sight = canseemon(mtmp) || cansee(ax, ay);
357
358             do {
359                 msg = temple_msg[rn2(SIZE(temple_msg) - 1 + hallu)];
360                 if (index(msg, '*') && speechless)
361                     continue;
362                 if (index(msg, '#') && in_sight)
363                     continue;
364                 break; /* msg is acceptable */
365             } while (++trycount < 50);
366             while (!letter(*msg))
367                 ++msg; /* skip control flags */
368             if (index(msg, '%'))
369                 You_hear(msg, halu_gname(EPRI(mtmp)->shralign));
370             else
371                 You_hear1(msg);
372             return;
373         }
374     }
375     if (Is_oracle_level(&u.uz) && !rn2(400)) {
376         /* make sure the Oracle is still here */
377         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
378             if (DEADMONSTER(mtmp))
379                 continue;
380             if (mtmp->data == &mons[PM_ORACLE])
381                 break;
382         }
383         /* and don't produce silly effects when she's clearly visible */
384         if (mtmp && (hallu || !canseemon(mtmp))) {
385             static const char *const ora_msg[5] = {
386 #if 0 /*JP*/
387                 "a strange wind.",     /* Jupiter at Dodona */
388                 "convulsive ravings.", /* Apollo at Delphi */
389                 "snoring snakes.",     /* AEsculapius at Epidaurus */
390                 "someone say \"No more woodchucks!\"",
391                 "a loud ZOT!" /* both rec.humor.oracle */
392 #else
393                 "\8aï\96­\82È\95\97\82Ì\89¹\82ð\95·\82¢\82½\81D",
394                 "\94¼\8b\97\90\82Ì\90º\82ð\95·\82¢\82½\81D",
395                 "\8eÖ\82Ì\82¢\82Ñ\82«\82ð\95·\82¢\82½\81D",
396                 "\92N\82©\82ª\81u\82à\82¤\83E\83b\83h\83`\83\83\83b\83N\82Í\82¢\82ç\82È\82¢\81I\81v\82Æ\8c¾\82Á\82Ä\82¢\82é\90º\82ð\95·\82¢\82½\81D",
397                 "\91å\82«\82È\82y\82n\82s\82ð\95·\82¢\82½\81I"
398 #endif
399             };
400             You_hear1(ora_msg[rn2(3) + hallu * 2]);
401         }
402         return;
403     }
404 }
405
406 static const char *const h_sounds[] = {
407 #if 0 /*JP*/
408     "beep",   "boing",   "sing",   "belche", "creak",   "cough",
409     "rattle", "ululate", "pop",    "jingle", "sniffle", "tinkle",
410     "eep",    "clatter", "hum",    "sizzle", "twitter", "wheeze",
411     "rustle", "honk",    "lisp",   "yodel",  "coo",     "burp",
412     "moo",    "boom",    "murmur", "oink",   "quack",   "rumble",
413     "twang",  "bellow",  "toot",   "gargle", "hoot",    "warble"
414 #else
415     "\83s\81[\83b\82Æ\96Â\82¢\82½",
416     "\91\9b\82¬\82½\82Ä\82½",
417     "\89Ì\82Á\82½",
418     "\82°\82Á\82Õ\82ð\82µ\82½",
419     "\83L\81[\83L\81[\82Æ\96Â\82¢\82½",
420     "\82¹\82«\8d\9e\82ñ\82¾",
421
422     "\83S\83\8d\83S\83\8d\96Â\82Á\82½",
423     "\83z\81[\83z\81[\96Â\82¢\82½",
424     "\83|\83\93\82Æ\96Â\82¢\82½",
425     "\83K\83\89\83\93\83K\83\89\83\93\82Æ\96Â\82¢\82½",
426     "\83N\83\93\83N\83\93\96Â\82¢\82½",
427     "\83`\83\8a\83\93\83`\83\8a\83\93\82Æ\96Â\82¢\82½",
428
429     "\83C\81[\83b\82Æ\96Â\82¢\82½",
430     /*JP \8ec\82è\82Í\96¢\96ó */
431 #endif
432 };
433
434 const char *
435 growl_sound(mtmp)
436 register struct monst *mtmp;
437 {
438     const char *ret;
439
440     switch (mtmp->data->msound) {
441     case MS_MEW:
442     case MS_HISS:
443 /*JP
444         ret = "hiss";
445 */
446             ret = "\83V\81[\83b\82Æ\96Â\82¢\82½";
447         break;
448     case MS_BARK:
449     case MS_GROWL:
450 /*JP
451         ret = "growl";
452 */
453             ret = "\82Í\82°\82µ\82­\96i\82¦\82½";
454         break;
455     case MS_ROAR:
456 /*JP
457         ret = "roar";
458 */
459             ret = "\96i\82¦\82½";
460         break;
461     case MS_BUZZ:
462 /*JP
463         ret = "buzz";
464 */
465             ret = "\83u\81[\83b\82Æ\96Â\82¢\82½";
466         break;
467     case MS_SQEEK:
468 /*JP
469         ret = "squeal";
470 */
471             ret = "\83L\81[\83L\81[\96Â\82¢\82½";
472         break;
473     case MS_SQAWK:
474 /*JP
475         ret = "screech";
476 */
477             ret = "\8bà\90Ø\82è\90º\82ð\97§\82Ä\82½";
478         break;
479     case MS_NEIGH:
480 /*JP
481         ret = "neigh";
482 */
483             ret = "\82¢\82È\82È\82¢\82½";
484         break;
485     case MS_WAIL:
486 /*JP
487         ret = "wail";
488 */
489             ret = "\94ß\82µ\82­\96Â\82¢\82½";
490         break;
491     case MS_SILENT:
492 /*JP
493         ret = "commotion";
494 */
495                 ret = "\8b»\95±\82µ\82½";
496         break;
497     default:
498 /*JP
499         ret = "scream";
500 */
501                 ret = "\8bà\90Ø\82è\90º\82ð\82 \82°\82½";
502     }
503     return ret;
504 }
505
506 /* the sounds of a seriously abused pet, including player attacking it */
507 void
508 growl(mtmp)
509 register struct monst *mtmp;
510 {
511     register const char *growl_verb = 0;
512
513     if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
514         return;
515
516     /* presumably nearness and soundok checks have already been made */
517     if (Hallucination)
518         growl_verb = h_sounds[rn2(SIZE(h_sounds))];
519     else
520         growl_verb = growl_sound(mtmp);
521     if (growl_verb) {
522 /*JP
523         pline("%s %s!", Monnam(mtmp), vtense((char *) 0, growl_verb));
524 */
525         pline("%s\82Í%s\81I", Monnam(mtmp), growl_verb);
526         if (context.run)
527             nomul(0);
528         wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 18);
529     }
530 }
531
532 /* the sounds of mistreated pets */
533 void
534 yelp(mtmp)
535 register struct monst *mtmp;
536 {
537     register const char *yelp_verb = 0;
538
539     if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
540         return;
541
542     /* presumably nearness and soundok checks have already been made */
543     if (Hallucination)
544         yelp_verb = h_sounds[rn2(SIZE(h_sounds))];
545     else
546         switch (mtmp->data->msound) {
547         case MS_MEW:
548 /*JP
549             yelp_verb = "yowl";
550 */
551             yelp_verb = "\94ß\82µ\82­\96Â\82¢\82½";
552             break;
553         case MS_BARK:
554         case MS_GROWL:
555 /*JP
556             yelp_verb = "yelp";
557 */
558             yelp_verb = "\83L\83\83\83\93\83L\83\83\83\93\96Â\82¢\82½";
559             break;
560         case MS_ROAR:
561 /*JP
562             yelp_verb = "snarl";
563 */
564             yelp_verb = "\82¤\82È\82Á\82½";
565             break;
566         case MS_SQEEK:
567 /*JP
568             yelp_verb = "squeal";
569 */
570             yelp_verb = "\83L\81[\83L\81[\96Â\82¢\82½";
571             break;
572         case MS_SQAWK:
573 /*JP
574             yelp_verb = "screak";
575 */
576             yelp_verb = "\8bà\90Ø\82è\90º\82ð\97§\82Ä\82½";
577             break;
578         case MS_WAIL:
579 /*JP
580             yelp_verb = "wail";
581 */
582             yelp_verb = "\94ß\82µ\82­\96Â\82¢\82½";
583             break;
584         }
585     if (yelp_verb) {
586 /*JP
587         pline("%s %s!", Monnam(mtmp), vtense((char *) 0, yelp_verb));
588 */
589         pline("%s\82Í%s\81I", Monnam(mtmp), yelp_verb);
590         if (context.run)
591             nomul(0);
592         wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 12);
593     }
594 }
595
596 /* the sounds of distressed pets */
597 void
598 whimper(mtmp)
599 register struct monst *mtmp;
600 {
601     register const char *whimper_verb = 0;
602
603     if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
604         return;
605
606     /* presumably nearness and soundok checks have already been made */
607     if (Hallucination)
608         whimper_verb = h_sounds[rn2(SIZE(h_sounds))];
609     else
610         switch (mtmp->data->msound) {
611         case MS_MEW:
612         case MS_GROWL:
613 /*JP
614             whimper_verb = "whimper";
615 */
616             whimper_verb = "\83N\83\93\83N\83\93\96Â\82¢\82½";
617             break;
618         case MS_BARK:
619 /*JP
620             whimper_verb = "whine";
621 */
622             whimper_verb = "\83N\81[\83\93\82Æ\96Â\82¢\82½";
623             break;
624         case MS_SQEEK:
625 /*JP
626             whimper_verb = "squeal";
627 */
628             whimper_verb = "\83L\81[\83L\81[\96Â\82¢\82½";
629             break;
630         }
631     if (whimper_verb) {
632 /*JP
633         pline("%s %s.", Monnam(mtmp), vtense((char *) 0, whimper_verb));
634 */
635         pline("%s\82Í%s\81D", Monnam(mtmp), whimper_verb);
636         if (context.run)
637             nomul(0);
638         wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6);
639     }
640 }
641
642 /* pet makes "I'm hungry" noises */
643 void
644 beg(mtmp)
645 register struct monst *mtmp;
646 {
647     if (mtmp->msleeping || !mtmp->mcanmove
648         || !(carnivorous(mtmp->data) || herbivorous(mtmp->data)))
649         return;
650
651     /* presumably nearness and soundok checks have already been made */
652     if (!is_silent(mtmp->data) && mtmp->data->msound <= MS_ANIMAL)
653         (void) domonnoise(mtmp);
654     else if (mtmp->data->msound >= MS_HUMANOID) {
655         if (!canspotmon(mtmp))
656             map_invisible(mtmp->mx, mtmp->my);
657 /*JP
658         verbalize("I'm hungry.");
659 */
660         verbalize("\82Í\82ç\82Ø\82±\82¾\81D");
661     }
662 }
663
664 /* return True if mon is a gecko or seems to look like one (hallucination) */
665 STATIC_OVL boolean
666 mon_is_gecko(mon)
667 struct monst *mon;
668 {
669     int glyph;
670
671     /* return True if it is actually a gecko */
672     if (mon->data == &mons[PM_GECKO])
673         return TRUE;
674     /* return False if it is a long worm; we might be chatting to its tail
675        (not strictly needed; long worms are MS_SILENT so won't get here) */
676     if (mon->data == &mons[PM_LONG_WORM])
677         return FALSE;
678     /* result depends upon whether map spot shows a gecko, which will
679        be due to hallucination or to mimickery since mon isn't one */
680     glyph = glyph_at(mon->mx, mon->my);
681     return (boolean) (glyph_to_mon(glyph) == PM_GECKO);
682 }
683
684 STATIC_OVL int
685 domonnoise(mtmp)
686 register struct monst *mtmp;
687 {
688     char verbuf[BUFSZ];
689     register const char *pline_msg = 0, /* Monnam(mtmp) will be prepended */
690         *verbl_msg = 0,                 /* verbalize() */
691             *verbl_msg_mcan = 0;        /* verbalize() if cancelled */
692     struct permonst *ptr = mtmp->data;
693     int msound = ptr->msound;
694
695     /* presumably nearness and sleep checks have already been made */
696     if (Deaf)
697         return 0;
698     if (is_silent(ptr))
699         return 0;
700
701     /* leader might be poly'd; if he can still speak, give leader speech */
702     if (mtmp->m_id == quest_status.leader_m_id && msound > MS_ANIMAL)
703         msound = MS_LEADER;
704     /* make sure it's your role's quest guardian; adjust if not */
705     else if (msound == MS_GUARDIAN && ptr != &mons[urole.guardnum])
706         msound = mons[genus(monsndx(ptr), 1)].msound;
707     /* some normally non-speaking types can/will speak if hero is similar */
708     else if (msound == MS_ORC         /* note: MS_ORC is same as MS_GRUNT */
709              && (same_race(ptr, youmonst.data)           /* current form, */
710                  || same_race(ptr, &mons[Race_switch]))) /* unpoly'd form */
711         msound = MS_HUMANOID;
712     /* silliness, with slight chance to interfere with shopping */
713     else if (Hallucination && mon_is_gecko(mtmp))
714         msound = MS_SELL;
715
716     /* be sure to do this before talking; the monster might teleport away, in
717      * which case we want to check its pre-teleport position
718      */
719     if (!canspotmon(mtmp))
720         map_invisible(mtmp->mx, mtmp->my);
721
722     switch (msound) {
723     case MS_ORACLE:
724         return doconsult(mtmp);
725     case MS_PRIEST:
726         priest_talk(mtmp);
727         break;
728     case MS_LEADER:
729     case MS_NEMESIS:
730     case MS_GUARDIAN:
731         quest_chat(mtmp);
732         break;
733     case MS_SELL: /* pitch, pay, total */
734         if (!Hallucination || (mtmp->isshk && !rn2(2))) {
735             shk_chat(mtmp);
736         } else {
737             /* approximation of GEICO's advertising slogan (it actually
738                concludes with "save you 15% or more on car insurance.") */
739 /*JP
740             Sprintf(verbuf, "15 minutes could save you 15 %s.",
741 */
742             Sprintf(verbuf, "15\95ª\92¸\82¯\82ê\82Î15%s\90ß\96ñ\82Å\82«\82Ü\82·\81D",
743                     currency(15L)); /* "zorkmids" */
744             verbl_msg = verbuf;
745         }
746         break;
747     case MS_VAMPIRE: {
748         /* vampire messages are varied by tameness, peacefulness, and time of
749          * night */
750         boolean isnight = night();
751         boolean kindred = (Upolyd && (u.umonnum == PM_VAMPIRE
752                                       || u.umonnum == PM_VAMPIRE_LORD));
753         boolean nightchild =
754             (Upolyd && (u.umonnum == PM_WOLF || u.umonnum == PM_WINTER_WOLF
755                         || u.umonnum == PM_WINTER_WOLF_CUB));
756 #if 0 /*JP*/
757         const char *racenoun =
758             (flags.female && urace.individual.f)
759                 ? urace.individual.f
760                 : (urace.individual.m) ? urace.individual.m : urace.noun;
761 #else
762         const char *racenoun = (flags.female) ? "\82 \82È\82½" : "\82¨\82Ü\82¦" ;
763 #endif
764
765         if (mtmp->mtame) {
766             if (kindred) {
767 #if 0 /*JP*/
768                 Sprintf(verbuf, "Good %s to you Master%s",
769                         isnight ? "evening" : "day",
770                         isnight ? "!" : ".  Why do we not rest?");
771 #else
772                 Sprintf(verbuf, "\82²\8eå\90l\97l\81C%s%s",
773                         isnight ? "\82±\82ñ\82Î\82ñ\82Í" : "\82±\82ñ\82É\82¿\82Í",
774                         isnight ? "!" : "\81D\82¨\8bx\82Ý\82É\82È\82è\82Ü\82¹\82ñ\82©\81H");
775 #endif
776                 verbl_msg = verbuf;
777             } else {
778 #if 0 /*JP*/
779                 Sprintf(verbuf, "%s%s",
780                         nightchild ? "Child of the night, " : "",
781                         midnight()
782                          ? "I can stand this craving no longer!"
783                          : isnight
784                           ? "I beg you, help me satisfy this growing craving!"
785                           : "I find myself growing a little weary.");
786 #else
787                 Sprintf(verbuf,"%s%s",
788                         nightchild ? "\96é\82Ì\8ee\82æ\81C" : "",
789                         midnight()
790                         ? "\8e\84\82Í\82±\82ê\88È\8fã\8a\89\96]\82ð\97}\82¦\82ç\82ê\82È\82¢\81I"
791                         : isnight
792                          ? "\82Ó\82­\82ê\82 \82ª\82é\8a\89\96]\82ð\96\9e\82½\82·\82Ì\82ð\8f\95\82¯\82Ä\82­\82ê\82È\82¢\82©\81H\97\8a\82Þ\81I"
793                          : "\8e\84\82Í\8f­\81X\94æ\82ê\82½\82æ\82¤\82¾\81D");
794 #endif
795                 verbl_msg = verbuf;
796             }
797         } else if (mtmp->mpeaceful) {
798             if (kindred && isnight) {
799 #if 0 /*JP*/
800                 Sprintf(verbuf, "Good feeding %s!",
801                         flags.female ? "sister" : "brother");
802 #else
803                 Sprintf(verbuf, "\82æ\82¤\8cZ\92í\81I");
804 #endif
805                 verbl_msg = verbuf;
806             } else if (nightchild && isnight) {
807 /*JP
808                 Sprintf(verbuf, "How nice to hear you, child of the night!");
809 */
810                 Sprintf(verbuf, "\96é\82Ì\8ee\82æ\81C\8c³\8bC\82»\82¤\82¾\82È\81I");
811                 verbl_msg = verbuf;
812             } else
813 /*JP
814                 verbl_msg = "I only drink... potions.";
815 */
816                 verbl_msg = "\8e\84\82Í\96ò\81D\81D\82µ\82©\88ù\82Ü\82È\82¢\81D";
817         } else {
818             int vampindex;
819             static const char *const vampmsg[] = {
820                 /* These first two (0 and 1) are specially handled below */
821 /*JP
822                 "I vant to suck your %s!",
823 */
824                 "\82¨\91O\82Ì%s\82ð\82æ\82±\82¹\81I",
825 /*JP
826                 "I vill come after %s without regret!",
827 */
828                 "\91\95ª\82É%s\82ð\92Ç\8c\82\82³\82¹\82Ä\82à\82ç\82¨\82¤\81I",
829                 /* other famous vampire quotes can follow here if desired */
830             };
831             if (kindred)
832                 verbl_msg =
833 /*JP
834                     "This is my hunting ground that you dare to prowl!";
835 */
836                     "\82¨\82Ü\82¦\82ª\82¤\82ë\82Â\82¢\82Ä\82¢\82é\82±\82Ì\82 \82½\82è\82Í\8e\84\82Ì\8eë\8fê\82¾\81I";
837             else if (youmonst.data == &mons[PM_SILVER_DRAGON]
838                      || youmonst.data == &mons[PM_BABY_SILVER_DRAGON]) {
839                 /* Silver dragons are silver in color, not made of silver */
840 #if 0 /*JP*/
841                 Sprintf(verbuf, "%s! Your silver sheen does not frighten me!",
842                         youmonst.data == &mons[PM_SILVER_DRAGON]
843                             ? "Fool"
844                             : "Young Fool");
845                 verbl_msg = verbuf;
846 #else
847                 verbl_msg = "\82Î\82©\82ß\81I\82¨\82Ü\82¦\82Ì\8bâ\82Ì\8bP\82«\82È\82Ç\95|\82­\82È\82¢\82¼\81I";
848 #endif
849             } else {
850                 vampindex = rn2(SIZE(vampmsg));
851                 if (vampindex == 0) {
852                     Sprintf(verbuf, vampmsg[vampindex], body_part(BLOOD));
853                     verbl_msg = verbuf;
854                 } else if (vampindex == 1) {
855                     Sprintf(verbuf, vampmsg[vampindex],
856                             Upolyd ? an(mons[u.umonnum].mname)
857                                    : an(racenoun));
858                     verbl_msg = verbuf;
859                 } else
860                     verbl_msg = vampmsg[vampindex];
861             }
862         }
863     } break;
864     case MS_WERE:
865         if (flags.moonphase == FULL_MOON && (night() ^ !rn2(13))) {
866 #if 0 /*JP*/
867             pline("%s throws back %s head and lets out a blood curdling %s!",
868                   Monnam(mtmp), mhis(mtmp),
869                   ptr == &mons[PM_HUMAN_WERERAT] ? "shriek" : "howl");
870 #else
871             pline("%s\82Í\93ª\82ð\82Ì\82¯\82¼\82ç\82µ\94w\8bØ\82ª\93\80\82é\82æ\82¤\82È%s\82ð\82 \82°\82½\81I",
872                   Monnam(mtmp),
873                   ptr == &mons[PM_HUMAN_WERERAT] ? "\8bà\90Ø\82è\90º" : "\99ô\9aK");
874 #endif
875             wake_nearto(mtmp->mx, mtmp->my, 11 * 11);
876         } else
877             pline_msg =
878 /*JP
879                 "whispers inaudibly.  All you can make out is \"moon\".";
880 */
881                 "\95·\82«\82Æ\82ê\82È\82¢\82æ\82¤\82È\90º\82Å\82³\82³\82â\82¢\82½\81D\82©\82ë\82¤\82\82Ä\81w\8c\8e\81x\82Æ\82¢\82¤\8c¾\97t\82¾\82¯\82ª\95·\82«\82Æ\82ê\82½\81D";
882         break;
883     case MS_BARK:
884         if (flags.moonphase == FULL_MOON && night()) {
885 /*JP
886             pline_msg = "howls.";
887 */
888             pline_msg = "\96i\82¦\82½\81D";
889         } else if (mtmp->mpeaceful) {
890             if (mtmp->mtame
891                 && (mtmp->mconf || mtmp->mflee || mtmp->mtrapped
892                     || moves > EDOG(mtmp)->hungrytime || mtmp->mtame < 5))
893 /*JP
894                 pline_msg = "whines.";
895 */
896                 pline_msg = "\83N\83\93\83N\83\93\96Â\82¢\82½\81D";
897             else if (mtmp->mtame && EDOG(mtmp)->hungrytime > moves + 1000)
898 /*JP
899                 pline_msg = "yips.";
900 */
901                 pline_msg = "\83L\83\83\83\93\83L\83\83\83\93\96Â\82¢\82½\81D";
902             else {
903                 if (mtmp->data
904                     != &mons[PM_DINGO]) /* dingos do not actually bark */
905 /*JP
906                     pline_msg = "barks.";
907 */
908                     pline_msg = "\83\8f\83\93\83\8f\83\93\96i\82¦\82½\81D";
909             }
910         } else {
911 /*JP
912             pline_msg = "growls.";
913 */
914             pline_msg = "\82¤\82È\82Á\82½\81D";
915         }
916         break;
917     case MS_MEW:
918         if (mtmp->mtame) {
919             if (mtmp->mconf || mtmp->mflee || mtmp->mtrapped
920                 || mtmp->mtame < 5)
921 /*JP
922                 pline_msg = "yowls.";
923 */
924                 pline_msg = "\94ß\82µ\82­\96Â\82¢\82½\81D";
925             else if (moves > EDOG(mtmp)->hungrytime)
926 /*JP
927                 pline_msg = "meows.";
928 */
929                 pline_msg = "\83j\83\83\81[\83\93\82Æ\96Â\82¢\82½\81D";
930             else if (EDOG(mtmp)->hungrytime > moves + 1000)
931 /*JP
932                 pline_msg = "purrs.";
933 */
934                 pline_msg = "\83S\83\8d\83S\83\8d\82Æ\96Â\82¢\82½\81D";
935             else
936 /*JP
937                 pline_msg = "mews.";
938 */
939                 pline_msg = "\83j\83\83\81[\83j\83\83\81[\96Â\82¢\82½\81D";
940             break;
941         } /* else FALLTHRU */
942     case MS_GROWL:
943 /*JP
944         pline_msg = mtmp->mpeaceful ? "snarls." : "growls!";
945 */
946         pline_msg = mtmp->mpeaceful ? "\82¤\82È\82Á\82½\81D" : "\8c\83\82µ\82­\82¤\82È\82Á\82½\81I";
947         break;
948     case MS_ROAR:
949 /*JP
950         pline_msg = mtmp->mpeaceful ? "snarls." : "roars!";
951 */
952         pline_msg = mtmp->mpeaceful ? "\82¤\82È\82Á\82½\81D" : "\82Æ\82Ä\82à\8c\83\82µ\82­\96i\82¦\82½\81I";
953         break;
954     case MS_SQEEK:
955 /*JP
956         pline_msg = "squeaks.";
957 */
958         pline_msg = "\83L\81[\83L\81[\96Â\82¢\82½\81D";
959         break;
960     case MS_SQAWK:
961         if (ptr == &mons[PM_RAVEN] && !mtmp->mpeaceful)
962 /*JP
963             verbl_msg = "Nevermore!";
964 */
965             verbl_msg = "\81u\82à\82¤\93ñ\93x\82Æ\81I\81v";
966         else
967 /*JP
968             pline_msg = "squawks.";
969 */
970             pline_msg = "\83L\81[\83L\81[\96Â\82¢\82½\81D";
971         break;
972     case MS_HISS:
973         if (!mtmp->mpeaceful)
974 /*JP
975             pline_msg = "hisses!";
976 */
977             pline_msg = "\83V\81[\83b\82Æ\96Â\82¢\82½\81I";
978         else
979             return 0; /* no sound */
980         break;
981     case MS_BUZZ:
982 /*JP
983         pline_msg = mtmp->mpeaceful ? "drones." : "buzzes angrily.";
984 */
985         pline_msg = mtmp->mpeaceful ? "\82Ô\81[\82ñ\82Æ\96Â\82Á\82½\81D" : "\82Ô\82ñ\82Ô\82ñ\96Â\82Á\82½\81D";
986         break;
987     case MS_GRUNT:
988 /*JP
989         pline_msg = "grunts.";
990 */
991         pline_msg = "\82Ô\81[\82Ô\81[\96Â\82¢\82½\81D";
992         break;
993     case MS_NEIGH:
994         if (mtmp->mtame < 5)
995 /*JP
996             pline_msg = "neighs.";
997 */
998             pline_msg = "\82¢\82È\82È\82¢\82½\81D";
999         else if (moves > EDOG(mtmp)->hungrytime)
1000 /*JP
1001             pline_msg = "whinnies.";
1002 */
1003             pline_msg = "\83q\83q\81[\83\93\82Æ\96Â\82¢\82½\81D";
1004         else
1005 /*JP
1006             pline_msg = "whickers.";
1007 */
1008             pline_msg = "\83q\83q\83q\81[\83\93\82Æ\96Â\82¢\82½\81D";
1009         break;
1010     case MS_WAIL:
1011 /*JP
1012         pline_msg = "wails mournfully.";
1013 */
1014         pline_msg = "\94ß\82µ\82°\82É\96Â\82¢\82½\81D";
1015         break;
1016     case MS_GURGLE:
1017 /*JP
1018         pline_msg = "gurgles.";
1019 */
1020         pline_msg = "\82²\82ë\82²\82ë\8dA\82ð\96Â\82ç\82µ\82½\81D";
1021         break;
1022     case MS_BURBLE:
1023 /*JP
1024         pline_msg = "burbles.";
1025 */
1026         pline_msg = "\82Ø\82¿\82á\82­\82¿\82á\82µ\82á\82×\82Á\82½\81D";
1027         break;
1028     case MS_SHRIEK:
1029 /*JP
1030         pline_msg = "shrieks.";
1031 */
1032         pline_msg = "\8bà\90Ø\82è\90º\82ð\82 \82°\82½\81D";
1033         aggravate();
1034         break;
1035     case MS_IMITATE:
1036 /*JP
1037         pline_msg = "imitates you.";
1038 */
1039         pline_msg = "\82 \82È\82½\82Ì\90^\8e\97\82ð\82µ\82½\81D";
1040         break;
1041     case MS_BONES:
1042 /*JP
1043         pline("%s rattles noisily.", Monnam(mtmp));
1044 */
1045         pline("%s\82Í\83P\83^\83P\83^\82Æ\8fÎ\82¢\82¾\82µ\82½\81D",Monnam(mtmp));
1046 /*JP
1047         You("freeze for a moment.");
1048 */
1049         You("\88ê\8fu\93\80\82è\82Â\82¢\82½\81D");
1050         nomul(-2);
1051         multi_reason = "scared by rattling";
1052         nomovemsg = 0;
1053         break;
1054     case MS_LAUGH: {
1055         static const char *const laugh_msg[4] = {
1056 /*JP
1057             "giggles.", "chuckles.", "snickers.", "laughs.",
1058 */
1059             "\82­\82·\82­\82·\8fÎ\82Á\82½\81D", "\82­\82·\82Á\82Æ\8fÎ\82Á\82½\81D", "\82Î\82©\82É\82µ\82½\82æ\82¤\82É\8fÎ\82Á\82½\81D", "\8fÎ\82Á\82½\81D",
1060         };
1061         pline_msg = laugh_msg[rn2(4)];
1062     } break;
1063     case MS_MUMBLE:
1064 /*JP
1065         pline_msg = "mumbles incomprehensibly.";
1066 */
1067         pline_msg = "\95s\89Â\89ð\82È\8c¾\97t\82ð\82Â\82Ô\82â\82¢\82½\81D";
1068         break;
1069     case MS_DJINNI:
1070         if (mtmp->mtame) {
1071 /*JP
1072             verbl_msg = "Sorry, I'm all out of wishes.";
1073 */
1074             verbl_msg = "\8e\84\82ð\8f\95\82¯\82Ä\82­\82ê\82½\82±\82Æ\82ð\8a´\8eÓ\82·\82é\81I";
1075         } else if (mtmp->mpeaceful) {
1076             if (ptr == &mons[PM_WATER_DEMON])
1077 /*JP
1078                 pline_msg = "gurgles.";
1079 */
1080                 pline_msg = "\83S\83{\83S\83{\83S\83{\83S\83{\81D";
1081             else
1082 /*JP
1083                 verbl_msg = "I'm free!";
1084 */
1085                     verbl_msg = "\82â\82Á\82Æ\8e©\97R\82É\82È\82Á\82½\81I";
1086         } else {
1087             if (ptr != &mons[PM_PRISONER])
1088 /*JP
1089                 verbl_msg = "This will teach you not to disturb me!";
1090 */
1091                 verbl_msg = "\82\82á\82Ü\82ð\82µ\82È\82¢\82Å\82­\82ê\81I";
1092 #if 0
1093             else
1094                 verbl_msg = "??????????";
1095 #endif
1096         }
1097         break;
1098     case MS_BOAST: /* giants */
1099         if (!mtmp->mpeaceful) {
1100             switch (rn2(4)) {
1101             case 0:
1102 #if 0 /*JP*/
1103                 pline("%s boasts about %s gem collection.", Monnam(mtmp),
1104                       mhis(mtmp));
1105 #else
1106                 pline("%s\82Í\8e©\95ª\82Ì\95ó\90Î\82Ì\83R\83\8c\83N\83V\83\87\83\93\82ð\8e©\96\9d\82µ\82½\81D", Monnam(mtmp));
1107 #endif
1108                 break;
1109             case 1:
1110 /*JP
1111                 pline_msg = "complains about a diet of mutton.";
1112 */
1113                 pline_msg = "\96\88\93ú\97r\82Î\82©\82è\90H\82×\82Ä\82¢\82é\8e\96\82ð\8bð\92s\82Á\82½\81D";
1114                 break;
1115             default:
1116 /*JP
1117                 pline_msg = "shouts \"Fee Fie Foe Foo!\" and guffaws.";
1118 */
1119                 pline_msg = "\81w\82í\82Á\82Í\82Á\82Í\82Á\82Í\81I\81x\82Æ\82Î\82©\8fÎ\82¢\82µ\82½\81D";
1120                 wake_nearto(mtmp->mx, mtmp->my, 7 * 7);
1121                 break;
1122             }
1123             break;
1124         }
1125     /* else FALLTHRU */
1126     case MS_HUMANOID:
1127         if (!mtmp->mpeaceful) {
1128             if (In_endgame(&u.uz) && is_mplayer(ptr))
1129                 mplayer_talk(mtmp);
1130             else
1131 /*JP
1132                 pline_msg = "threatens you.";
1133 */
1134                 pline_msg = "\82 \82È\82½\82ð\88Ð\8ad\82µ\82½\81D";
1135             break;
1136         }
1137         /* Generic peaceful humanoid behaviour. */
1138         if (mtmp->mflee)
1139 /*JP
1140             pline_msg = "wants nothing to do with you.";
1141 */
1142             pline_msg = "\82 \82È\82½\82Æ\8aÖ\82í\82è\82½\82­\82È\82¢\82æ\82¤\82¾\81D";
1143         else if (mtmp->mhp < mtmp->mhpmax / 4)
1144 /*JP
1145             pline_msg = "moans.";
1146 */
1147             pline_msg = "\82¤\82ß\82«\90º\82ð\82 \82°\82½\81D";
1148         else if (mtmp->mconf || mtmp->mstun)
1149 /*JP
1150             verbl_msg = !rn2(3) ? "Huh?" : rn2(2) ? "What?" : "Eh?";
1151 */
1152             verbl_msg = !rn2(3) ? "\82Ö\81H" : rn2(2) ? "\89½\81H" : "\82¦\81H";
1153         else if (!mtmp->mcansee)
1154 /*JP
1155             verbl_msg = "I can't see!";
1156 */
1157             verbl_msg = "\89½\82à\8c©\82¦\82È\82¢\81I";
1158         else if (mtmp->mtrapped) {
1159             struct trap *t = t_at(mtmp->mx, mtmp->my);
1160
1161             if (t)
1162                 t->tseen = 1;
1163 /*JP
1164             verbl_msg = "I'm trapped!";
1165 */
1166             verbl_msg = "ã©\82É\82Í\82Ü\82Á\82Ä\82µ\82Ü\82Á\82½\81I";
1167         } else if (mtmp->mhp < mtmp->mhpmax / 2)
1168 /*JP
1169             pline_msg = "asks for a potion of healing.";
1170 */
1171             pline_msg = "\89ñ\95\9c\82Ì\96ò\82ð\8e\9d\82Á\82Ä\82È\82¢\82©\90q\82Ë\82½\81D";
1172         else if (mtmp->mtame && !mtmp->isminion
1173                  && moves > EDOG(mtmp)->hungrytime)
1174 /*JP
1175             verbl_msg = "I'm hungry.";
1176 */
1177             verbl_msg = "\95 \82ª\8c¸\82Á\82½\82È\81D";
1178         /* Specific monsters' interests */
1179         else if (is_elf(ptr))
1180 /*JP
1181             pline_msg = "curses orcs.";
1182 */
1183             pline_msg = "\83I\81[\83N\82ð\8eô\82Á\82½\81D";
1184         else if (is_dwarf(ptr))
1185 /*JP
1186             pline_msg = "talks about mining.";
1187 */
1188             pline_msg = "\8dÌ\8c@\82É\82Â\82¢\82Ä\98b\82µ\82½\81D";
1189         else if (likes_magic(ptr))
1190 /*JP
1191             pline_msg = "talks about spellcraft.";
1192 */
1193             pline_msg = "\96\82\8fp\82Ì\92b\98B\82É\82Â\82¢\82Ä\98b\82µ\82½\81D";
1194         else if (ptr->mlet == S_CENTAUR)
1195 /*JP
1196             pline_msg = "discusses hunting.";
1197 */
1198             pline_msg = "\97Â\82É\82Â\82¢\82Ä\8bc\98_\82µ\82½\81D";
1199         else
1200             switch (monsndx(ptr)) {
1201             case PM_HOBBIT:
1202                 pline_msg =
1203                     (mtmp->mhpmax - mtmp->mhp >= 10)
1204 /*JP
1205                         ? "complains about unpleasant dungeon conditions."
1206 */
1207                         ? "\95s\96ù\89õ\82È\96À\8b{\82Ì\8fó\91Ô\82É\82Â\82¢\82Ä\95s\96\9e\82ð\8fq\82×\82½\81D"
1208 /*JP
1209                         : "asks you about the One Ring.";
1210 */
1211                         : "\81u\88ê\82Â\82Ì\8ew\97Ö\81v\82É\82Â\82¢\82Ä\90q\82Ë\82½\81D";
1212                 break;
1213             case PM_ARCHEOLOGIST:
1214                 pline_msg =
1215 /*JP
1216                 "describes a recent article in \"Spelunker Today\" magazine.";
1217 */
1218                 "\81u\93ú\8a§\93´\8cA\81v\82Ì\8dÅ\90V\82Ì\8bL\8e\96\82ð\8e·\95M\82µ\82Ä\82¢\82é\81D";
1219                 break;
1220             case PM_TOURIST:
1221 /*JP
1222                 verbl_msg = "Aloha.";
1223 */
1224                 verbl_msg = "\83A\83\8d\81[\83n\81D";
1225                 break;
1226             default:
1227 /*JP
1228                 pline_msg = "discusses dungeon exploration.";
1229 */
1230                 pline_msg = "\96À\8b{\92T\8c\9f\82É\82Â\82¢\82Ä\8bc\98_\82µ\82½\81D";
1231                 break;
1232             }
1233         break;
1234     case MS_SEDUCE: {
1235         int swval;
1236         if (SYSOPT_SEDUCE) {
1237             if (ptr->mlet != S_NYMPH
1238                 && could_seduce(mtmp, &youmonst, (struct attack *) 0) == 1) {
1239                 (void) doseduce(mtmp);
1240                 break;
1241             }
1242             swval = ((poly_gender() != (int) mtmp->female) ? rn2(3) : 0);
1243         } else
1244             swval = ((poly_gender() == 0) ? rn2(3) : 0);
1245         switch (swval) {
1246         case 2:
1247 #if 0 /*JP*/
1248             verbl_msg = "Hello, sailor.";
1249 #else
1250             switch (poly_gender()) {
1251               case 0:
1252                 verbl_msg = "\82±\82ñ\82É\82¿\82Í\81D\82 \82ç\82¢\82¢\92j\82Ë\81D";
1253                 break;
1254               case 1:
1255                 verbl_msg = "\82±\82ñ\82É\82¿\82Í\81C\82¨\8fì\82³\82ñ\81D";
1256                 break;
1257               default:
1258                 verbl_msg = "\82±\82ñ\82É\82¿\82Í\81D";
1259                 break;
1260             }
1261 #endif
1262             break;
1263         case 1:
1264 /*JP
1265             pline_msg = "comes on to you.";
1266 */
1267             pline_msg = "\82 \82È\82½\82Ì\82Ù\82¤\82Ö\82â\82Á\82Ä\82«\82½\81D";
1268             break;
1269         default:
1270 /*JP
1271             pline_msg = "cajoles you.";
1272 */
1273             pline_msg = "\82 \82È\82½\82ð\82¨\82¾\82Ä\82½\81D";
1274         }
1275     } break;
1276     case MS_ARREST:
1277         if (mtmp->mpeaceful)
1278 #if 0 /*JP*/
1279             verbalize("Just the facts, %s.", flags.female ? "Ma'am" : "Sir");
1280 #else
1281             verbalize("\8e\96\8eÀ\82¾\82¯\82ª\92m\82è\82½\82¢\82ñ\82Å\82·\82æ\81C%s\81D", flags.female ? "\89\9c\82³\82ñ" : "\92U\93ß");
1282 #endif
1283         else {
1284             static const char *const arrest_msg[3] = {
1285 #if 0 /*JP*/
1286                 "Anything you say can be used against you.",
1287                 "You're under arrest!", "Stop in the name of the Law!",
1288 #else
1289                 "\82¨\82Ü\82¦\82Ì\8c¾\82¤\82±\82Æ\82Í\82¨\82Ü\82¦\82É\82Æ\82Á\82Ä\95s\97\98\82È\8fØ\8b\92\82Æ\82È\82é\82±\82Æ\82ª\82 \82é\81I",
1290                 "\82¨\82Ü\82¦\82ð\91ß\95ß\82·\82é\81I",
1291                 "\96@\82Ì\96¼\82Ì\82à\82Æ\92¼\82¿\82É\92\86\8e~\82¹\82æ\81I",
1292 #endif
1293             };
1294             verbl_msg = arrest_msg[rn2(3)];
1295         }
1296         break;
1297     case MS_BRIBE:
1298         if (mtmp->mpeaceful && !mtmp->mtame) {
1299             (void) demon_talk(mtmp);
1300             break;
1301         }
1302     /* fall through */
1303     case MS_CUSS:
1304         if (!mtmp->mpeaceful)
1305             cuss(mtmp);
1306         else if (is_lminion(mtmp))
1307 /*JP
1308             verbl_msg = "It's not too late.";
1309 */
1310             verbl_msg = "\82Ü\82¾\92x\82­\82Í\82È\82¢\81D";
1311         else
1312 /*JP
1313             verbl_msg = "We're all doomed.";
1314 */
1315             verbl_msg = "\82Ý\82ñ\82È\82à\82¤\82¨\82µ\82Ü\82¢\82¾\81D";
1316         break;
1317     case MS_SPELL:
1318         /* deliberately vague, since it's not actually casting any spell */
1319 /*JP
1320         pline_msg = "seems to mutter a cantrip.";
1321 */
1322         pline_msg = "\82Ô\82Â\82Ô\82Â\82Æ\82Â\82Ô\82â\82¢\82Ä\82¢\82é\81D";
1323         break;
1324     case MS_NURSE:
1325 /*JP
1326         verbl_msg_mcan = "I hate this job!";
1327 */
1328         verbl_msg_mcan = "\82±\82ñ\82È\8ed\8e\96\8c\99\82¢\81I";
1329         if (uwep && (uwep->oclass == WEAPON_CLASS || is_weptool(uwep)))
1330 /*JP
1331             verbl_msg = "Put that weapon away before you hurt someone!";
1332 */
1333             verbl_msg = "\95\90\8aí\82ð\82¨\82³\82ß\82È\82³\82¢\81I\82»\82ê\82Í\90l\82ð\8f\9d\82Â\82¯\82é\82à\82Ì\82æ\81I";
1334         else if (uarmc || uarm || uarmh || uarms || uarmg || uarmf)
1335             verbl_msg = Role_if(PM_HEALER)
1336 /*JP
1337                             ? "Doc, I can't help you unless you cooperate."
1338 */
1339                             ? "\90æ\90\81C\82 \82È\82½\82Ì\8b¦\97Í\82È\82µ\82Å\82Í\82Ç\82¤\82µ\82æ\82¤\82à\82 \82è\82Ü\82¹\82ñ\82í\81D"
1340 /*JP
1341                             : "Please undress so I can examine you.";
1342 */
1343                             : "\95\9e\82ð\92E\82¢\82Å\82­\82¾\82³\82¢\81D\82 \82È\82½\82ð\90f\8e@\82µ\82Ü\82·\82í\81D";
1344         else if (uarmu)
1345 /*JP
1346             verbl_msg = "Take off your shirt, please.";
1347 */
1348             verbl_msg = "\83V\83\83\83c\82ð\92E\82¢\82Å\82­\82¾\82³\82¢\81D";
1349         else
1350 /*JP
1351             verbl_msg = "Relax, this won't hurt a bit.";
1352 */
1353             verbl_msg = "\82¨\82¿\82Â\82¢\82Ä\81D\82¿\82Á\82Æ\82à\92É\82­\82È\82¢\82í\82æ\81D";
1354         break;
1355     case MS_GUARD:
1356         if (money_cnt(invent))
1357 /*JP
1358             verbl_msg = "Please drop that gold and follow me.";
1359 */
1360             verbl_msg = "\8bà\82ð\92u\82¢\82Ä\82Â\82¢\82Ä\82«\82Ä\82­\82¾\82³\82¢\81D";
1361         else
1362 /*JP
1363             verbl_msg = "Please follow me.";
1364 */
1365             verbl_msg = "\82Â\82¢\82Ä\82«\82Ä\82­\82¾\82³\82¢\81D";
1366         break;
1367     case MS_SOLDIER: {
1368         static const char
1369             *const soldier_foe_msg[3] =
1370                 {
1371 #if 0 /*JP*/
1372                   "Resistance is useless!", "You're dog meat!", "Surrender!",
1373 #else
1374                     "\92ï\8dR\82µ\82Ä\82à\96³\91Ê\82¾\81I",
1375                     "\8c¢\82É\8bò\82í\82ê\82¿\82Ü\82¦\81I",
1376                     "\8d~\95\9a\82µ\82ë\81I",
1377 #endif
1378                 },
1379                    *const soldier_pax_msg[3] = {
1380 #if 0 /*JP*/
1381                        "What lousy pay we're getting here!",
1382                        "The food's not fit for Orcs!",
1383                        "My feet hurt, I've been on them all day!",
1384 #else
1385                        "\82È\82ñ\82Ä\8bà\95¥\82¢\82ª\88«\82¢\82ñ\82¾\81I",
1386                        "\82È\82ñ\82¾\82¢\81H\83I\81[\83N\82Å\82à\8bò\82¦\82Ë\82¥\82º\81I",
1387                        "\91«\82ð\89ö\89ä\82µ\82½\81C\82¸\82Á\82Æ\82±\82Ì\92²\8eq\82¾\81I",
1388 #endif
1389                    };
1390         verbl_msg = mtmp->mpeaceful ? soldier_pax_msg[rn2(3)]
1391                                     : soldier_foe_msg[rn2(3)];
1392         break;
1393     }
1394     case MS_RIDER:
1395         /* 3.6.0 tribute */
1396         if (ptr == &mons[PM_DEATH]
1397             && !context.tribute.Deathnotice && u_have_novel()) {
1398             struct obj *book = u_have_novel();
1399             const char *tribtitle = (char *)0;
1400
1401             if (book) {
1402                 int novelidx = book->novelidx;
1403
1404                 tribtitle = noveltitle(&novelidx);
1405             }
1406             if (tribtitle) {
1407 /*JP
1408                 Sprintf(verbuf, "Ah, so you have a copy of /%s/.", tribtitle);
1409 */
1410                 Sprintf(verbuf, "\82 \82 \81A/%s/\82ð\8e\9d\82Á\82Ä\82¢\82é\82Ì\82©\81D", tribtitle);
1411                 /* no Death featured in these two, so exclude them */
1412                 if (!(strcmpi(tribtitle, "Snuff") == 0
1413                       || strcmpi(tribtitle, "The Wee Free Men") == 0))
1414 /*JP
1415                     Strcat(verbuf, " I may have been misquoted there.");
1416 */
1417                     Strcat(verbuf, "\82±\82±\82Å\82Í\88ø\97p\82ª\8aÔ\88á\82Á\82Ä\82¢\82é\82©\82à\82µ\82ê\82È\82¢\81D");
1418                 verbl_msg = verbuf;
1419                 context.tribute.Deathnotice = 1;
1420             }
1421         } else if (ptr == &mons[PM_DEATH]
1422                    && !rn2(2) && Death_quote(verbuf, BUFSZ)) {
1423                 verbl_msg = verbuf;
1424         }
1425         /* end of tribute addition */
1426         else if (ptr == &mons[PM_DEATH] && !rn2(10))
1427 /*JP
1428             pline_msg = "is busy reading a copy of Sandman #8.";
1429 */
1430             pline_msg = "\81u\83T\83\93\83h\83}\83\93\81v\82Ì8\8aª\82ð\93Ç\82Þ\82Ì\82É\96Z\82µ\82¢\81D";
1431         else
1432 /*JP
1433             verbl_msg = "Who do you think you are, War?";
1434 */
1435             verbl_msg = "\83E\83H\81[\82æ\81C\8e©\95ª\82ª\89½\8eÒ\82©\8dl\82¦\82½\82±\82Æ\82ª\82 \82é\82©\81H";
1436         break;
1437     }
1438
1439     if (pline_msg)
1440 /*JP
1441         pline("%s %s", Monnam(mtmp), pline_msg);
1442 */
1443         pline("%s\82Í%s", Monnam(mtmp), pline_msg);
1444     else if (mtmp->mcan && verbl_msg_mcan)
1445         verbalize1(verbl_msg_mcan);
1446     else if (verbl_msg) {
1447 #if 0 /*JP*//*\83f\83X\82ð\93Á\95Ê\88µ\82¢\82µ\82È\82¢*/
1448         if (ptr == &mons[PM_DEATH]) {
1449             /* Death talks in CAPITAL LETTERS
1450                and without quotation marks */
1451             char tmpbuf[BUFSZ];
1452             Sprintf(tmpbuf, "%s", verbl_msg);
1453             pline1(ucase(tmpbuf));
1454         } else {
1455             verbalize1(verbl_msg);
1456         }
1457 #else
1458         verbalize1(verbl_msg);
1459 #endif
1460     }
1461     return 1;
1462 }
1463
1464 /* #chat command */
1465 int
1466 dotalk()
1467 {
1468     int result;
1469
1470     result = dochat();
1471     return result;
1472 }
1473
1474 STATIC_OVL int
1475 dochat()
1476 {
1477     struct monst *mtmp;
1478     int tx, ty;
1479     struct obj *otmp;
1480
1481     if (is_silent(youmonst.data)) {
1482 /*JP
1483         pline("As %s, you cannot speak.", an(youmonst.data->mname));
1484 */
1485         pline("\82 \82È\82½\82Í%s\82È\82Ì\82Å\81C\98b\82·\82±\82Æ\82ª\82Å\82«\82È\82¢\81D", youmonst.data->mname);
1486         return 0;
1487     }
1488     if (Strangled) {
1489 /*JP
1490         You_cant("speak.  You're choking!");
1491 */
1492         You("\98b\82¹\82È\82¢\81D\82 \82È\82½\82Í\8eñ\82ð\8di\82ß\82ç\82ê\82Ä\82¢\82é\81I");
1493         return 0;
1494     }
1495     if (u.uswallow) {
1496 /*JP
1497         pline("They won't hear you out there.");
1498 */
1499         You("\8aO\82Ö\8cü\82Á\82Ä\98b\82ð\82µ\82½\82ª\81C\92N\82à\95·\82«\82¢\82ê\82È\82©\82Á\82½\81D");
1500         return 0;
1501     }
1502     if (Underwater) {
1503 /*JP
1504         Your("speech is unintelligible underwater.");
1505 */
1506         pline("\90\85\96Ê\89º\82Å\82Í\81C\82 \82È\82½\82Ì\98b\82Í\82ë\82­\82É\97\9d\89ð\82³\82ê\82È\82¢\81D");
1507         return 0;
1508     }
1509     if (Deaf) {
1510 /*JP
1511         pline("How can you hold a conversation when you cannot hear?");
1512 */
1513         pline("\95·\82­\82±\82Æ\82ª\82Å\82«\82È\82¢\82Ì\82É\82Ç\82¤\82â\82Á\82Ä\89ï\98b\82·\82é\82Ì\81H");
1514         return 0;
1515     }
1516
1517     if (!Blind && (otmp = shop_object(u.ux, u.uy)) != (struct obj *) 0) {
1518         /* standing on something in a shop and chatting causes the shopkeeper
1519            to describe the price(s).  This can inhibit other chatting inside
1520            a shop, but that shouldn't matter much.  shop_object() returns an
1521            object iff inside a shop and the shopkeeper is present and willing
1522            (not angry) and able (not asleep) to speak and the position
1523            contains any objects other than just gold.
1524         */
1525         price_quote(otmp);
1526         return 1;
1527     }
1528
1529 /*JP
1530     if (!getdir("Talk to whom? (in what direction)")) {
1531 */
1532     if (!getdir("\92N\82Æ\98b\82µ\82Ü\82·\82©\81H[\95û\8cü\82ð\93ü\82ê\82Ä\82Ë]")) {
1533         /* decided not to chat */
1534         return 0;
1535     }
1536
1537     if (u.usteed && u.dz > 0) {
1538         if (!u.usteed->mcanmove || u.usteed->msleeping) {
1539 /*JP
1540             pline("%s seems not to notice you.", Monnam(u.usteed));
1541 */
1542             pline("%s\82Í\82 \82È\82½\82É\8bC\82ª\82Â\82¢\82Ä\82¢\82È\82¢\82æ\82¤\82¾\81D", Monnam(u.usteed));
1543             return 1;
1544         } else
1545             return domonnoise(u.usteed);
1546     }
1547
1548     if (u.dz) {
1549 /*JP
1550         pline("They won't hear you %s there.", u.dz < 0 ? "up" : "down");
1551 */
1552         pline("%s\8cü\82©\82Á\82Ä\98b\82ð\82µ\82Ä\82à\88Ó\96¡\82ª\82È\82¢\81D", u.dz < 0 ? "\8fã\82É" : "\89º\82É");
1553         return 0;
1554     }
1555
1556     if (u.dx == 0 && u.dy == 0) {
1557         /*
1558          * Let's not include this.
1559          * It raises all sorts of questions: can you wear
1560          * 2 helmets, 2 amulets, 3 pairs of gloves or 6 rings as a marilith,
1561          * etc...  --KAA
1562         if (u.umonnum == PM_ETTIN) {
1563             You("discover that your other head makes boring conversation.");
1564             return 1;
1565         }
1566          */
1567 /*JP
1568         pline("Talking to yourself is a bad habit for a dungeoneer.");
1569 */
1570         pline("\88ê\90l\8c¾\82Í\96À\8b{\92T\8c\9f\8eÒ\82Ì\88«\82¢\95È\82¾\81D");
1571         return 0;
1572     }
1573
1574     tx = u.ux + u.dx;
1575     ty = u.uy + u.dy;
1576
1577     if (!isok(tx, ty))
1578         return 0;
1579
1580     mtmp = m_at(tx, ty);
1581
1582     if ((!mtmp || mtmp->mundetected)
1583         && (otmp = vobj_at(tx, ty)) != 0 && otmp->otyp == STATUE) {
1584         /* Talking to a statue */
1585         if (!Blind) {
1586 #if 0 /*JP*/
1587             pline_The("%s seems not to notice you.",
1588                       /* if hallucinating, you can't tell it's a statue */
1589                       Hallucination ? rndmonnam((char *) 0) : "statue");
1590 #else
1591             pline_The("%s\82Í\82 \82È\82½\82É\8bC\82ª\82Â\82¢\82Ä\82¢\82È\82¢\82æ\82¤\82¾\81D",
1592                       Hallucination ? rndmonnam((char *) 0) : "\90Î\91\9c");
1593 #endif
1594         }
1595         return 0;
1596     }
1597
1598     if (!mtmp || mtmp->mundetected || mtmp->m_ap_type == M_AP_FURNITURE
1599         || mtmp->m_ap_type == M_AP_OBJECT)
1600         return 0;
1601
1602     /* sleeping monsters won't talk, except priests (who wake up) */
1603     if ((!mtmp->mcanmove || mtmp->msleeping) && !mtmp->ispriest) {
1604         /* If it is unseen, the player can't tell the difference between
1605            not noticing him and just not existing, so skip the message. */
1606         if (canspotmon(mtmp))
1607 /*JP
1608             pline("%s seems not to notice you.", Monnam(mtmp));
1609 */
1610             pline("%s\82Í\82 \82È\82½\82É\8bC\82ª\82Â\82¢\82Ä\82¢\82È\82¢\82æ\82¤\82¾\81D", Monnam(mtmp));
1611         return 0;
1612     }
1613
1614     /* if this monster is waiting for something, prod it into action */
1615     mtmp->mstrategy &= ~STRAT_WAITMASK;
1616
1617     if (mtmp->mtame && mtmp->meating) {
1618         if (!canspotmon(mtmp))
1619             map_invisible(mtmp->mx, mtmp->my);
1620 /*JP
1621         pline("%s is eating noisily.", Monnam(mtmp));
1622 */
1623         pline("%s\82Í\83o\83\8a\83o\83\8a\82Æ\95¨\82ð\90H\82×\82Ä\82¢\82é\81D", Monnam(mtmp));
1624         return 0;
1625     }
1626
1627     return domonnoise(mtmp);
1628 }
1629
1630 #ifdef USER_SOUNDS
1631
1632 extern void FDECL(play_usersound, (const char *, int));
1633
1634 typedef struct audio_mapping_rec {
1635     struct nhregex *regex;
1636     char *filename;
1637     int volume;
1638     struct audio_mapping_rec *next;
1639 } audio_mapping;
1640
1641 static audio_mapping *soundmap = 0;
1642
1643 char *sounddir = ".";
1644
1645 /* adds a sound file mapping, returns 0 on failure, 1 on success */
1646 int
1647 add_sound_mapping(mapping)
1648 const char *mapping;
1649 {
1650     char text[256];
1651     char filename[256];
1652     char filespec[256];
1653     int volume;
1654
1655     if (sscanf(mapping, "MESG \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d", text,
1656                filename, &volume) == 3) {
1657         audio_mapping *new_map;
1658
1659         if (strlen(sounddir) + strlen(filename) > 254) {
1660             raw_print("sound file name too long");
1661             return 0;
1662         }
1663         Sprintf(filespec, "%s/%s", sounddir, filename);
1664
1665         if (can_read_file(filespec)) {
1666             new_map = (audio_mapping *) alloc(sizeof(audio_mapping));
1667             new_map->regex = regex_init();
1668             new_map->filename = dupstr(filespec);
1669             new_map->volume = volume;
1670             new_map->next = soundmap;
1671
1672             if (!regex_compile(text, new_map->regex)) {
1673                 raw_print(regex_error_desc(new_map->regex));
1674                 regex_free(new_map->regex);
1675                 free(new_map->filename);
1676                 free(new_map);
1677                 return 0;
1678             } else {
1679                 soundmap = new_map;
1680             }
1681         } else {
1682             Sprintf(text, "cannot read %.243s", filespec);
1683             raw_print(text);
1684             return 0;
1685         }
1686     } else {
1687         raw_print("syntax error in SOUND");
1688         return 0;
1689     }
1690
1691     return 1;
1692 }
1693
1694 void
1695 play_sound_for_message(msg)
1696 const char *msg;
1697 {
1698     audio_mapping *cursor = soundmap;
1699
1700     while (cursor) {
1701         if (regex_match(msg, cursor->regex)) {
1702             play_usersound(cursor->filename, cursor->volume);
1703         }
1704         cursor = cursor->next;
1705     }
1706 }
1707
1708 #endif /* USER_SOUNDS */
1709
1710 /*sounds.c*/