mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 20:41:46 +00:00
Merge branch 'sep-decringe' into 'master'
[minor refactor] Sep Decringe See merge request KartKrew/Kart!573
This commit is contained in:
commit
2fc1770dc0
1 changed files with 23 additions and 27 deletions
|
|
@ -661,11 +661,6 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||||
if (listenmobj[i])
|
if (listenmobj[i])
|
||||||
{
|
{
|
||||||
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, &pitch, sfx);
|
audible = S_AdjustSoundParams(listenmobj[i], origin, &volume, &sep, &pitch, sfx);
|
||||||
|
|
||||||
if (origin->x == listener[i].x && origin->y == listener[i].y)
|
|
||||||
{
|
|
||||||
sep = NORM_SEP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!audible)
|
if (!audible)
|
||||||
|
|
@ -926,11 +921,6 @@ void S_UpdateSounds(void)
|
||||||
&volume, &sep, &pitch,
|
&volume, &sep, &pitch,
|
||||||
c->sfxinfo
|
c->sfxinfo
|
||||||
);
|
);
|
||||||
|
|
||||||
if (origin->x == listener[i].x && origin->y == listener[i].y)
|
|
||||||
{
|
|
||||||
sep = NORM_SEP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audible)
|
if (audible)
|
||||||
|
|
@ -1066,7 +1056,6 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
||||||
const boolean reverse = (stereoreverse.value ^ encoremode);
|
const boolean reverse = (stereoreverse.value ^ encoremode);
|
||||||
|
|
||||||
fixed_t approx_dist;
|
fixed_t approx_dist;
|
||||||
angle_t angle;
|
|
||||||
|
|
||||||
listener_t listensource;
|
listener_t listensource;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
@ -1144,28 +1133,35 @@ boolean S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32
|
||||||
if (approx_dist > S_CLIPPING_DIST)
|
if (approx_dist > S_CLIPPING_DIST)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// angle of source to listener
|
if (source->x == listensource.x && source->y == listensource.y)
|
||||||
angle = R_PointToAngle2(listensource.x, listensource.y, source->x, source->y);
|
{
|
||||||
|
*sep = NORM_SEP;
|
||||||
if (angle > listensource.angle)
|
}
|
||||||
angle = angle - listensource.angle;
|
|
||||||
else
|
else
|
||||||
angle = angle + InvAngle(listensource.angle);
|
{
|
||||||
|
// angle of source to listener
|
||||||
|
angle_t angle = R_PointToAngle2(listensource.x, listensource.y, source->x, source->y);
|
||||||
|
|
||||||
if (reverse)
|
if (angle > listensource.angle)
|
||||||
angle = InvAngle(angle);
|
angle = angle - listensource.angle;
|
||||||
|
else
|
||||||
|
angle = angle + InvAngle(listensource.angle);
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
angle = InvAngle(angle);
|
||||||
|
|
||||||
#ifdef SURROUND
|
#ifdef SURROUND
|
||||||
// Produce a surround sound for angle from 105 till 255
|
// Produce a surround sound for angle from 105 till 255
|
||||||
if (surround.value == 1 && (angle > ANG105 && angle < ANG255 ))
|
if (surround.value == 1 && (angle > ANG105 && angle < ANG255 ))
|
||||||
*sep = SURROUND_SEP;
|
*sep = SURROUND_SEP;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
angle >>= ANGLETOFINESHIFT;
|
angle >>= ANGLETOFINESHIFT;
|
||||||
|
|
||||||
// stereo separation
|
// stereo separation
|
||||||
*sep = 128 - (FixedMul(S_STEREO_SWING, FINESINE(angle))>>FRACBITS);
|
*sep = 128 - (FixedMul(S_STEREO_SWING, FINESINE(angle))>>FRACBITS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// volume calculation
|
// volume calculation
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue