Fixed stereoreverse, and its effects are applied to mirror mode

How long has this cvar been broken?!
This commit is contained in:
TehRealSalt 2018-02-20 20:04:33 -05:00
parent da32f9a4ed
commit 6d3d098c3f

View file

@ -391,7 +391,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
{ {
INT32 sep, pitch, priority, cnum; INT32 sep, pitch, priority, cnum;
sfxinfo_t *sfx; sfxinfo_t *sfx;
const boolean reverse = (stereoreverse.value ^ mirrormode);
const mobj_t *origin = (const mobj_t *)origin_p; const mobj_t *origin = (const mobj_t *)origin_p;
listener_t listener = {0,0,0,0}; listener_t listener = {0,0,0,0};
@ -572,14 +572,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (sfx->usefulness++ < 0) if (sfx->usefulness++ < 0)
sfx->usefulness = -1; sfx->usefulness = -1;
#ifdef SURROUND
// Avoid channel reverse if surround // Avoid channel reverse if surround
if (stereoreverse.value && sep != SURROUND_SEP) if (reverse
sep = (~sep) & 255; #ifdef SURROUND
#else && sep != SURROUND_SEP
if (stereoreverse.value)
sep = (~sep) & 255;
#endif #endif
)
sep = (~sep) & 255;
// Assigns the handle to one of the channels in the // Assigns the handle to one of the channels in the
// mix/output buffer. // mix/output buffer.
@ -627,14 +626,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (sfx->usefulness++ < 0) if (sfx->usefulness++ < 0)
sfx->usefulness = -1; sfx->usefulness = -1;
#ifdef SURROUND
// Avoid channel reverse if surround // Avoid channel reverse if surround
if (stereoreverse.value && sep != SURROUND_SEP) if (reverse
sep = (~sep) & 255; #ifdef SURROUND
#else && sep != SURROUND_SEP
if (stereoreverse.value)
sep = (~sep) & 255;
#endif #endif
)
sep = (~sep) & 255;
// Assigns the handle to one of the channels in the // Assigns the handle to one of the channels in the
// mix/output buffer. // mix/output buffer.
@ -682,14 +680,13 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
if (sfx->usefulness++ < 0) if (sfx->usefulness++ < 0)
sfx->usefulness = -1; sfx->usefulness = -1;
#ifdef SURROUND
// Avoid channel reverse if surround // Avoid channel reverse if surround
if (stereoreverse.value && sep != SURROUND_SEP) if (reverse
sep = (~sep) & 255; #ifdef SURROUND
#else && sep != SURROUND_SEP
if (stereoreverse.value)
sep = (~sep) & 255;
#endif #endif
)
sep = (~sep) & 255;
// Assigns the handle to one of the channels in the // Assigns the handle to one of the channels in the
// mix/output buffer. // mix/output buffer.
@ -732,14 +729,13 @@ dontplay:
if (sfx->usefulness++ < 0) if (sfx->usefulness++ < 0)
sfx->usefulness = -1; sfx->usefulness = -1;
#ifdef SURROUND
// Avoid channel reverse if surround // Avoid channel reverse if surround
if (stereoreverse.value && sep != SURROUND_SEP) if (reverse
sep = (~sep) & 255; #ifdef SURROUND
#else && sep != SURROUND_SEP
if (stereoreverse.value)
sep = (~sep) & 255;
#endif #endif
)
sep = (~sep) & 255;
// Assigns the handle to one of the channels in the // Assigns the handle to one of the channels in the
// mix/output buffer. // mix/output buffer.
@ -1212,6 +1208,8 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
listener_t listensource; listener_t listensource;
const boolean reverse = (stereoreverse.value ^ mirrormode);
(void)pitch; (void)pitch;
if (!listener) if (!listener)
return false; return false;
@ -1309,6 +1307,9 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
else else
angle = angle + InvAngle(listensource.angle); 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 ))