Add seeking sounds

This commit is contained in:
Sally Coolatta 2022-09-21 14:57:33 -04:00
parent d7ce973aaf
commit f02b67eae6
3 changed files with 35 additions and 5 deletions

View file

@ -281,6 +281,13 @@ static void SetSPBSpeed(mobj_t *spb, fixed_t xySpeed, fixed_t zSpeed)
);
}
static boolean SPBSeekSoundPlaying(mobj_t *spb)
{
return (S_SoundPlaying(spb, sfx_spbska)
|| S_SoundPlaying(spb, sfx_spbskb)
|| S_SoundPlaying(spb, sfx_spbskc));
}
static void SPBSeek(mobj_t *spb, player_t *bestPlayer)
{
const fixed_t desiredSpeed = SPB_DEFAULTSPEED;
@ -332,10 +339,6 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer)
dist = SPBDist(spb, spb_chase(spb));
activeDist = FixedMul(SPB_ACTIVEDIST, spb_chase(spb)->scale);
#ifdef SPB_SEEKTEST // Easy debug switch
(void)dist;
(void)activeDist;
#else
if (spb_swapcount(spb) > SPB_MAXSWAPS + 1)
{
// Too much hot potato.
@ -347,6 +350,7 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer)
}
else
{
#ifndef SPB_SEEKTEST // Easy debug switch
if (dist <= activeDist)
{
S_StopSound(spb);
@ -361,8 +365,24 @@ static void SPBSeek(mobj_t *spb, player_t *bestPlayer)
spb_speed(spb) = desiredSpeed;
return;
}
}
#endif
}
if (SPBSeekSoundPlaying(spb) == false)
{
if (dist <= activeDist * 3)
{
S_StartSound(spb, sfx_spbskc);
}
else if (dist <= activeDist * 6)
{
S_StartSound(spb, sfx_spbskb);
}
else
{
S_StartSound(spb, sfx_spbska);
}
}
// Move along the waypoints until you get close enough
if (spb_curwaypoint(spb) == -1)

View file

@ -1118,6 +1118,11 @@ sfxinfo_t S_sfx[NUMSFX] =
// Shrink laser beam
{"beam01", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""},
// SPB seeking
{"spbska", false, 32, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"spbskb", false, 32, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""},
{"spbskc", false, 32, 16, -1, NULL, 0, -1, -1, LUMPERROR, ""},
// Juicebox for SPB
{"gatefx", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""},

View file

@ -1183,6 +1183,11 @@ typedef enum
// Shrink laser
sfx_beam01,
// SPB seeking
sfx_spbska,
sfx_spbskb,
sfx_spbskc,
// Juicebox for SPB
sfx_gatefx,