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.
This commit is contained in:
21
src/lock.c
21
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)
|
||||
|
||||
Reference in New Issue
Block a user