| 674 | } |
| 675 | |
| 676 | DISABLE_WARNING_FORMAT_NONLITERAL |
| 677 | |
| 678 | int /* check calls to this */ |
| 679 | domonnoise(struct monst *mtmp) |
| 680 | { |
| 681 | char verbuf[BUFSZ]; |
| 682 | const char *pline_msg = 0, /* Monnam(mtmp) will be prepended */ |
| 683 | *verbl_msg = 0, /* verbalize() */ |
| 684 | *verbl_msg_mcan = 0; /* verbalize() if cancelled */ |
| 685 | struct permonst *ptr = mtmp->data; |
| 686 | int msound = ptr->msound, gnomeplan = 0; |
| 687 | |
| 688 | /* presumably nearness and sleep checks have already been made */ |
| 689 | if (Deaf) |
| 690 | return ECMD_OK; |
| 691 | /* shk_chat can handle nonverbal monsters */ |
| 692 | if (is_silent(ptr) && !mtmp->isshk) |
| 693 | return ECMD_OK; |
| 694 | |
| 695 | /* leader might be poly'd; if he can still speak, give leader speech */ |
| 696 | if (mtmp->m_id == svq.quest_status.leader_m_id && msound > MS_ANIMAL) |
| 697 | msound = MS_LEADER; |
| 698 | /* make sure it's your role's quest guardian; adjust if not */ |
| 699 | else if (msound == MS_GUARDIAN && ptr != &mons[gu.urole.guardnum]) |
| 700 | msound = mons[genus(monsndx(ptr), 1)].msound; |
| 701 | /* even polymorphed, shopkeepers retain their minds and capitalist bent */ |
| 702 | else if (mtmp->isshk) |
| 703 | msound = MS_SELL; |
| 704 | /* some normally non-speaking types can/will speak if hero is similar */ |
| 705 | else if (msound == MS_ORC |
| 706 | && ((same_race(ptr, gy.youmonst.data) /* current form, */ |
| 707 | || same_race(ptr, &mons[Race_switch])) /* unpoly'd form */ |
| 708 | || Hallucination)) |
| 709 | msound = MS_HUMANOID; |
| 710 | else if (msound == MS_MOO && !mtmp->mtame) |
| 711 | msound = MS_BELLOW; |
| 712 | /* silliness; formerly had a 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); /* check this */ |
| 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 */ |
no test coverage detected