MCPcopy Create free account
hub / github.com/NetHack/NetHack / sound_speak

Function sound_speak

src/sounds.c:2184–2220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2182}
2183
2184void
2185sound_speak(const char *text SPEECHONLY)
2186{
2187#ifdef SND_SPEECH
2188 const char *cp1, *cp2;
2189 char *cpdst;
2190 char buf[BUFSZ + BUFSZ];
2191
2192 if (!text || (text && *text == '\0'))
2193 return;
2194 if (iflags.voices && soundprocs.sound_verbal
2195 && (soundprocs.sound_triggers & SOUND_TRIGGER_VERBAL)) {
2196 cp1 = text;
2197 cpdst = buf;
2198 cp2 = c_eos(cp1);
2199 cp2--; /* last non-NUL */
2200 *cpdst = '\0';
2201 if ((gp.pline_flags & PLINE_VERBALIZE) != 0) {
2202 if (*cp1 == '"')
2203 cp1++;
2204 if (*cp2 == '"')
2205 cp2--;
2206 }
2207 /* cp1 -> 1st, cp2 -> last non-nul) */
2208 if ((unsigned)(cp2 - cp1) < (sizeof buf - 1U)) {
2209 while (cp1 <= cp2) {
2210 *cpdst = *cp1;
2211 cp1++;
2212 cpdst++;
2213 }
2214 *cpdst = '\0';
2215 }
2216 (*soundprocs.sound_verbal)(buf, gv.voice.gender, gv.voice.tone,
2217 gv.voice.volume, gv.voice.moreinfo);
2218 }
2219#endif
2220}
2221
2222/*sounds.c*/

Callers 2

domonnoiseFunction · 0.85
yn_functionFunction · 0.85

Calls 1

c_eosFunction · 0.85

Tested by

no test coverage detected