1 /* NetHack 3.6 sounds.c $NHDT-Date: 1450461632 2015/12/18 18:00:32 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.77 $ */
2 /* Copyright (c) 1989 Janet Walz, Mike Threepoint */
3 /* NetHack may be freely redistributed. See license for details. */
7 STATIC_DCL boolean
FDECL(mon_is_gecko
, (struct monst
*));
8 STATIC_DCL
int FDECL(domonnoise
, (struct monst
*));
9 STATIC_DCL
int NDECL(dochat
);
10 STATIC_DCL
int FDECL(mon_in_room
, (struct monst
*, int));
12 /* this easily could be a macro, but it might overtax dumb compilers */
14 mon_in_room(mon
, rmtyp
)
18 int rno
= levl
[mon
->mx
][mon
->my
].roomno
;
19 if (rno
>= ROOMOFFSET
)
20 return rooms
[rno
- ROOMOFFSET
].rtype
== rmtyp
;
27 register struct mkroom
*sroom
;
28 register int hallu
, vx
, vy
;
29 #if defined(AMIGA) && defined(AZTEC_C_WORKAROUND)
34 if (Deaf
|| !flags
.acoustics
|| u
.uswallow
|| Underwater
)
37 hallu
= Hallucination
? 1 : 0;
39 if (level
.flags
.nfountains
&& !rn2(400)) {
40 static const char *const fountain_msg
[4] = {
41 "bubbling water.", "water falling on coins.",
42 "the splashing of a naiad.", "a soda fountain!",
44 You_hear1(fountain_msg
[rn2(3) + hallu
]);
46 if (level
.flags
.nsinks
&& !rn2(300)) {
47 static const char *const sink_msg
[3] = {
48 "a slow drip.", "a gurgling noise.", "dishes being washed!",
50 You_hear1(sink_msg
[rn2(2) + hallu
]);
52 if (level
.flags
.has_court
&& !rn2(200)) {
53 static const char *const throne_msg
[4] = {
54 "the tones of courtly conversation.",
55 "a sceptre pounded in judgment.",
56 "Someone shouts \"Off with %s head!\"", "Queen Beruthiel's cats!",
58 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
59 if (DEADMONSTER(mtmp
))
61 if ((mtmp
->msleeping
|| is_lord(mtmp
->data
)
62 || is_prince(mtmp
->data
)) && !is_animal(mtmp
->data
)
63 && mon_in_room(mtmp
, COURT
)) {
64 /* finding one is enough, at least for now */
65 int which
= rn2(3) + hallu
;
68 You_hear1(throne_msg
[which
]);
70 pline(throne_msg
[2], uhis());
75 if (level
.flags
.has_swamp
&& !rn2(200)) {
76 static const char *const swamp_msg
[3] = {
77 "hear mosquitoes!", "smell marsh gas!", /* so it's a smell...*/
80 You1(swamp_msg
[rn2(2) + hallu
]);
83 if (level
.flags
.has_vault
&& !rn2(200)) {
84 if (!(sroom
= search_special(VAULT
))) {
86 level
.flags
.has_vault
= 0;
90 switch (rn2(2) + hallu
) {
92 boolean gold_in_vault
= FALSE
;
94 for (vx
= sroom
->lx
; vx
<= sroom
->hx
; vx
++)
95 for (vy
= sroom
->ly
; vy
<= sroom
->hy
; vy
++)
98 #if defined(AMIGA) && defined(AZTEC_C_WORKAROUND)
99 /* Bug in aztec assembler here. Workaround below */
100 xx
= ROOM_INDEX(sroom
) + ROOMOFFSET
;
101 xx
= (xx
!= vault_occupied(u
.urooms
));
104 if (vault_occupied(u
.urooms
)
105 != (ROOM_INDEX(sroom
) + ROOMOFFSET
))
106 #endif /* AZTEC_C_WORKAROUND */
110 ? "someone counting money."
111 : "the quarterback calling the play.");
113 You_hear("someone searching.");
116 /* fall into... (yes, even for hallucination) */
119 You_hear("the footsteps of a guard on patrol.");
122 You_hear("Ebenezer Scrooge!");
127 if (level
.flags
.has_beehive
&& !rn2(200)) {
128 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
129 if (DEADMONSTER(mtmp
))
131 if ((mtmp
->data
->mlet
== S_ANT
&& is_flyer(mtmp
->data
))
132 && mon_in_room(mtmp
, BEEHIVE
)) {
133 switch (rn2(2) + hallu
) {
135 You_hear("a low buzzing.");
138 You_hear("an angry drone.");
141 You_hear("bees in your %sbonnet!",
142 uarmh
? "" : "(nonexistent) ");
149 if (level
.flags
.has_morgue
&& !rn2(200)) {
150 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
151 if (DEADMONSTER(mtmp
))
153 if ((is_undead(mtmp
->data
) || is_vampshifter(mtmp
))
154 && mon_in_room(mtmp
, MORGUE
)) {
155 const char *hair
= body_part(HAIR
); /* hair/fur/scales */
157 switch (rn2(2) + hallu
) {
159 You("suddenly realize it is unnaturally quiet.");
162 pline_The("%s on the back of your %s %s up.", hair
,
163 body_part(NECK
), vtense(hair
, "stand"));
166 pline_The("%s on your %s %s to stand up.", hair
,
167 body_part(HEAD
), vtense(hair
, "seem"));
174 if (level
.flags
.has_barracks
&& !rn2(200)) {
175 static const char *const barracks_msg
[4] = {
176 "blades being honed.", "loud snoring.", "dice being thrown.",
177 "General MacArthur!",
181 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
182 if (DEADMONSTER(mtmp
))
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")
189 && mon_in_room(mtmp
, BARRACKS
)
190 /* sleeping implies not-yet-disturbed (usually) */
191 && (mtmp
->msleeping
|| ++count
> 5)) {
192 You_hear1(barracks_msg
[rn2(3) + hallu
]);
197 if (level
.flags
.has_zoo
&& !rn2(200)) {
198 static const char *const zoo_msg
[3] = {
199 "a sound reminiscent of an elephant stepping on a peanut.",
200 "a sound reminiscent of a seal barking.", "Doctor Dolittle!",
202 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
203 if (DEADMONSTER(mtmp
))
205 if ((mtmp
->msleeping
|| is_animal(mtmp
->data
))
206 && mon_in_room(mtmp
, ZOO
)) {
207 You_hear1(zoo_msg
[rn2(2) + hallu
]);
212 if (level
.flags
.has_shop
&& !rn2(200)) {
213 if (!(sroom
= search_special(ANY_SHOP
))) {
215 level
.flags
.has_shop
= 0;
218 if (tended_shop(sroom
)
219 && !index(u
.ushops
, (int) (ROOM_INDEX(sroom
) + ROOMOFFSET
))) {
220 static const char *const shop_msg
[3] = {
221 "someone cursing shoplifters.",
222 "the chime of a cash register.", "Neiman and Marcus arguing!",
224 You_hear1(shop_msg
[rn2(2) + hallu
]);
228 if (level
.flags
.has_temple
&& !rn2(200)
229 && !(Is_astralevel(&u
.uz
) || Is_sanctum(&u
.uz
))) {
230 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
231 if (DEADMONSTER(mtmp
))
233 if (mtmp
->ispriest
&& inhistemple(mtmp
)
234 /* priest must be active */
235 && mtmp
->mcanmove
&& !mtmp
->msleeping
236 /* hero must be outside this temple */
237 && temple_occupied(u
.urooms
) != EPRI(mtmp
)->shroom
)
241 /* Generic temple messages; no attempt to match topic or tone
242 to the pantheon involved, let alone to the specific deity.
243 These are assumed to be coming from the attending priest;
244 asterisk means that the priest must be capable of speech;
245 pound sign (octathorpe,&c--don't go there) means that the
246 priest and the altar must not be directly visible (we don't
247 care if telepathy or extended detection reveals that the
248 priest is not currently standing on the altar; he's mobile). */
249 static const char *const temple_msg
[] = {
250 "*someone praising %s.", "*someone beseeching %s.",
251 "#an animal carcass being offered in sacrifice.",
252 "*a strident plea for donations.",
255 int trycount
= 0, ax
= EPRI(mtmp
)->shrpos
.x
,
256 ay
= EPRI(mtmp
)->shrpos
.y
;
257 boolean speechless
= (mtmp
->data
->msound
<= MS_ANIMAL
),
258 in_sight
= canseemon(mtmp
) || cansee(ax
, ay
);
261 msg
= temple_msg
[rn2(SIZE(temple_msg
) - 1 + hallu
)];
262 if (index(msg
, '*') && speechless
)
264 if (index(msg
, '#') && in_sight
)
266 break; /* msg is acceptable */
267 } while (++trycount
< 50);
268 while (!letter(*msg
))
269 ++msg
; /* skip control flags */
271 You_hear(msg
, halu_gname(EPRI(mtmp
)->shralign
));
277 if (Is_oracle_level(&u
.uz
) && !rn2(400)) {
278 /* make sure the Oracle is still here */
279 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
280 if (DEADMONSTER(mtmp
))
282 if (mtmp
->data
== &mons
[PM_ORACLE
])
285 /* and don't produce silly effects when she's clearly visible */
286 if (mtmp
&& (hallu
|| !canseemon(mtmp
))) {
287 static const char *const ora_msg
[5] = {
288 "a strange wind.", /* Jupiter at Dodona */
289 "convulsive ravings.", /* Apollo at Delphi */
290 "snoring snakes.", /* AEsculapius at Epidaurus */
291 "someone say \"No more woodchucks!\"",
292 "a loud ZOT!" /* both rec.humor.oracle */
294 You_hear1(ora_msg
[rn2(3) + hallu
* 2]);
300 static const char *const h_sounds
[] = {
301 "beep", "boing", "sing", "belche", "creak", "cough",
302 "rattle", "ululate", "pop", "jingle", "sniffle", "tinkle",
303 "eep", "clatter", "hum", "sizzle", "twitter", "wheeze",
304 "rustle", "honk", "lisp", "yodel", "coo", "burp",
305 "moo", "boom", "murmur", "oink", "quack", "rumble",
306 "twang", "bellow", "toot", "gargle", "hoot", "warble"
311 register struct monst
*mtmp
;
315 switch (mtmp
->data
->msound
) {
351 /* the sounds of a seriously abused pet, including player attacking it */
354 register struct monst
*mtmp
;
356 register const char *growl_verb
= 0;
358 if (mtmp
->msleeping
|| !mtmp
->mcanmove
|| !mtmp
->data
->msound
)
361 /* presumably nearness and soundok checks have already been made */
363 growl_verb
= h_sounds
[rn2(SIZE(h_sounds
))];
365 growl_verb
= growl_sound(mtmp
);
367 pline("%s %s!", Monnam(mtmp
), vtense((char *) 0, growl_verb
));
370 wake_nearto(mtmp
->mx
, mtmp
->my
, mtmp
->data
->mlevel
* 18);
374 /* the sounds of mistreated pets */
377 register struct monst
*mtmp
;
379 register const char *yelp_verb
= 0;
381 if (mtmp
->msleeping
|| !mtmp
->mcanmove
|| !mtmp
->data
->msound
)
384 /* presumably nearness and soundok checks have already been made */
386 yelp_verb
= h_sounds
[rn2(SIZE(h_sounds
))];
388 switch (mtmp
->data
->msound
) {
390 yelp_verb
= (!Deaf
) ? "yowl" : "arch";
394 yelp_verb
= (!Deaf
) ? "yelp" : "recoil";
397 yelp_verb
= (!Deaf
) ? "snarl" : "bluff";
400 yelp_verb
= (!Deaf
) ? "squeal" : "quiver";
403 yelp_verb
= (!Deaf
) ? "screak" : "thrash";
406 yelp_verb
= (!Deaf
) ? "wail" : "cringe";
410 pline("%s %s!", Monnam(mtmp
), vtense((char *) 0, yelp_verb
));
413 wake_nearto(mtmp
->mx
, mtmp
->my
, mtmp
->data
->mlevel
* 12);
417 /* the sounds of distressed pets */
420 register struct monst
*mtmp
;
422 register const char *whimper_verb
= 0;
424 if (mtmp
->msleeping
|| !mtmp
->mcanmove
|| !mtmp
->data
->msound
)
427 /* presumably nearness and soundok checks have already been made */
429 whimper_verb
= h_sounds
[rn2(SIZE(h_sounds
))];
431 switch (mtmp
->data
->msound
) {
434 whimper_verb
= "whimper";
437 whimper_verb
= "whine";
440 whimper_verb
= "squeal";
444 pline("%s %s.", Monnam(mtmp
), vtense((char *) 0, whimper_verb
));
447 wake_nearto(mtmp
->mx
, mtmp
->my
, mtmp
->data
->mlevel
* 6);
451 /* pet makes "I'm hungry" noises */
454 register struct monst
*mtmp
;
456 if (mtmp
->msleeping
|| !mtmp
->mcanmove
457 || !(carnivorous(mtmp
->data
) || herbivorous(mtmp
->data
)))
460 /* presumably nearness and soundok checks have already been made */
461 if (!is_silent(mtmp
->data
) && mtmp
->data
->msound
<= MS_ANIMAL
)
462 (void) domonnoise(mtmp
);
463 else if (mtmp
->data
->msound
>= MS_HUMANOID
) {
464 if (!canspotmon(mtmp
))
465 map_invisible(mtmp
->mx
, mtmp
->my
);
466 verbalize("I'm hungry.");
470 /* return True if mon is a gecko or seems to look like one (hallucination) */
477 /* return True if it is actually a gecko */
478 if (mon
->data
== &mons
[PM_GECKO
])
480 /* return False if it is a long worm; we might be chatting to its tail
481 (not strictly needed; long worms are MS_SILENT so won't get here) */
482 if (mon
->data
== &mons
[PM_LONG_WORM
])
484 /* result depends upon whether map spot shows a gecko, which will
485 be due to hallucination or to mimickery since mon isn't one */
486 glyph
= glyph_at(mon
->mx
, mon
->my
);
487 return (boolean
) (glyph_to_mon(glyph
) == PM_GECKO
);
492 register struct monst
*mtmp
;
495 register const char *pline_msg
= 0, /* Monnam(mtmp) will be prepended */
496 *verbl_msg
= 0, /* verbalize() */
497 *verbl_msg_mcan
= 0; /* verbalize() if cancelled */
498 struct permonst
*ptr
= mtmp
->data
;
499 int msound
= ptr
->msound
;
501 /* presumably nearness and sleep checks have already been made */
507 /* leader might be poly'd; if he can still speak, give leader speech */
508 if (mtmp
->m_id
== quest_status
.leader_m_id
&& msound
> MS_ANIMAL
)
510 /* make sure it's your role's quest guardian; adjust if not */
511 else if (msound
== MS_GUARDIAN
&& ptr
!= &mons
[urole
.guardnum
])
512 msound
= mons
[genus(monsndx(ptr
), 1)].msound
;
513 /* some normally non-speaking types can/will speak if hero is similar */
514 else if (msound
== MS_ORC
/* note: MS_ORC is same as MS_GRUNT */
515 && (same_race(ptr
, youmonst
.data
) /* current form, */
516 || same_race(ptr
, &mons
[Race_switch
]))) /* unpoly'd form */
517 msound
= MS_HUMANOID
;
518 /* silliness, with slight chance to interfere with shopping */
519 else if (Hallucination
&& mon_is_gecko(mtmp
))
522 /* be sure to do this before talking; the monster might teleport away, in
523 * which case we want to check its pre-teleport position
525 if (!canspotmon(mtmp
))
526 map_invisible(mtmp
->mx
, mtmp
->my
);
530 return doconsult(mtmp
);
539 case MS_SELL
: /* pitch, pay, total */
540 if (!Hallucination
|| (mtmp
->isshk
&& !rn2(2))) {
543 /* approximation of GEICO's advertising slogan (it actually
544 concludes with "save you 15% or more on car insurance.") */
545 Sprintf(verbuf
, "15 minutes could save you 15 %s.",
546 currency(15L)); /* "zorkmids" */
551 /* vampire messages are varied by tameness, peacefulness, and time of
553 boolean isnight
= night();
554 boolean kindred
= (Upolyd
&& (u
.umonnum
== PM_VAMPIRE
555 || u
.umonnum
== PM_VAMPIRE_LORD
));
557 (Upolyd
&& (u
.umonnum
== PM_WOLF
|| u
.umonnum
== PM_WINTER_WOLF
558 || u
.umonnum
== PM_WINTER_WOLF_CUB
));
559 const char *racenoun
=
560 (flags
.female
&& urace
.individual
.f
)
562 : (urace
.individual
.m
) ? urace
.individual
.m
: urace
.noun
;
566 Sprintf(verbuf
, "Good %s to you Master%s",
567 isnight
? "evening" : "day",
568 isnight
? "!" : ". Why do we not rest?");
571 Sprintf(verbuf
, "%s%s",
572 nightchild
? "Child of the night, " : "",
574 ? "I can stand this craving no longer!"
576 ? "I beg you, help me satisfy this growing craving!"
577 : "I find myself growing a little weary.");
580 } else if (mtmp
->mpeaceful
) {
581 if (kindred
&& isnight
) {
582 Sprintf(verbuf
, "Good feeding %s!",
583 flags
.female
? "sister" : "brother");
585 } else if (nightchild
&& isnight
) {
586 Sprintf(verbuf
, "How nice to hear you, child of the night!");
589 verbl_msg
= "I only drink... potions.";
592 static const char *const vampmsg
[] = {
593 /* These first two (0 and 1) are specially handled below */
594 "I vant to suck your %s!",
595 "I vill come after %s without regret!",
596 /* other famous vampire quotes can follow here if desired */
600 "This is my hunting ground that you dare to prowl!";
601 else if (youmonst
.data
== &mons
[PM_SILVER_DRAGON
]
602 || youmonst
.data
== &mons
[PM_BABY_SILVER_DRAGON
]) {
603 /* Silver dragons are silver in color, not made of silver */
604 Sprintf(verbuf
, "%s! Your silver sheen does not frighten me!",
605 youmonst
.data
== &mons
[PM_SILVER_DRAGON
]
610 vampindex
= rn2(SIZE(vampmsg
));
611 if (vampindex
== 0) {
612 Sprintf(verbuf
, vampmsg
[vampindex
], body_part(BLOOD
));
614 } else if (vampindex
== 1) {
615 Sprintf(verbuf
, vampmsg
[vampindex
],
616 Upolyd
? an(mons
[u
.umonnum
].mname
)
620 verbl_msg
= vampmsg
[vampindex
];
625 if (flags
.moonphase
== FULL_MOON
&& (night() ^ !rn2(13))) {
626 pline("%s throws back %s head and lets out a blood curdling %s!",
627 Monnam(mtmp
), mhis(mtmp
),
628 ptr
== &mons
[PM_HUMAN_WERERAT
] ? "shriek" : "howl");
629 wake_nearto(mtmp
->mx
, mtmp
->my
, 11 * 11);
632 "whispers inaudibly. All you can make out is \"moon\".";
635 if (flags
.moonphase
== FULL_MOON
&& night()) {
636 pline_msg
= "howls.";
637 } else if (mtmp
->mpeaceful
) {
639 && (mtmp
->mconf
|| mtmp
->mflee
|| mtmp
->mtrapped
640 || moves
> EDOG(mtmp
)->hungrytime
|| mtmp
->mtame
< 5))
641 pline_msg
= "whines.";
642 else if (mtmp
->mtame
&& EDOG(mtmp
)->hungrytime
> moves
+ 1000)
646 != &mons
[PM_DINGO
]) /* dingos do not actually bark */
647 pline_msg
= "barks.";
650 pline_msg
= "growls.";
655 if (mtmp
->mconf
|| mtmp
->mflee
|| mtmp
->mtrapped
657 pline_msg
= "yowls.";
658 else if (moves
> EDOG(mtmp
)->hungrytime
)
659 pline_msg
= "meows.";
660 else if (EDOG(mtmp
)->hungrytime
> moves
+ 1000)
661 pline_msg
= "purrs.";
665 } /* else FALLTHRU */
667 pline_msg
= mtmp
->mpeaceful
? "snarls." : "growls!";
670 pline_msg
= mtmp
->mpeaceful
? "snarls." : "roars!";
673 pline_msg
= "squeaks.";
676 if (ptr
== &mons
[PM_RAVEN
] && !mtmp
->mpeaceful
)
677 verbl_msg
= "Nevermore!";
679 pline_msg
= "squawks.";
682 if (!mtmp
->mpeaceful
)
683 pline_msg
= "hisses!";
685 return 0; /* no sound */
688 pline_msg
= mtmp
->mpeaceful
? "drones." : "buzzes angrily.";
691 pline_msg
= "grunts.";
695 pline_msg
= "neighs.";
696 else if (moves
> EDOG(mtmp
)->hungrytime
)
697 pline_msg
= "whinnies.";
699 pline_msg
= "whickers.";
702 pline_msg
= "wails mournfully.";
705 pline_msg
= "gurgles.";
708 pline_msg
= "burbles.";
711 pline_msg
= "shrieks.";
715 pline_msg
= "imitates you.";
718 pline("%s rattles noisily.", Monnam(mtmp
));
719 You("freeze for a moment.");
721 multi_reason
= "scared by rattling";
725 static const char *const laugh_msg
[4] = {
726 "giggles.", "chuckles.", "snickers.", "laughs.",
728 pline_msg
= laugh_msg
[rn2(4)];
731 pline_msg
= "mumbles incomprehensibly.";
735 verbl_msg
= "Sorry, I'm all out of wishes.";
736 } else if (mtmp
->mpeaceful
) {
737 if (ptr
== &mons
[PM_WATER_DEMON
])
738 pline_msg
= "gurgles.";
740 verbl_msg
= "I'm free!";
742 if (ptr
!= &mons
[PM_PRISONER
])
743 verbl_msg
= "This will teach you not to disturb me!";
746 verbl_msg
= "??????????";
750 case MS_BOAST
: /* giants */
751 if (!mtmp
->mpeaceful
) {
754 pline("%s boasts about %s gem collection.", Monnam(mtmp
),
758 pline_msg
= "complains about a diet of mutton.";
761 pline_msg
= "shouts \"Fee Fie Foe Foo!\" and guffaws.";
762 wake_nearto(mtmp
->mx
, mtmp
->my
, 7 * 7);
769 if (!mtmp
->mpeaceful
) {
770 if (In_endgame(&u
.uz
) && is_mplayer(ptr
))
773 pline_msg
= "threatens you.";
776 /* Generic peaceful humanoid behaviour. */
778 pline_msg
= "wants nothing to do with you.";
779 else if (mtmp
->mhp
< mtmp
->mhpmax
/ 4)
780 pline_msg
= "moans.";
781 else if (mtmp
->mconf
|| mtmp
->mstun
)
782 verbl_msg
= !rn2(3) ? "Huh?" : rn2(2) ? "What?" : "Eh?";
783 else if (!mtmp
->mcansee
)
784 verbl_msg
= "I can't see!";
785 else if (mtmp
->mtrapped
) {
786 struct trap
*t
= t_at(mtmp
->mx
, mtmp
->my
);
790 verbl_msg
= "I'm trapped!";
791 } else if (mtmp
->mhp
< mtmp
->mhpmax
/ 2)
792 pline_msg
= "asks for a potion of healing.";
793 else if (mtmp
->mtame
&& !mtmp
->isminion
794 && moves
> EDOG(mtmp
)->hungrytime
)
795 verbl_msg
= "I'm hungry.";
796 /* Specific monsters' interests */
797 else if (is_elf(ptr
))
798 pline_msg
= "curses orcs.";
799 else if (is_dwarf(ptr
))
800 pline_msg
= "talks about mining.";
801 else if (likes_magic(ptr
))
802 pline_msg
= "talks about spellcraft.";
803 else if (ptr
->mlet
== S_CENTAUR
)
804 pline_msg
= "discusses hunting.";
806 switch (monsndx(ptr
)) {
809 (mtmp
->mhpmax
- mtmp
->mhp
>= 10)
810 ? "complains about unpleasant dungeon conditions."
811 : "asks you about the One Ring.";
813 case PM_ARCHEOLOGIST
:
815 "describes a recent article in \"Spelunker Today\" magazine.";
818 verbl_msg
= "Aloha.";
821 pline_msg
= "discusses dungeon exploration.";
828 if (ptr
->mlet
!= S_NYMPH
829 && could_seduce(mtmp
, &youmonst
, (struct attack
*) 0) == 1) {
830 (void) doseduce(mtmp
);
833 swval
= ((poly_gender() != (int) mtmp
->female
) ? rn2(3) : 0);
835 swval
= ((poly_gender() == 0) ? rn2(3) : 0);
838 verbl_msg
= "Hello, sailor.";
841 pline_msg
= "comes on to you.";
844 pline_msg
= "cajoles you.";
849 verbalize("Just the facts, %s.", flags
.female
? "Ma'am" : "Sir");
851 static const char *const arrest_msg
[3] = {
852 "Anything you say can be used against you.",
853 "You're under arrest!", "Stop in the name of the Law!",
855 verbl_msg
= arrest_msg
[rn2(3)];
859 if (mtmp
->mpeaceful
&& !mtmp
->mtame
) {
860 (void) demon_talk(mtmp
);
865 if (!mtmp
->mpeaceful
)
867 else if (is_lminion(mtmp
))
868 verbl_msg
= "It's not too late.";
870 verbl_msg
= "We're all doomed.";
873 /* deliberately vague, since it's not actually casting any spell */
874 pline_msg
= "seems to mutter a cantrip.";
877 verbl_msg_mcan
= "I hate this job!";
878 if (uwep
&& (uwep
->oclass
== WEAPON_CLASS
|| is_weptool(uwep
)))
879 verbl_msg
= "Put that weapon away before you hurt someone!";
880 else if (uarmc
|| uarm
|| uarmh
|| uarms
|| uarmg
|| uarmf
)
881 verbl_msg
= Role_if(PM_HEALER
)
882 ? "Doc, I can't help you unless you cooperate."
883 : "Please undress so I can examine you.";
885 verbl_msg
= "Take off your shirt, please.";
887 verbl_msg
= "Relax, this won't hurt a bit.";
890 if (money_cnt(invent
))
891 verbl_msg
= "Please drop that gold and follow me.";
893 verbl_msg
= "Please follow me.";
897 *const soldier_foe_msg
[3] =
899 "Resistance is useless!", "You're dog meat!", "Surrender!",
901 *const soldier_pax_msg
[3] = {
902 "What lousy pay we're getting here!",
903 "The food's not fit for Orcs!",
904 "My feet hurt, I've been on them all day!",
906 verbl_msg
= mtmp
->mpeaceful
? soldier_pax_msg
[rn2(3)]
907 : soldier_foe_msg
[rn2(3)];
912 if (ptr
== &mons
[PM_DEATH
]
913 && !context
.tribute
.Deathnotice
&& u_have_novel()) {
914 struct obj
*book
= u_have_novel();
915 const char *tribtitle
= (char *)0;
918 int novelidx
= book
->novelidx
;
920 tribtitle
= noveltitle(&novelidx
);
923 Sprintf(verbuf
, "Ah, so you have a copy of /%s/.", tribtitle
);
924 /* no Death featured in these two, so exclude them */
925 if (!(strcmpi(tribtitle
, "Snuff") == 0
926 || strcmpi(tribtitle
, "The Wee Free Men") == 0))
927 Strcat(verbuf
, " I may have been misquoted there.");
929 context
.tribute
.Deathnotice
= 1;
931 } else if (ptr
== &mons
[PM_DEATH
]
932 && !rn2(2) && Death_quote(verbuf
, BUFSZ
)) {
935 /* end of tribute addition */
936 else if (ptr
== &mons
[PM_DEATH
] && !rn2(10))
937 pline_msg
= "is busy reading a copy of Sandman #8.";
939 verbl_msg
= "Who do you think you are, War?";
944 pline("%s %s", Monnam(mtmp
), pline_msg
);
945 else if (mtmp
->mcan
&& verbl_msg_mcan
)
946 verbalize1(verbl_msg_mcan
);
947 else if (verbl_msg
) {
948 if (ptr
== &mons
[PM_DEATH
]) {
949 /* Death talks in CAPITAL LETTERS
950 and without quotation marks */
952 Sprintf(tmpbuf
, "%s", verbl_msg
);
953 pline1(ucase(tmpbuf
));
955 verbalize1(verbl_msg
);
978 if (is_silent(youmonst
.data
)) {
979 pline("As %s, you cannot speak.", an(youmonst
.data
->mname
));
983 You_cant("speak. You're choking!");
987 pline("They won't hear you out there.");
991 Your("speech is unintelligible underwater.");
995 pline("How can you hold a conversation when you cannot hear?");
999 if (!Blind
&& (otmp
= shop_object(u
.ux
, u
.uy
)) != (struct obj
*) 0) {
1000 /* standing on something in a shop and chatting causes the shopkeeper
1001 to describe the price(s). This can inhibit other chatting inside
1002 a shop, but that shouldn't matter much. shop_object() returns an
1003 object iff inside a shop and the shopkeeper is present and willing
1004 (not angry) and able (not asleep) to speak and the position
1005 contains any objects other than just gold.
1011 if (!getdir("Talk to whom? (in what direction)")) {
1012 /* decided not to chat */
1016 if (u
.usteed
&& u
.dz
> 0) {
1017 if (!u
.usteed
->mcanmove
|| u
.usteed
->msleeping
) {
1018 pline("%s seems not to notice you.", Monnam(u
.usteed
));
1021 return domonnoise(u
.usteed
);
1025 pline("They won't hear you %s there.", u
.dz
< 0 ? "up" : "down");
1029 if (u
.dx
== 0 && u
.dy
== 0) {
1031 * Let's not include this.
1032 * It raises all sorts of questions: can you wear
1033 * 2 helmets, 2 amulets, 3 pairs of gloves or 6 rings as a marilith,
1035 if (u.umonnum == PM_ETTIN) {
1036 You("discover that your other head makes boring conversation.");
1040 pline("Talking to yourself is a bad habit for a dungeoneer.");
1050 mtmp
= m_at(tx
, ty
);
1052 if ((!mtmp
|| mtmp
->mundetected
)
1053 && (otmp
= vobj_at(tx
, ty
)) != 0 && otmp
->otyp
== STATUE
) {
1054 /* Talking to a statue */
1056 pline_The("%s seems not to notice you.",
1057 /* if hallucinating, you can't tell it's a statue */
1058 Hallucination
? rndmonnam((char *) 0) : "statue");
1063 if (!mtmp
|| mtmp
->mundetected
|| mtmp
->m_ap_type
== M_AP_FURNITURE
1064 || mtmp
->m_ap_type
== M_AP_OBJECT
)
1067 /* sleeping monsters won't talk, except priests (who wake up) */
1068 if ((!mtmp
->mcanmove
|| mtmp
->msleeping
) && !mtmp
->ispriest
) {
1069 /* If it is unseen, the player can't tell the difference between
1070 not noticing him and just not existing, so skip the message. */
1071 if (canspotmon(mtmp
))
1072 pline("%s seems not to notice you.", Monnam(mtmp
));
1076 /* if this monster is waiting for something, prod it into action */
1077 mtmp
->mstrategy
&= ~STRAT_WAITMASK
;
1079 if (mtmp
->mtame
&& mtmp
->meating
) {
1080 if (!canspotmon(mtmp
))
1081 map_invisible(mtmp
->mx
, mtmp
->my
);
1082 pline("%s is eating noisily.", Monnam(mtmp
));
1086 return domonnoise(mtmp
);
1091 extern void FDECL(play_usersound
, (const char *, int));
1093 typedef struct audio_mapping_rec
{
1094 struct nhregex
*regex
;
1097 struct audio_mapping_rec
*next
;
1100 static audio_mapping
*soundmap
= 0;
1102 char *sounddir
= ".";
1104 /* adds a sound file mapping, returns 0 on failure, 1 on success */
1106 add_sound_mapping(mapping
)
1107 const char *mapping
;
1114 if (sscanf(mapping
, "MESG \"%255[^\"]\"%*[\t ]\"%255[^\"]\" %d", text
,
1115 filename
, &volume
) == 3) {
1116 audio_mapping
*new_map
;
1118 if (strlen(sounddir
) + strlen(filename
) > 254) {
1119 raw_print("sound file name too long");
1122 Sprintf(filespec
, "%s/%s", sounddir
, filename
);
1124 if (can_read_file(filespec
)) {
1125 new_map
= (audio_mapping
*) alloc(sizeof(audio_mapping
));
1126 new_map
->regex
= regex_init();
1127 new_map
->filename
= dupstr(filespec
);
1128 new_map
->volume
= volume
;
1129 new_map
->next
= soundmap
;
1131 if (!regex_compile(text
, new_map
->regex
)) {
1132 raw_print(regex_error_desc(new_map
->regex
));
1133 regex_free(new_map
->regex
);
1134 free(new_map
->filename
);
1141 Sprintf(text
, "cannot read %.243s", filespec
);
1146 raw_print("syntax error in SOUND");
1154 play_sound_for_message(msg
)
1157 audio_mapping
*cursor
= soundmap
;
1160 if (regex_match(msg
, cursor
->regex
)) {
1161 play_usersound(cursor
->filename
, cursor
->volume
);
1163 cursor
= cursor
->next
;
1167 #endif /* USER_SOUNDS */