From 8bbe9282aa486a5b04a8ee0cdfdce77d1942e8b7 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 20 Jan 2023 14:18:48 -0500 Subject: [PATCH] add soundeffects hooks to core Insert the calls to trigger a number of potential soundeffects into the core. If no additional soundlib support is integrated into the build, then the Soundeffect macro (sndprocs.h) expands to nothing: [#define Soundeffect(seid, vol) ] If, however, at least one additional soundlib support is integrated into the build, then the Soundeffect macro gets defined as this in sndprocs.h: [#define Soundeffect(seid, vol) \ do { \ if (!Deaf && soundprocs.sound_soundeffect \ && ((soundprocs.sndcap & SNDCAP_SOUNDEFFECTS) != 0)) \ (*soundprocs.sound_soundeffect)(emptystr, (seid), (vol)); \ } while(0) ] That macro definition checks for the hero not being Deaf; it checks to ensure that the active soundlib interface has a non-null sound_soundeffect() function pointer; and it checks to ensure that the active soundlib interface has declared that it supports soundeffects by setting the SNDCAP_SOUNDEFFECTS bit in its sndcap entry. That just means that the interface routines are prepared to accept and deal with the calls from the core, whether or not it actually produces the desired soundeffect. --- include/sndprocs.h | 200 +++++++++++++++++++++++++++++++++++++++++++++ src/apply.c | 26 ++++-- src/ball.c | 2 + src/dbridge.c | 45 ++++++---- src/dig.c | 12 ++- src/do.c | 26 ++++-- src/dokick.c | 23 +++++- src/eat.c | 8 +- src/explode.c | 15 +++- src/fountain.c | 24 ++++-- src/hack.c | 3 + src/lock.c | 21 +++-- src/mcastu.c | 8 +- src/mhitu.c | 11 ++- src/mkobj.c | 1 + src/mon.c | 14 +++- src/monmove.c | 30 ++++--- src/mthrowu.c | 14 +++- src/muse.c | 16 +++- src/music.c | 20 +++-- src/potion.c | 2 + src/pray.c | 2 + src/read.c | 7 +- src/shk.c | 14 +++- src/sounds.c | 19 ++++- src/spell.c | 4 +- src/timeout.c | 1 + src/trap.c | 32 +++++++- src/uhitm.c | 7 +- src/were.c | 4 +- src/worn.c | 16 ++-- src/zap.c | 8 +- 32 files changed, 529 insertions(+), 106 deletions(-) diff --git a/include/sndprocs.h b/include/sndprocs.h index e351342df..ef319269b 100644 --- a/include/sndprocs.h +++ b/include/sndprocs.h @@ -177,4 +177,204 @@ enum instruments_broad { ins_fencepost }; #endif + +enum sound_effect_entries { + se_faint_splashing = 1, + se_crackling_of_hellfire = 2, + se_heart_beat = 3, + se_typing_noise = 4, + se_hollow_sound = 5, + se_rustling_paper = 6, + se_crushing_sound = 7, + se_splash = 8, + se_chains_rattling_gears_turning = 9, + se_smashing_and_crushing = 10, + se_gears_turning_chains_rattling = 11, + se_loud_splash = 12, + se_lound_crash = 13, + se_crashing_rock = 14, + se_sizzling = 15, + se_crashing_boulder = 16, + se_boulder_drop = 17, + se_item_tumble_downwards = 18, + se_drain_noises = 19, + se_ring_in_drain = 20, + se_groans_and_moans = 21, + se_scratching = 22, + se_glass_shattering = 23, + se_egg_cracking = 24, + se_gushing_sound = 25, + se_glass_crashing = 26, + se_egg_splatting = 27, + se_sinister_laughter = 28, + se_blast = 29, + se_stone_breaking = 30, + se_stone_crumbling = 31, + se_snakes_hissing = 32, + se_loud_pop = 33, + se_clanking_pipe = 34, + se_sewer_song = 35, + se_monster_behind_boulder = 36, + se_wailing_of_the_banshee = 37, + se_swoosh = 38, + se_explosion = 39, + se_crashing_sound = 40, + se_someone_summoning = 41, + se_rushing_wind_noise = 42, + se_splat_from_engulf = 43, + se_faint_sloshing = 44, + se_crunching_sound = 45, + se_slurping_sound = 46, + se_masticating_sound = 47, + se_distant_thunder = 48, + se_applause = 49, + se_shrill_whistle = 50, + se_someone_yells = 51, + se_door_unlock_and_open = 52, + se_door_open = 53, + se_door_crash_open = 54, + se_dry_throat_rattle = 55, + se_cough = 56, + se_angry_snakes = 57, + se_zap_then_explosion = 58, + se_zap = 59, + se_horn_being_played = 60, + se_mon_chugging_potion = 61, + se_bugle_playing_reveille = 62, + se_crash_through_floor = 63, + se_thump = 64, + se_scream = 65, + se_tumbler_click = 66, + se_gear_turn = 67, + se_divine_music = 68, + se_thunderclap = 69, + se_sad_wailing = 70, + se_maniacal_laughter = 71, + se_rumbling_of_earth = 72, + se_clanging_sound = 73, + se_mutter_imprecations = 74, + se_mutter_incantation = 75, + se_angry_voice = 76, + se_sceptor_pounding = 77, + se_courtly_conversation = 78, + se_low_buzzing = 79, + se_angry_drone = 80, + se_bees = 81, + se_someone_searching = 82, + se_guards_footsteps = 83, + se_faint_chime = 84, + se_loud_click = 85, + se_soft_click = 86, + se_squeak = 87, + se_squeak_C = 88, + se_squeak_D_flat = 89, + se_squeak_D = 90, + se_squeak_E_flat = 91, + se_squeak_E = 92, + se_squeak_F = 93, + se_squeak_F_sharp = 94, + se_squeak_G = 95, + se_squeak_G_sharp = 96, + se_squeak_A = 97, + se_squeak_B_flat = 98, + se_squeak_B = 99, + se_someone_bowling = 100, + se_rumbling = 101, + se_loud_crash = 102, + se_deafening_roar_atmospheric = 103, + se_low_hum = 104, + se_laughter = 105, + se_cockatrice_hiss = 106, + se_chant = 107, + se_cracking_sound = 108, + se_ripping_sound = 109, + se_thud = 110, + se_clank = 111, + se_crumbling_sound = 112, + se_soft_crackling = 113, + se_crackling = 114, + se_sharp_crack = 115, + se_wall_of_force = 116, + se_alarm = 117, + se_kick_door_it_shatters = 118, + se_kick_door_it_crashes_open = 119, + se_bubble_rising = 120, + se_bolt_of_lightning = 121, + se_board_squeak = 122, + se_board_squeaks_loudly = 123, + se_boing = 124, + se_crashed_ceiling = 125, + se_clash = 126, + se_crash_door = 127, + se_crash = 128, + se_crash_throne_destroyed = 129, + se_crash_something_broke = 130, + se_kadoom_boulder_falls_in = 131, + se_klunk_pipe = 132, + se_kerplunk_boulder_gone = 133, + se_klunk = 134, + se_klick = 135, + se_kaboom_door_explodes = 136, + se_kaboom_boom_boom = 137, + se_kaablamm_of_mine = 138, + se_kaboom = 139, + se_splat_egg = 140, + se_destroy_web = 141, + se_iron_ball_dragging_you = 142, + se_iron_ball_hits_you = 143, + se_lid_slams_open_falls_shut = 144, + se_chain_shatters = 145, + se_furious_bubbling = 146, + se_air_crackles = 147, + se_potion_crash_and_break = 148, + se_hiss = 149, + se_growl = 150, + se_canine_bark = 151, + se_canine_growl = 152, + se_canine_whine = 153, + se_canine_yip = 154, + se_canine_howl = 155, + se_feline_yowl = 156, + se_feline_meow = 157, + se_feline_purr = 158, + se_feline_yip = 159, + se_feline_mew = 160, + se_roar = 161, + se_snarl = 162, + se_buzz = 163, + se_squeek = 164, + se_squawk = 165, + se_squeal = 166, + se_screech = 167, + se_equine_neigh = 168, + se_equine_whinny = 169, + se_equine_whicker = 170, + se_bovine_moo = 171, + se_bovine_bellow = 172, + se_wail = 173, + se_groan = 174, + se_grunt = 175, + se_gurgle = 176, + se_elephant_trumpet = 177, + se_snake_rattle = 178, + se_hallu_growl = 179, +}; + +#if defined(SND_LIB_QTSOUND) || defined(SND_LIB_PORTAUDIO) \ + || defined(SND_LIB_OPENAL) || defined(SND_LIB_SDL_MIXER) \ + || defined(SND_LIB_MINIAUDIO) || defined(SND_LIB_FMOD) \ + || defined(SND_LIB_SOUND_ESCCODES) || defined(SND_LIB_VISSOUND) \ + || defined(SND_LIB_WINDSOUND) + +#define Soundeffect(seid, vol) \ + do { \ + if (!Deaf && soundprocs.sound_soundeffect \ + && ((soundprocs.sndcap & SNDCAP_SOUNDEFFECTS) != 0)) \ + (*soundprocs.sound_soundeffect)(emptystr, (seid), (vol)); \ + } while(0) + +#else +#define Soundeffect(seid, vol) +#endif + #endif /* SNDPROCS_H */ diff --git a/src/apply.c b/src/apply.c index 9b8804ff0..8d07e9f6e 100644 --- a/src/apply.c +++ b/src/apply.c @@ -343,18 +343,22 @@ use_stethoscope(struct obj *obj) mstatusline(u.ustuck); return res; } else if (u.dz) { - if (Underwater) + if (Underwater) { + Soundeffect(se_faint_splashing, 35); You_hear("faint splashing."); - else if (u.dz < 0 || !can_reach_floor(TRUE)) + } else if (u.dz < 0 || !can_reach_floor(TRUE)) { cant_reach_floor(u.ux, u.uy, (u.dz < 0), TRUE); - else if (its_dead(u.ux, u.uy, &res)) + } else if (its_dead(u.ux, u.uy, &res)) { ; /* message already given */ - else if (Is_stronghold(&u.uz)) + } else if (Is_stronghold(&u.uz)) { + Soundeffect(se_crackling_of_hellfire, 35); You_hear("the crackling of hellfire."); - else + } else { pline_The("%s seems healthy enough.", surface(u.ux, u.uy)); + } return res; } else if (obj->cursed && !rn2(2)) { + Soundeffect(se_heart_beat, 100); You_hear("your heart beat."); return res; } @@ -366,6 +370,7 @@ use_stethoscope(struct obj *obj) rx = u.ux + u.dx; ry = u.uy + u.dy; if (!isok(rx, ry)) { + Soundeffect(se_typing_noise, 100); You_hear("a faint typing noise."); return ECMD_OK; } @@ -431,6 +436,7 @@ use_stethoscope(struct obj *obj) lev = &levl[rx][ry]; switch (lev->typ) { case SDOOR: + Soundeffect(se_hollow_sound, 100); You_hear(hollow_str, "door"); cvt_sdoor_to_door(lev); /* ->typ = DOOR */ feel_newsym(rx, ry); @@ -3757,6 +3763,7 @@ do_break_wand(struct obj *obj) goto discard_broken_wand; case WAN_STRIKING: /* we want this before the explosion instead of at the very end */ + Soundeffect(se_wall_of_force, 65); pline("A wall of force smashes down around you!"); dmg = d(1 + obj->spe, 6); /* normally 2d12 */ /*FALLTHRU*/ @@ -4202,14 +4209,17 @@ flip_through_book(struct obj *obj) You("flip through the pages of %s.", thesimpleoname(obj)); if (obj->otyp == SPE_BOOK_OF_THE_DEAD) { - if (!Deaf) + if (!Deaf) { + if (!Hallucination) + Soundeffect(se_rustling_paper, 50); You_hear("the pages make an unpleasant %s sound.", Hallucination ? "chuckling" : "rustling"); - else if (!Blind) + } else if (!Blind) { You_see("the pages glow faintly %s.", hcolor(NH_RED)); - else + } else { You_feel("the pages tremble."); + } } else if (Blind) { pline("The pages feel %s.", Hallucination ? "freshly picked" diff --git a/src/ball.c b/src/ball.c index 1ae701e89..252b93c99 100644 --- a/src/ball.c +++ b/src/ball.c @@ -902,6 +902,7 @@ drop_ball(coordxy x, coordxy y) break; case TT_WEB: pline(pullmsg, "web"); + Soundeffect(se_destroy_web, 30); pline_The("web is destroyed!"); deltrap(t_at(u.ux, u.uy)); break; @@ -1015,6 +1016,7 @@ drag_down(void) } } else { if (rn2(2)) { + Soundeffect(se_iron_ball_hits_you, 25); pline_The("iron ball smacks into you!"); losehp(Maybe_Half_Phys(rnd(20)), "iron ball collision", KILLED_BY_AN); diff --git a/src/dbridge.c b/src/dbridge.c index 39653032f..0d0570b96 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -585,11 +585,13 @@ do_entity(struct entity *etmp) relocates = TRUE; debugpline0("Jump succeeds!"); } else { - if (e_inview) + if (e_inview) { pline("%s crushed by the falling portcullis!", E_phrase(etmp, "are")); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_crushing_sound, 100); You_hear("a crushing sound."); + } e_died(etmp, XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG), @@ -693,8 +695,10 @@ do_entity(struct entity *etmp) } else { debugpline1("%s on drawbridge square", E_phrase(etmp, "are")); if (is_pool(etmp->ex, etmp->ey) && !e_inview) - if (!Deaf) + if (!Deaf) { + Soundeffect(se_splash, 100); You_hear("a splash."); + } if (e_survives_at(etmp, etmp->ex, etmp->ey)) { if (e_inview && !is_flyer(etmp->edata) && !is_floater(etmp->edata)) @@ -745,14 +749,16 @@ close_drawbridge(coordxy x, coordxy y) x2 = x; y2 = y; get_wall_for_db(&x2, &y2); - if (cansee(x, y) || cansee(x2, y2)) + if (cansee(x, y) || cansee(x2, y2)) { You_see("a drawbridge %s up!", (((u.ux == x || u.uy == y) && !Underwater) || distu(x2, y2) < distu(x, y)) ? "coming" : "going"); - else /* "5 gears turn" for castle drawbridge tune */ + } else { /* "5 gears turn" for castle drawbridge tune */ + Soundeffect(se_chains_rattling_gears_turning, 75); You_hear("chains rattling and gears turning."); + } lev1->typ = DRAWBRIDGE_UP; lev2 = &levl[x2][y2]; lev2->typ = DBWALL; @@ -772,8 +778,10 @@ close_drawbridge(coordxy x, coordxy y) do_entity(&(go.occupants[0])); /* Do set_entity after first */ set_entity(x2, y2, &(go.occupants[1])); /* do_entity for worm tail */ do_entity(&(go.occupants[1])); - if (OBJ_AT(x, y) && !Deaf) + if (OBJ_AT(x, y) && !Deaf) { + Soundeffect(se_smashing_and_crushing, 75); You_hear("smashing and crushing."); + } (void) revive_nasty(x, y, (char *) 0); (void) revive_nasty(x2, y2, (char *) 0); delallobj(x, y); @@ -806,11 +814,13 @@ open_drawbridge(coordxy x, coordxy y) x2 = x; y2 = y; get_wall_for_db(&x2, &y2); - if (cansee(x, y) || cansee(x2, y2)) + if (cansee(x, y) || cansee(x2, y2)) { You_see("a drawbridge %s down!", (distu(x2, y2) < distu(x, y)) ? "going" : "coming"); - else /* "5 gears turn" for castle drawbridge tune */ + } else { /* "5 gears turn" for castle drawbridge tune */ + Soundeffect(se_gears_turning_chains_rattling, 100); You_hear("gears turning and chains rattling."); + } lev1->typ = DRAWBRIDGE_DOWN; lev2 = &levl[x2][y2]; lev2->typ = DOOR; @@ -863,17 +873,21 @@ destroy_drawbridge(coordxy x, coordxy y) boolean lava = (lev1->drawbridgemask & DB_UNDER) == DB_LAVA; if (lev1->typ == DRAWBRIDGE_UP) { - if (cansee(x2, y2)) + if (cansee(x2, y2)) { pline_The("portcullis of the drawbridge falls into the %s!", lava ? hliquid("lava") : "moat"); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_loud_splash, 100); You_hear("a loud *SPLASH*!"); + } } else { - if (cansee(x, y)) + if (cansee(x, y)) { pline_The("drawbridge collapses into the %s!", lava ? hliquid("lava") : "moat"); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_loud_splash, 100); You_hear("a loud *SPLASH*!"); + } } lev1->typ = lava ? LAVAPOOL : MOAT; lev1->drawbridgemask = 0; @@ -882,10 +896,12 @@ destroy_drawbridge(coordxy x, coordxy y) (void) flooreffects(otmp2, x, y, "fall"); } } else { - if (cansee(x, y)) + if (cansee(x, y)) { pline_The("drawbridge disintegrates!"); - else + } else { + Soundeffect(se_lound_crash, 100); You_hear("a loud *CRASH*!"); + } lev1->typ = ((lev1->drawbridgemask & DB_ICE) ? ICE : ROOM); lev1->icedpool = ((lev1->drawbridgemask & DB_ICE) ? ICED_MOAT : 0); } @@ -949,6 +965,7 @@ destroy_drawbridge(coordxy x, coordxy y) E_phrase(etmp1, "are")); } else { if (!Deaf && !is_u(etmp1) && !is_pool(x, y)) { + Soundeffect(se_crushing_sound, 75); You_hear("a crushing sound."); } else { debugpline1("%s from shrapnel", E_phrase(etmp1, "die")); diff --git a/src/dig.c b/src/dig.c index 9131b38be..78a881a4c 100644 --- a/src/dig.c +++ b/src/dig.c @@ -92,11 +92,13 @@ mkcavearea(boolean rockit) register coordxy i; register boolean waslit = rm_waslit(); - if (rockit) + if (rockit) { + Soundeffect(se_crashing_rock, 100); pline("Crash! The ceiling collapses around you!"); - else + } else { pline("A mysterious force %s cave around you!", (levl[u.ux][u.uy].typ == CORR) ? "creates a" : "extends the"); + } display_nhwindow(WIN_MESSAGE, TRUE); for (dist = 1; dist <= 2; dist++) { @@ -831,6 +833,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) * digging makes a hole, but the boulder immediately * fills it. Final outcome: no hole, no boulder. */ + Soundeffect(se_kadoom_boulder_falls_in, 60); pline("KADOOM! The boulder falls in!"); wake_nearby(); (void) delfloortrap(ttmp); @@ -1066,6 +1069,7 @@ use_pick_axe2(struct obj *obj) rx = u.ux + u.dx; ry = u.uy + u.dy; if (!isok(rx, ry)) { + Soundeffect(se_clash, 40); pline("Clash!"); return ECMD_TIME; } @@ -1314,8 +1318,10 @@ mdig_tunnel(struct monst *mtmp) if (IS_WALL(here->typ)) { /* KMH -- Okay on arboreal levels (room walls are still stone) */ - if (Verbose(0, mdig_tunnel2) && !rn2(5)) + if (Verbose(0, mdig_tunnel2) && !rn2(5)) { + Soundeffect(se_crashing_rock, 75); You_hear("crashing rock."); + } if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE)) add_damage(mtmp->mx, mtmp->my, 0L); if (gl.level.flags.is_maze_lev) { diff --git a/src/do.c b/src/do.c index 64c001e83..0256489d3 100644 --- a/src/do.c +++ b/src/do.c @@ -110,6 +110,10 @@ boulder_hits_pool( the(xname(otmp)), fills_up ? "fills" : "falls into", what); } else if (!Deaf) { + if (lava) + Soundeffect(se_sizzling, 100); + else + Soundeffect(se_splash, 100); You_hear("a%s splash.", lava ? " sizzling" : ""); } wake_nearto(rx, ry, 40); @@ -224,6 +228,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb) } if (*verb) { if (Blind && u_at(x, y)) { + Soundeffect(se_crashing_boulder, 100); You_hear("a CRASH! beneath you."); } else if (!Blind && cansee(x, y)) { pline_The("boulder %s%s.", @@ -234,6 +239,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb) : (ttyp == HOLE) ? "plugs a hole" : "fills a pit"); } else { + Soundeffect(se_boulder_drop, 100); You_hear("a boulder %s.", verb); } } @@ -269,11 +275,13 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb) } else if (u_at(x, y) && (t = t_at(x, y)) != 0 && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) { if (is_pit(t->ttyp)) { - if (Blind && !Deaf) + if (Blind && !Deaf) { + Soundeffect(se_item_tumble_downwards, 50); You_hear("%s tumble downwards.", the(xname(obj))); - else + } else { pline("%s into %s pit.", Tobjnam(obj, "tumble"), the_your[t->madeby_u]); + } } else if (ship_object(obj, x, y, FALSE)) { /* ship_object will print an appropriate "the item falls * through the hole" message, so no need to do it here. */ @@ -458,6 +466,7 @@ dosinkring(struct obj *obj) pline("Static electricity surrounds the sink."); break; case RIN_CONFLICT: + Soundeffect(se_drain_noises, 50); You_hear("loud noises coming from the drain."); break; case RIN_SUSTAIN_ABILITY: /* KMH */ @@ -569,11 +578,12 @@ dosinkring(struct obj *obj) break; } } - if (ideed) + if (ideed) { trycall(obj); - else if (!nosink) + } else if (!nosink) { + Soundeffect(se_ring_in_drain, 50); You_hear("the ring bouncing down the drainpipe."); - + } if (!rn2(20) && !nosink) { pline_The("sink backs up, leaving %s.", doname(obj)); obj->in_use = FALSE; @@ -1741,6 +1751,7 @@ goto_level( #ifdef MICRO display_nhwindow(WIN_MESSAGE, FALSE); #endif + Soundeffect(se_groans_and_moans, 25); You_hear("groans and moans everywhere."); } @@ -1769,6 +1780,7 @@ goto_level( /* alarm stops working once Croesus has died */ if (new || !gm.mvitals[PM_CROESUS].died) { You("have penetrated a high security area!"); + Soundeffect(se_alarm, 100); pline("An alarm sounds!"); for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) @@ -2066,8 +2078,10 @@ revive_corpse(struct obj *corpse) pline("%s claws itself out of the ground!", canspotmon(mtmp) ? Amonnam(mtmp) : Something); newsym(mtmp->mx, mtmp->my); - } else if (mdistu(mtmp) < 5*5) + } else if (mdistu(mtmp) < 5*5) { + Soundeffect(se_scratching, 50); You_hear("scratching noises."); + } break; } /*FALLTHRU*/ diff --git a/src/dokick.c b/src/dokick.c index 57bac58ed..c74653b7c 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -434,6 +434,11 @@ container_impact_dmg( * but it's always exactly 1 that breaks */ if (otmp->otyp == EGG && otmp->spe && otmp->corpsenm >= LOW_PM) change_luck(-1); + if (otmp->otyp == EGG) { + Soundeffect(se_egg_cracking, 25); + } else { + Soundeffect(se_glass_shattering, 25); + } You_hear("a muffled %s.", result); if (costly) { if (frominv && !otmp->unpaid) @@ -1089,6 +1094,7 @@ dokick(void) if (gm.maploc->typ == SDOOR) { if (!Levitation && rn2(30) < avrg_attrib) { cvt_sdoor_to_door(gm.maploc); /* ->typ = DOOR */ + Soundeffect(se_crash_door, 40); pline("Crash! %s a secret door!", /* don't "kick open" when it's locked unless it also happens to be trapped */ @@ -1114,6 +1120,7 @@ dokick(void) } if (gm.maploc->typ == SCORR) { if (!Levitation && rn2(30) < avrg_attrib) { + Soundeffect(se_crash_door, 40); pline("Crash! You kick open a secret passage!"); exercise(A_DEX, TRUE); gm.maploc->typ = CORR; @@ -1135,6 +1142,7 @@ dokick(void) gm.maploc->looted = 0; /* don't leave loose ends.. */ gm.maploc->typ = ROOM; (void) mkgold((long) rnd(200), x, y); + Soundeffect(se_crash_throne_destroyed, 60); if (Blind) pline("CRASH! You destroy it."); else { @@ -1303,6 +1311,7 @@ dokick(void) return ECMD_TIME; } if (rn2(5)) { + Soundeffect(se_klunk_pipe, 60); if (!Deaf) pline("Klunk! The pipes vibrate noisily."); else @@ -1311,11 +1320,14 @@ dokick(void) return ECMD_TIME; } else if (!(gm.maploc->looted & S_LPUDDING) && !rn2(3) && !(gm.mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) { - if (Blind) + if (Blind) { + if (!Deaf) + Soundeffect(se_gushing_sound, 100); You_hear("a gushing sound."); - else + } else { pline("A %s ooze gushes up from the drain!", hcolor(NH_BLACK)); + } (void) makemon(&mons[PM_BLACK_PUDDING], x, y, MM_NOMSG); exercise(A_DEX, TRUE); newsym(x, y); @@ -1394,10 +1406,12 @@ dokick(void) gm.maploc->doormask = D_NODOOR; b_trapped("door", FOOT); } else if (ACURR(A_STR) > 18 && !rn2(5) && !shopdoor) { + Soundeffect(se_kick_door_it_shatters, 50); pline("As you kick the door, it shatters to pieces!"); exercise(A_STR, TRUE); gm.maploc->doormask = D_NODOOR; } else { + Soundeffect(se_kick_door_it_crashes_open, 50); pline("As you kick the door, it crashes open!"); exercise(A_STR, TRUE); gm.maploc->doormask = D_BROKEN; @@ -1683,6 +1697,11 @@ ship_object(struct obj *otmp, coordxy x, coordxy y, boolean shop_floor_obj) change_luck((schar) -min(otmp->quan, 5L)); result = "splat"; } + if (otmp->otyp == EGG) { + Soundeffect(se_egg_splatting, 25); + } else { + Soundeffect(se_glass_crashing, 25); + } You_hear("a muffled %s.", result); obj_extract_self(otmp); obfree(otmp, (struct obj *) 0); diff --git a/src/eat.c b/src/eat.c index 68bd9f499..8568e3be7 100644 --- a/src/eat.c +++ b/src/eat.c @@ -2447,12 +2447,14 @@ fpostfx(struct obj *otmp) /* Snow White; 'poisoned' applies to [a subset of] weapons, not food, so we substitute cursed; fortunately our hero won't have to wait for a prince to be rescued/revived */ - if (Race_if(PM_DWARF) && Hallucination) + if (Race_if(PM_DWARF) && Hallucination) { verbalize("Heigh-ho, ho-hum, I think I'll skip work today."); - else if (Deaf || !flags.acoustics) + } else if (Deaf || !flags.acoustics) { You("fall asleep."); - else + } else { + Soundeffect(se_sinister_laughter, 100); You_hear("sinister laughter as you fall asleep..."); + } fall_asleep(-rn1(11, 20), TRUE); } break; diff --git a/src/explode.c b/src/explode.c index a7908983a..32a146542 100644 --- a/src/explode.c +++ b/src/explode.c @@ -376,6 +376,7 @@ explode( generic = TRUE; } if (!Deaf && olet != SCROLL_CLASS) { + Soundeffect(se_blast, 75); You_hear("a blast."); didmsg = TRUE; } @@ -731,6 +732,8 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */ while ((otmp = (individual_object ? obj : gl.level.objects[sx][sy])) != 0) { if (otmp == uball || otmp == uchain) { boolean waschain = (otmp == uchain); + + Soundeffect(se_chain_shatters, 25); pline_The("chain shatters!"); unpunish(); if (waschain) @@ -753,10 +756,12 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */ && (otmp->otyp == BOULDER || otmp->otyp == STATUE) && rn2(10)) { if (otmp->otyp == BOULDER) { - if (cansee(sx, sy)) + if (cansee(sx, sy)) { pline("%s apart.", Tobjnam(otmp, "break")); - else + } else { + Soundeffect(se_stone_breaking, 100); You_hear("stone breaking."); + } fracture_rock(otmp); place_object(otmp, sx, sy); if ((otmp = sobj_at(BOULDER, sx, sy)) != 0) { @@ -769,10 +774,12 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */ if ((trap = t_at(sx, sy)) && trap->ttyp == STATUE_TRAP) deltrap(trap); - if (cansee(sx, sy)) + if (cansee(sx, sy)) { pline("%s.", Tobjnam(otmp, "crumble")); - else + } else { + Soundeffect(se_stone_crumbling, 100); You_hear("stone crumbling."); + } (void) break_statue(otmp); place_object(otmp, sx, sy); /* put fragments on floor */ } diff --git a/src/fountain.c b/src/fountain.c index 800e35a79..729c6ba16 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -41,18 +41,22 @@ dowatersnakes(void) struct monst *mtmp; if (!(gm.mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) { - if (!Blind) + if (!Blind) { pline("An endless stream of %s pours forth!", Hallucination ? makeplural(rndmonnam(NULL)) : "snakes"); - else + } else { + Soundeffect(se_snakes_hissing, 75); You_hear("%s hissing!", something); + } while (num-- > 0) if ((mtmp = makemon(&mons[PM_WATER_MOCCASIN], u.ux, u.uy, MM_NOMSG)) != 0 && t_at(mtmp->mx, mtmp->my)) (void) mintrap(mtmp, NO_TRAP_FLAGS); - } else + } else { + Soundeffect(se_furious_bubbling, 20); pline_The("fountain bubbles furiously for a moment, then calms."); + } } /* Water demon */ @@ -79,8 +83,10 @@ dowaterdemon(void) } else if (t_at(mtmp->mx, mtmp->my)) (void) mintrap(mtmp, NO_TRAP_FLAGS); } - } else + } else { + Soundeffect(se_furious_bubbling, 20); pline_The("fountain bubbles furiously for a moment, then calms."); + } } /* Water Nymph */ @@ -99,10 +105,14 @@ dowaternymph(void) mtmp->msleeping = 0; if (t_at(mtmp->mx, mtmp->my)) (void) mintrap(mtmp, NO_TRAP_FLAGS); - } else if (!Blind) + } else if (!Blind) { + Soundeffect(se_bubble_rising, 50); + Soundeffect(se_loud_pop, 50); pline("A large bubble rises to the surface and pops."); - else + } else { + Soundeffect(se_loud_pop, 50); You_hear("a loud pop."); + } } /* Gushing forth along LOS from (u.ux, u.uy) */ @@ -633,9 +643,11 @@ drinksink(void) break; /* more odd messages --JJB */ case 11: + Soundeffect(se_clanking_pipe, 50); You_hear("clanking from the pipes..."); break; case 12: + Soundeffect(se_sewer_song, 100); You_hear("snatches of song from among the sewers..."); break; case 13: diff --git a/src/hack.c b/src/hack.c index 43a2e9027..30cd2f7ec 100644 --- a/src/hack.c +++ b/src/hack.c @@ -271,6 +271,7 @@ moverock(void) pline("There's %s on the other side.", a_monnam(mtmp)); deliver_part1 = TRUE; } else { + Soundeffect(se_monster_behind_boulder, 50); You_hear("a monster behind %s.", the(xname(otmp))); if (!Deaf) deliver_part1 = TRUE; @@ -342,6 +343,7 @@ moverock(void) goto moverock_done; case HOLE: case TRAPDOOR: + Soundeffect(se_kerplunk_boulder_gone, 40); if (Blind) pline("Kerplunk! You no longer feel %s.", the(xname(otmp))); @@ -3677,6 +3679,7 @@ maybe_wail(void) who); } } else { + Soundeffect(se_wailing_of_the_banshee, 75); You_hear(u.uhp == 1 ? "the wailing of the Banshee..." : "the howling of the CwnAnnwn..."); } diff --git a/src/lock.c b/src/lock.c index 824a37683..16f9daba7 100644 --- a/src/lock.c +++ b/src/lock.c @@ -1040,6 +1040,7 @@ boxlock(struct obj *obj, struct obj *otmp) /* obj *is* a box */ case WAN_LOCKING: case SPE_WIZARD_LOCK: if (!obj->olocked) { /* lock it; fix if broken */ + Soundeffect(se_klunk, 50); pline("Klunk!"); obj->olocked = 1; obj->obroken = 0; @@ -1053,6 +1054,7 @@ boxlock(struct obj *obj, struct obj *otmp) /* obj *is* a box */ case WAN_OPENING: case SPE_KNOCK: if (obj->olocked) { /* unlock; couldn't be broken */ + pline("Klick!"); pline("Klick!"); obj->olocked = 0; res = 1; @@ -1115,11 +1117,13 @@ doorlock(struct obj *otmp, coordxy x, coordxy y) boolean vis = cansee(x, y); /* Can't have real locking in Rogue, so just hide doorway */ - if (vis) + if (vis) { pline("%s springs up in the older, more primitive doorway.", dustcloud); - else + } else { + Soundeffect(se_swoosh, 25); You_hear("a swoosh."); + } if (obstructed(x, y, mysterywand)) { if (vis) pline_The("cloud %s.", quickly_dissipates); @@ -1193,12 +1197,15 @@ doorlock(struct obj *otmp, coordxy x, coordxy y) /* for mtmp, mb_trapped() does is own wake_nearto() */ loudness = 40; if (Verbose(1, doorlock1)) { - if ((sawit || seeit) && !Unaware) + Soundeffect(se_kaboom_door_explodes, 75); + if ((sawit || seeit) && !Unaware) { pline("KABOOM!! You see a door explode."); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_explosion, 75); You_hear("a %s explosion.", (distu(x, y) > 7 * 7) ? "distant" : "nearby"); + } } } break; @@ -1209,10 +1216,12 @@ doorlock(struct obj *otmp, coordxy x, coordxy y) seeit = cansee(x, y); newsym(x, y); if (Verbose(1, doorlock2)) { - if ((sawit || seeit) && !Unaware) + if ((sawit || seeit) && !Unaware) { pline_The("door crashes open!"); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_crashing_sound, 100); You_hear("a crashing sound."); + } } /* force vision recalc before printing more messages */ if (gv.vision_full_recalc) diff --git a/src/mcastu.c b/src/mcastu.c index ad68d88d9..fdb297113 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -246,6 +246,7 @@ castmu( nomul(0); if (rn2(ml * 10) < (mtmp->mconf ? 100 : 20)) { /* fumbled attack */ + Soundeffect(se_air_crackles, 60); if (canseemon(mtmp) && !Deaf) pline_The("air crackles around %s.", mon_nam(mtmp)); return MM_MISS; @@ -578,6 +579,7 @@ cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum) case CLC_LIGHTNING: { boolean reflects; + Soundeffect(se_bolt_of_lightning, 80); pline("A bolt of lightning strikes down at you from above!"); reflects = ureflects("It bounces off your %s%s.", ""); if (reflects || Shock_resistance) { @@ -650,11 +652,13 @@ cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum) /* unseen caster summoned seen critter(s) */ arg = (newseen == oldseen + 1) ? an(makesingular(what)) : whatbuf; - if (!Deaf) + if (!Deaf) { + Soundeffect(se_someone_summoning, 100); You_hear("someone summoning something, and %s %s.", arg, vtense(arg, "appear")); - else + } else { pline("%s %s.", upstart(arg), vtense(arg, "appear")); + } } /* seen caster, possibly producing unseen--or just one--critters; diff --git a/src/mhitu.c b/src/mhitu.c index 0658c2287..d8e26bc98 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -739,12 +739,16 @@ mattacku(register struct monst *mtmp) } else if (digests(mtmp->data)) { pline("%s gulps some air!", Monnam(mtmp)); } else { - if (youseeit) + if (youseeit) { pline("%s lunges forward and recoils!", Monnam(mtmp)); - else + } else { + if (is_whirly(mtmp->data)) { + Soundeffect(se_rushing_wind_noise, 60); + } You_hear("a %s nearby.", is_whirly(mtmp->data) ? "rushing noise" : "splat"); + } } } break; @@ -876,7 +880,8 @@ summonmu(struct monst *mtmp, boolean youseeit) const char *from_nowhere; if (!Deaf) { - pline("%s %s!", Something, makeplural(growl_sound(mtmp))); + pline("%s %s!", Something, + makeplural(growl_sound(mtmp))); from_nowhere = ""; } else { from_nowhere = " from nowhere"; diff --git a/src/mkobj.c b/src/mkobj.c index 9eb3dac93..42181f273 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -3497,6 +3497,7 @@ pudding_merge_message(struct obj *otmp, struct obj *otmp2) inpack ? " inside your pack" : ""); } } else { + Soundeffect(se_faint_sloshing, 25); You_hear("a faint sloshing sound."); } } diff --git a/src/mon.c b/src/mon.c index 48d5d7d47..4fbc5c697 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1179,8 +1179,10 @@ meatmetal(struct monst *mtmp) if (Verbose(1, meatmetal3)) pline("%s eats %s!", Monnam(mtmp), otmpname); } else { - if (Verbose(1, meatmetal4)) + if (Verbose(1, meatmetal4)) { + Soundeffect(se_crunching_sound, 50); You_hear("a crunching sound."); + } } mtmp->meating = otmp->owt / 2 + 1; /* Heal up to the object's weight in hp */ @@ -1338,6 +1340,7 @@ meatobj(struct monst* mtmp) /* for gelatinous cubes */ if (otmp->otyp == CORPSE) mon_givit(mtmp, &mons[otmp->corpsenm]); } else { + Soundeffect(se_slurping_sound, 30); if (Verbose(2, meatobj2)) You_hear("a slurping sound."); } @@ -1440,6 +1443,7 @@ meatcorpse( if (Verbose(2, meatcorpse1)) pline("%s eats %s!", Monnam(mtmp), otmpname); } else { + Soundeffect(se_masticating_sound, 50); if (Verbose(2, meatcorpse2)) You_hear("a masticating sound."); } @@ -3248,10 +3252,13 @@ xkilled( } else if (mtmp->mtame) { adjalign(-15); /* bad!! */ /* your god is mighty displeased... */ - if (!Hallucination) + if (!Hallucination) { + Soundeffect(se_distant_thunder, 40); You_hear("the rumble of distant thunder..."); - else + } else { + Soundeffect(se_applause, 40); You_hear("the studio audience applaud!"); + } if (!unique_corpstat(mdat)) { boolean mname = has_mgivenname(mtmp); @@ -5017,6 +5024,7 @@ angry_guards(boolean silent) buf, vtense(buf, "are")); } else { Strcpy(buf, (ct == 1) ? "a guard's" : "guards'"); + Soundeffect(se_shrill_whistle, 100); You_hear("the shrill sound of %s whistle%s.", buf, plur(ct)); } } diff --git a/src/monmove.c b/src/monmove.c index bcdffa4ea..c0f71b7cc 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -92,10 +92,12 @@ mon_yells(struct monst* mon, const char* shout) nolimbs(mon->data) ? mbodypart(mon, HEAD) : makeplural(mbodypart(mon, ARM))); } else { - if (canspotmon(mon)) + if (canspotmon(mon)) { pline("%s yells:", Amonnam(mon)); - else + } else { + Soundeffect(se_someone_yells, 75); You_hear("someone yell:"); + } verbalize1(shout); } } @@ -1625,13 +1627,15 @@ m_move(register struct monst* mtmp, register int after) return MMOVE_DIED; } else { if (Verbose(2, m_move2)) { - if (canseeit && canspotmon(mtmp)) + if (canseeit && canspotmon(mtmp)) { pline("%s unlocks and opens a door.", Monnam(mtmp)); - else if (canseeit) + } else if (canseeit) { You_see("a door unlock and open."); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_door_unlock_and_open, 50); You_hear("a door unlock and open."); + } } } } else if (here->doormask == D_CLOSED && can_open) { @@ -1641,12 +1645,14 @@ m_move(register struct monst* mtmp, register int after) return MMOVE_DIED; } else { if (Verbose(2, m_move3)) { - if (canseeit && canspotmon(mtmp)) + if (canseeit && canspotmon(mtmp)) { pline("%s opens a door.", Monnam(mtmp)); - else if (canseeit) + } else if (canseeit) { You_see("a door open."); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_door_open, 100); You_hear("a door open."); + } } } } else if (here->doormask & (D_LOCKED | D_CLOSED)) { @@ -1662,13 +1668,15 @@ m_move(register struct monst* mtmp, register int after) return MMOVE_DIED; } else { if (Verbose(2, m_move4)) { - if (canseeit && canspotmon(mtmp)) + if (canseeit && canspotmon(mtmp)) { pline("%s smashes down a door.", Monnam(mtmp)); - else if (canseeit) + } else if (canseeit) { You_see("a door crash open."); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_door_crash_open, 50); You_hear("a door crash open."); + } } } /* if it's a shop door, schedule repair */ diff --git a/src/mthrowu.c b/src/mthrowu.c index 8bd26fb7f..2f664b869 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -377,6 +377,7 @@ ohitmon( if (ismimic) seemimic(mtmp); mtmp->msleeping = 0; + Soundeffect(se_splat_egg, 35); if (vis) { if (otmp->otyp == EGG) { pline("Splat! %s is hit with %s egg!", Monnam(mtmp), @@ -830,6 +831,7 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) pline("A dry rattle comes from %s throat.", s_suffix(mon_nam(mtmp))); } else { + Soundeffect(se_dry_throat_rattle, 50); You_hear("a dry rattle nearby."); } } @@ -902,10 +904,12 @@ breamm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) if (m_lined_up(mtarg, mtmp)) { if (mtmp->mcan) { if (!Deaf) { - if (canseemon(mtmp)) + if (canseemon(mtmp)) { pline("%s coughs.", Monnam(mtmp)); - else + } else { + Soundeffect(se_cough, 100); You_hear("a cough."); + } } return MM_MISS; } @@ -1217,11 +1221,13 @@ hit_bars( *objp = 0; /* object is now gone */ /* breakage makes its own noises */ if (obj_type == POT_ACID) { - if (cansee(barsx, barsy) && !nodissolve) + if (cansee(barsx, barsy) && !nodissolve) { pline_The("iron bars are dissolved!"); - else + } else { + Soundeffect(se_angry_snakes, 100); You_hear(Hallucination ? "angry snakes!" : "a hissing noise."); + } if (!nodissolve) dissolve_bars(barsx, barsy); } diff --git a/src/muse.c b/src/muse.c index 6765d20db..3277efef7 100644 --- a/src/muse.c +++ b/src/muse.c @@ -132,6 +132,7 @@ precheck(struct monst *mon, struct obj *obj) int range = couldsee(mon->mx, mon->my) /* 9 or 5 */ ? (BOLT_LIM + 1) : (BOLT_LIM - 3); + Soundeffect(se_zap_then_explosion, 100); You_hear("a zap and an explosion %s.", (mdistu(mon) <= range * range) ? "nearby" : "in the distance"); @@ -164,6 +165,7 @@ mzapwand( int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */ ? (BOLT_LIM + 1) : (BOLT_LIM - 3); + Soundeffect(se_zap, 100); You_hear("a %s zap.", (mdistu(mtmp) <= range * range) ? "nearby" : "distant"); unknow_object(otmp); /* hero loses info when unseen obj is used */ @@ -191,6 +193,7 @@ mplayhorn( int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */ ? (BOLT_LIM + 1) : (BOLT_LIM - 3); + Soundeffect(se_horn_being_played, 50); You_hear("a horn being played %s.", (mdistu(mtmp) <= range * range) ? "nearby" : "in the distance"); @@ -266,6 +269,7 @@ mquaffmsg(struct monst *mtmp, struct obj *otmp) otmp->dknown = 1; pline("%s drinks %s!", Monnam(mtmp), singular(otmp, doname)); } else if (!Deaf) { + Soundeffect(se_mon_chugging_potion, 25); You_hear("a chugging sound."); } } @@ -706,10 +710,12 @@ use_defensive(struct monst* mtmp) impossible("No need for unicorn horn?"); return 2; case MUSE_BUGLE: - if (vismon) + if (vismon) { pline("%s plays %s!", Monnam(mtmp), doname(otmp)); - else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_bugle_playing_reveille, 100); You_hear("a bugle playing reveille!"); + } awaken_soldiers(mtmp); return 2; case MUSE_WAN_TELEPORTATION_SELF: @@ -822,9 +828,11 @@ use_defensive(struct monst* mtmp) surface(mtmp->mx, mtmp->my)); pline("%s %s through...", Monnam(mtmp), is_flyer(mtmp->data) ? "dives" : "falls"); - } else if (!Deaf) + } else if (!Deaf) { + Soundeffect(se_crash_through_floor, 100); You_hear("%s crash through the %s.", something, surface(mtmp->mx, mtmp->my)); + } /* we made sure that there is a level for mtmp to go to */ migrate_to_level(mtmp, ledger_no(&u.uz) + 1, MIGR_RANDOM, (coord *) 0); @@ -1446,6 +1454,7 @@ mbhitm(register struct monst* mtmp, register struct obj* otmp) if (hits_you) { if (Antimagic) { shieldeff(u.ux, u.uy); + Soundeffect(se_boing, 40); pline("Boing!"); } else if (rnd(20) < 10 + u.uac) { pline_The("wand hits you!"); @@ -1459,6 +1468,7 @@ mbhitm(register struct monst* mtmp, register struct obj* otmp) nomul(0); } else if (resists_magm(mtmp)) { shieldeff(mtmp->mx, mtmp->my); + Soundeffect(se_boing, 40); pline("Boing!"); } else if (rnd(20) < 10 + find_mac(mtmp)) { tmp = d(2, 12); diff --git a/src/music.c b/src/music.c index 18ba85974..dad4d96fd 100644 --- a/src/music.c +++ b/src/music.c @@ -252,11 +252,13 @@ do_earthquake(int force) mtmp->mundetected = 0; newsym(x, y); if (ceiling_hider(mtmp->data)) { - if (cansee(x, y)) + if (cansee(x, y)) { pline("%s is shaken loose from the ceiling!", Amonnam(mtmp)); - else if (!is_flyer(mtmp->data)) + } else if (!is_flyer(mtmp->data)) { + Soundeffect(se_thump, 50); You_hear("a thump."); + } } } if (M_AP_TYPE(mtmp) != M_AP_NOTHING @@ -365,10 +367,12 @@ do_earthquake(int force) mtmp->mtrapped = 1; if (!m_already_trapped) { /* suppress messages */ - if (cansee(x, y)) + if (cansee(x, y)) { pline("%s falls into a chasm!", Monnam(mtmp)); - else if (humanoid(mtmp->data)) + } else if (humanoid(mtmp->data)) { + Soundeffect(se_scream, 50); You_hear("a scream!"); + } } /* Falling is okay for falling down within a pit from jostling too */ @@ -795,13 +799,17 @@ do_play_instrument(struct obj* instr) } } if (tumblers) { - if (gears) + if (gears) { + Soundeffect(se_tumbler_click, 50); + Soundeffect(se_gear_turn, 50); You_hear("%d tumbler%s click and %d gear%s turn.", tumblers, plur(tumblers), gears, plur(gears)); - else + } else { + Soundeffect(se_tumbler_click, 50); You_hear("%d tumbler%s click.", tumblers, plur(tumblers)); + } } else if (gears) { You_hear("%d gear%s turn.", gears, plur(gears)); /* could only get `gears == 5' by playing five diff --git a/src/potion.c b/src/potion.c index 3b4a55995..83acf51db 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1625,6 +1625,7 @@ potionhit(struct monst *mon, struct obj *obj, int how) hit_saddle = TRUE; distance = distu(tx, ty); if (!cansee(tx, ty)) { + Soundeffect(se_potion_crash_and_break, 60); pline("Crash!"); } else { char *mnam = mon_nam(mon); @@ -1641,6 +1642,7 @@ potionhit(struct monst *mon, struct obj *obj, int how) } else { Strcpy(buf, mnam); } + Soundeffect(se_potion_crash_and_break, 60); pline_The("%s crashes on %s and breaks into shards.", botlnam, buf); } diff --git a/src/pray.c b/src/pray.c index 86aecc06e..dee8bb4e2 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1193,6 +1193,7 @@ pleased(aligntyp g_align) u.uevent.uheard_tune++; break; } else if (u.uevent.uheard_tune < 2) { + Soundeffect(se_divine_music, 50); You_hear("a divine music..."); pline("It sounds like: \"%s\".", gt.tune); u.uevent.uheard_tune++; @@ -1720,6 +1721,7 @@ dosacrifice(void) offer_too_soon(altaralign); return ECMD_TIME; } + Soundeffect(se_thunderclap, 100); You_hear("a nearby thunderclap."); if (!otmp->known) { You("realize you have made a %s.", diff --git a/src/read.c b/src/read.c index 144508c41..365ba01d1 100644 --- a/src/read.c +++ b/src/read.c @@ -1349,10 +1349,15 @@ seffect_scare_monster(struct obj **sobjp) ct++; /* pets don't laugh at you */ } } - if (otyp == SCR_SCARE_MONSTER || !ct) + if (otyp == SCR_SCARE_MONSTER || !ct) { + if (confused || scursed) + Soundeffect(se_sad_wailing, 50); + else + Soundeffect(se_sad_wailing, 50); You_hear("%s %s.", (confused || scursed) ? "sad wailing" : "maniacal laughter", !ct ? "in the distance" : "close by"); + } } static void diff --git a/src/shk.c b/src/shk.c index c28a44250..535a9d872 100644 --- a/src/shk.c +++ b/src/shk.c @@ -390,6 +390,7 @@ call_kops(struct monst *shkp, boolean nearshop) if (!shkp) return; + Soundeffect(se_alarm, 80); if (!Deaf) pline("An alarm sounds!"); @@ -695,12 +696,14 @@ u_entered_shop(char* enterstring) pline_The("atmosphere at %s %s seems unwelcoming.", s_suffix(shkname(shkp)), shtypes[rt - SHOPBASE].name); } else if (eshkp->robbed) { - if (!Deaf) + if (!Deaf) { + Soundeffect(se_mutter_imprecations, 50); pline("%s mutters imprecations against shoplifters.", Shknam(shkp)); - else + } else { pline("%s is combing through %s inventory list.", Shknam(shkp), noit_mhis(shkp)); + } } else { if (!Deaf && !muteshk(shkp)) verbalize("%s, %s! Welcome%s to %s %s!", Hello(shkp), gp.plname, @@ -3784,11 +3787,13 @@ shk_fixes_damage(struct monst *shkp) shk_closeby = (mdistu(shkp) <= (BOLT_LIM / 2) * (BOLT_LIM / 2)); - if (canseemon(shkp)) + if (canseemon(shkp)) { pline("%s whispers %s.", Shknam(shkp), shk_closeby ? "an incantation" : "something"); - else if (!Deaf && shk_closeby) + } else if (!Deaf && shk_closeby) { + Soundeffect(se_mutter_incantation, 100); You_hear("someone muttering an incantation."); + } (void) repair_damage(shkp, dam, FALSE); @@ -4442,6 +4447,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify) if (MON_AT(x, y)) { if (!animal) { if (!Deaf && !muteshk(shkp)) { + Soundeffect(se_angry_voice, 75); You_hear("an angry voice:"); verbalize("Out of my way, scum!"); } diff --git a/src/sounds.c b/src/sounds.c index 715be8dc6..b302db2e1 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -40,9 +40,14 @@ throne_mon_sound(struct monst *mtmp) }; int which = rn2(3) + (Hallucination ? 1 : 0); - if (which != 2) + if (which != 2) { + if (which == 0) { + Soundeffect(se_courtly_conversation, 30); + } else if (which == 1) { + Soundeffect(se_sceptor_pounding, 100); + } You_hear1(throne_msg[which]); - else { + } else { DISABLE_WARNING_FORMAT_NONLITERAL pline(throne_msg[2], uhis()); RESTORE_WARNING_FORMAT_NONLITERAL @@ -62,12 +67,15 @@ beehive_mon_sound(struct monst *mtmp) switch (rn2(2) + hallu) { case 0: + Soundeffect(se_low_buzzing, 30); You_hear("a low buzzing."); break; case 1: + Soundeffect(se_angry_drone, 100); You_hear("an angry drone."); break; case 2: + Soundeffect(se_bees, 100); You_hear("bees in your %sbonnet!", uarmh ? "" : "(nonexistent) "); break; @@ -244,17 +252,20 @@ dosounds(void) gold_in_vault = TRUE; if (vault_occupied(u.urooms) != (ROOM_INDEX(sroom) + ROOMOFFSET)) { - if (gold_in_vault) + if (gold_in_vault) { You_hear(!hallu ? "someone counting gold coins." : "the quarterback calling the play."); - else + } else { + Soundeffect(se_someone_searching, 30); You_hear("someone searching."); + } break; } } /*FALLTHRU*/ case 0: + Soundeffect(se_guards_footsteps, 30); You_hear("the footsteps of a guard on patrol."); break; case 2: diff --git a/src/spell.c b/src/spell.c index a481aea86..da887aa53 100644 --- a/src/spell.c +++ b/src/spell.c @@ -224,8 +224,10 @@ deadbook(struct obj* book2) if (!u.uhave.bell || !u.uhave.menorah) { pline("A chill runs down your %s.", body_part(SPINE)); - if (!u.uhave.bell) + if (!u.uhave.bell) { + Soundeffect(se_faint_chime, 30); You_hear("a faint chime..."); + } if (!u.uhave.menorah) pline("Vlad's doppelganger is amused."); return; diff --git a/src/timeout.c b/src/timeout.c index 705acf2da..53d28a410 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1727,6 +1727,7 @@ do_storms(void) if (levl[u.ux][u.uy].typ == CLOUD) { /* Inside a cloud during a thunder storm is deafening. */ /* Even if already deaf, we sense the thunder's vibrations. */ + Soundeffect(se_kaboom_boom_boom, 80); pline("Kaboom!!! Boom!! Boom!!"); incr_itimeout(&HDeaf, rn1(20, 30)); gc.context.botl = TRUE; diff --git a/src/trap.c b/src/trap.c index 3ad1b0181..df10177ae 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1023,6 +1023,7 @@ trapeffect_arrow_trap( if (mtmp == &gy.youmonst) { if (trap->once && trap->tseen && !rn2(15)) { + Soundeffect(se_loud_click, 100); You_hear("a loud click!"); deltrap(trap); newsym(u.ux, u.uy); @@ -1082,6 +1083,7 @@ trapeffect_dart_trap( int oldumort = u.umortality; if (trap->once && trap->tseen && !rn2(15)) { + Soundeffect(se_soft_click, 30); You_hear("a soft click."); deltrap(trap); newsym(u.ux, u.uy); @@ -1223,6 +1225,12 @@ trapeffect_sqky_board( struct trap *trap, unsigned trflags) { + enum sound_effect_entries tsnds[] = { + se_squeak_C, se_squeak_D_flat, se_squeak_D, + se_squeak_E_flat, se_squeak_E, se_squeak_F, + se_squeak_F_sharp, se_squeak_G, se_squeak_G_sharp, + se_squeak_A, se_squeak_B_flat, se_squeak_B, + }; boolean forcetrap = ((trflags & FORCETRAP) != 0 || (trflags & FAILEDUNTRAP) != 0); @@ -1237,6 +1245,9 @@ trapeffect_sqky_board( } } else { seetrap(trap); + if (trap->tnote >= 0 && trap->tnote < SIZE(tsnds)) { + Soundeffect(tsnds[trap->tnote], 50); + } pline("A board beneath you %s%s%s.", Deaf ? "vibrates" : "squeaks ", Deaf ? "" : trapnote(trap, FALSE), @@ -1251,6 +1262,9 @@ trapeffect_sqky_board( /* stepped on a squeaky board */ if (in_sight) { if (!Deaf) { + if (trap->tnote >= 0 && trap->tnote < SIZE(tsnds)) { + Soundeffect(tsnds[trap->tnote], 50); + } pline("A board beneath %s squeaks %s loudly.", mon_nam(mtmp), trapnote(trap, FALSE)); seetrap(trap); @@ -1263,6 +1277,11 @@ trapeffect_sqky_board( int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */ ? (BOLT_LIM + 1) : (BOLT_LIM - 3); + if (trap->tnote >= 0 && trap->tnote < SIZE(tsnds)) { + Soundeffect(tsnds[trap->tnote], + ((mdistu(mtmp) <= range * range) + ? 40 : 20)); + } You_hear("%s squeak %s.", trapnote(trap, FALSE), (mdistu(mtmp) <= range * range) ? "nearby" : "in the distance"); @@ -1328,8 +1347,10 @@ trapeffect_bear_trap( seetrap(trap); } else { if (mptr == &mons[PM_OWLBEAR] - || mptr == &mons[PM_BUGBEAR]) + || mptr == &mons[PM_BUGBEAR]) { + Soundeffect(se_roar, 100); You_hear("the roaring of an angry bear!"); + } } } else if (forcetrap) { if (in_sight) { @@ -1988,6 +2009,7 @@ trapeffect_web( case PM_OWLBEAR: /* Eric Backus */ case PM_BUGBEAR: if (!in_sight) { + Soundeffect(se_roar, 60); You_hear("the roaring of a confused bear!"); mtmp->mtrapped = 1; break; @@ -2256,6 +2278,7 @@ trapeffect_landmine( trap->madeby_u ? "the trigger of your mine" : "a trigger"); if (already_seen && rn2(3)) return Trap_Effect_Finished; + Soundeffect(se_kaablamm_of_mine, 80); pline("KAABLAMM!!! %s %s%s off!", forcebungle ? "Your inept attempt sets" : "The air currents set", @@ -2858,12 +2881,13 @@ launch_obj( if (cansee(x1, y1)) { You_see("%s start to roll.", an(xname(singleobj))); } else if (Hallucination) { + Soundeffect(se_someone_bowling, 60); You_hear("someone bowling."); } else { + Soundeffect(se_rumbling, 60); You_hear("rumbling %s.", (distu(x1, y1) <= 4 * 4) ? "nearby" : "in the distance"); } - } style &= ~LAUNCH_UNSEEN; goto roll; @@ -3028,6 +3052,7 @@ launch_obj( || IS_ROCK(levl[gb.bhitpos.x + dx][gb.bhitpos.y + dy].typ)) bmsg = " as one boulder hits another"; + Soundeffect(se_loud_crash, 80); You_hear("a loud crash%s!", cansee(gb.bhitpos.x, gb.bhitpos.y) ? bmsg : ""); obj_extract_self(otmp2); @@ -3800,6 +3825,7 @@ domagictrap(void) /* deafness effects */ if (!Deaf) { + Soundeffect(se_deafening_roar_atmospheric, 100); You_hear("a deafening roar!"); incr_itimeout(&HDeaf, rn1(20, 30)); gc.context.botl = TRUE; @@ -3820,6 +3846,7 @@ domagictrap(void) /* sometimes nothing happens */ break; case 11: /* toggle intrinsic invisibility */ + Soundeffect(se_low_hum, 100); You_hear("a low hum."); if (!Invis) { if (!Blind) @@ -5922,6 +5949,7 @@ b_trapped(const char* item, int bodypart) int lvl = level_difficulty(), dmg = rnd(5 + (lvl < 5 ? lvl : 2 + lvl / 2)); + Soundeffect(se_kaboom, 80); pline("KABOOM!! %s was booby-trapped!", The(item)); wake_nearby(); losehp(Maybe_Half_Phys(dmg), "explosion", KILLED_BY_AN); diff --git a/src/uhitm.c b/src/uhitm.c index d1d0bb294..f90a56a7b 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -2614,10 +2614,12 @@ mhitm_ad_curs(struct monst *magr, struct attack *mattk, struct monst *mdef, return; if (!magr->mcan && !rn2(10)) { if (!Deaf) { - if (Blind) + Soundeffect(se_laughter, 40); + if (Blind) { You_hear("laughter."); - else + } else { pline("%s chuckles.", Monnam(magr)); + } } if (u.umonnum == PM_CLAY_GOLEM) { pline("Some writing vanishes from your head!"); @@ -3645,6 +3647,7 @@ mhitm_ad_ston( You_hear("a cough from %s!", mon_nam(magr)); } else { if (Hallucination && !Blind) { + Soundeffect(se_cockatrice_hiss, 50); You_hear("hissing."); /* You_hear() deals with Deaf */ pline("%s appears to be blowing you a kiss...", Monnam(magr)); diff --git a/src/were.c b/src/were.c index eda4695a1..6f8a139ee 100644 --- a/src/were.c +++ b/src/were.c @@ -30,8 +30,10 @@ were_change(struct monst *mon) howler = (char *) 0; break; } - if (howler) + if (howler) { + Soundeffect(se_canine_howl, 50); You_hear("a %s howling at the moon.", howler); + } } } } else if (!rn2(30) || Protection_from_shape_changers) { diff --git a/src/worn.c b/src/worn.c index f16fa90e0..ec56204e5 100644 --- a/src/worn.c +++ b/src/worn.c @@ -937,14 +937,17 @@ mon_break_armor(struct monst *mon, boolean polyspot) if (breakarm(mdat)) { if ((otmp = which_armor(mon, W_ARM)) != 0) { if ((Is_dragon_scales(otmp) && mdat == Dragon_scales_to_pm(otmp)) - || (Is_dragon_mail(otmp) && mdat == Dragon_mail_to_pm(otmp))) + || (Is_dragon_mail(otmp) && mdat == Dragon_mail_to_pm(otmp))) { ; /* no message here; "the dragon merges with his scaly armor" is odd and the monster's previous form is already gone */ - else if (vis) - pline("%s breaks out of %s armor!", Monnam(mon), ppronoun); - else - You_hear("a cracking sound."); + } else { + Soundeffect(se_cracking_sound, 100); + if (vis) + pline("%s breaks out of %s armor!", Monnam(mon), ppronoun); + else + You_hear("a cracking sound."); + } m_useup(mon, otmp); } if ((otmp = which_armor(mon, W_ARMC)) != 0 @@ -958,6 +961,7 @@ mon_break_armor(struct monst *mon, boolean polyspot) bypass_obj(otmp); m_lose_armor(mon, otmp); } else { + Soundeffect(se_ripping_sound, 100); if (vis) pline("%s %s tears apart!", s_suffix(Monnam(mon)), cloak_simple_name(otmp)); @@ -978,6 +982,7 @@ mon_break_armor(struct monst *mon, boolean polyspot) boolean passes_thru_clothes = !(mdat->msize <= MZ_SMALL); if ((otmp = which_armor(mon, W_ARM)) != 0) { + Soundeffect(se_thud, 50); if (vis) pline("%s armor falls around %s!", s_suffix(Monnam(mon)), pronoun); @@ -1027,6 +1032,7 @@ mon_break_armor(struct monst *mon, boolean polyspot) m_lose_armor(mon, otmp); } if ((otmp = which_armor(mon, W_ARMS)) != 0) { + Soundeffect(se_clank, 50); if (vis) pline("%s can no longer hold %s shield!", Monnam(mon), ppronoun); diff --git a/src/zap.c b/src/zap.c index 2f1279476..ebdd83f30 100644 --- a/src/zap.c +++ b/src/zap.c @@ -2121,6 +2121,7 @@ bhito(struct obj *obj, struct obj *otmp) (the sound could be implicit) */ maybelearnit = cansee(obj->ox, obj->oy) || !Deaf; if (obj->otyp == BOULDER) { + Soundeffect(se_crumbling_sound, 75); if (cansee(obj->ox, obj->oy)) pline_The("boulder falls apart."); else @@ -4781,6 +4782,7 @@ zap_over_floor( if (IS_WATERWALL(lev->typ)) { /* For now, don't let WATER freeze. */ + Soundeffect(se_soft_crackling, 100); if (see_it) pline_The("%s freezes for a moment.", hliquid("water")); else @@ -4801,6 +4803,8 @@ zap_over_floor( lev->typ = lava ? ROOM : ICE; } bury_objs(x, y); + if (!lava) + Soundeffect(se_soft_crackling, 30); if (see_it) { if (lava) Norep("The %s cools and solidifies.", @@ -4810,9 +4814,9 @@ zap_over_floor( else Norep("The %s freezes.", hliquid("water")); newsym(x, y); - } else if (!lava) + } else if (!lava) { You_hear("a crackling sound."); - + } if (u_at(x, y)) { if (u.uinwater) { /* not just `if (Underwater)' */ /* leave the no longer existent water */ -- 2.50.1