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:
@@ -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 */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user