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

Function dosounds

src/sounds.c:201–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void
202dosounds(void)
203{
204 struct mkroom *sroom;
205 int hallu, vx, vy;
206 struct monst *mtmp;
207
208 if (Deaf || !flags.acoustics || u.uswallow || Underwater)
209 return;
210
211 hallu = Hallucination ? 1 : 0;
212
213 if (svl.level.flags.nfountains && !rn2(400)) {
214 static const char *const fountain_msg[4] = {
215 "bubbling water.", "water falling on coins.",
216 "the splashing of a naiad.", "a soda fountain!",
217 };
218 You_hear1(fountain_msg[rn2(3) + hallu]);
219 }
220 if (svl.level.flags.nsinks && !rn2(300)) {
221 static const char *const sink_msg[3] = {
222 "a slow drip.", "a gurgling noise.", "dishes being washed!",
223 };
224 You_hear1(sink_msg[rn2(2) + hallu]);
225 }
226 if (svl.level.flags.has_court && !rn2(200)) {
227 if (get_iter_mons(throne_mon_sound))
228 return;
229 }
230 if (svl.level.flags.has_swamp && !rn2(200)) {
231 static const char *const swamp_msg[3] = {
232 "hear mosquitoes!", "smell marsh gas!", /* so it's a smell...*/
233 "hear Donald Duck!",
234 };
235 You1(swamp_msg[rn2(2) + hallu]);
236 return;
237 }
238 if (svl.level.flags.has_vault && !rn2(200)) {
239 if (!(sroom = search_special(VAULT))) {
240 /* strange ... */
241 svl.level.flags.has_vault = 0;
242 return;
243 }
244 if (gd_sound())
245 switch (rn2(2) + hallu) {
246 case 1: {
247 boolean gold_in_vault = FALSE;
248
249 for (vx = sroom->lx; vx <= sroom->hx; vx++)
250 for (vy = sroom->ly; vy <= sroom->hy; vy++)
251 if (g_at(vx, vy))
252 gold_in_vault = TRUE;
253 if (vault_occupied(u.urooms)
254 != (ROOM_INDEX(sroom) + ROOMOFFSET)) {
255 if (gold_in_vault) {
256 You_hear(!hallu
257 ? "someone counting gold coins."
258 : "the quarterback calling the play.");

Callers 1

allmain.cFile · 0.85

Calls 11

rn2Function · 0.85
get_iter_monsFunction · 0.85
search_specialFunction · 0.85
gd_soundFunction · 0.85
g_atFunction · 0.85
vault_occupiedFunction · 0.85
You_hearFunction · 0.85
strstriFunction · 0.85
mon_in_roomFunction · 0.85
tended_shopFunction · 0.85
noisy_shopFunction · 0.85

Tested by

no test coverage detected