- don't let CHANF_AUTO hijack other channels.

With CHANF_OVERLAP this isn't needed anymore - any sound started on CHAN_AUTO can actually play on this channel with overlap implicitly allowed.
This has the added advantage that these sounds can be reliably accessed with other function by using CHAN_AUTO.
This commit is contained in:
Christoph Oelckers 2020-05-26 22:19:30 +02:00
parent 12a55ff161
commit 4881ec257a
3 changed files with 6 additions and 20 deletions

View file

@ -397,6 +397,7 @@ void F2DDrawer::SetColorOverlay(PalEntry color, float alpha, PalEntry &vertexcol
void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
{
if (parms.style.BlendOp == STYLEOP_None) return; // not supposed to be drawn.
assert(img && img->isValid());
double xscale = parms.destwidth / parms.texwidth;
double yscale = parms.destheight / parms.texheight;

View file

@ -494,26 +494,9 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
int seen = 0;
if (source != NULL && channel == CHAN_AUTO)
{
// Select a channel that isn't already playing something.
// Try channel 0 first, then travel from channel 7 down.
if (!IsChannelUsed(type, source, 0, &seen))
{
channel = 0;
}
else
{
for (channel = 7; channel > 0; --channel)
{
if (!IsChannelUsed(type, source, channel, &seen))
{
break;
}
}
if (channel == 0)
{ // Crap. No free channels.
return NULL;
}
}
// In the old sound system, 'AUTO' hijacked one of the other channels.
// Now, with CHANF_OVERLAP at our disposal that isn't needed anymore. Just set the flag and let all sounds play on channel 0.
chanflags |= CHANF_OVERLAP;
}
// If this actor is already playing something on the selected channel, stop it.

View file

@ -28,6 +28,8 @@
* unsigned int and 64-bit unsigned int in hexadecimal format.
*/
#include <inttypes.h>
#ifndef SFMT_H
#define SFMT_H