- restored stopping of channel by new sound

If source actor/sector/polyobject is playing something on the selected channel, stop it before playing a new sound

https://forum.zdoom.org/viewtopic.php?t=66613
This commit is contained in:
alexey.lysiuk 2019-12-10 11:40:32 +02:00
parent ab4c792201
commit f050a23541
1 changed files with 20 additions and 3 deletions

View File

@ -527,10 +527,27 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
{
if (chan->SourceType == type && chan->EntChannel == channel)
{
if (type != SOURCE_Unattached) chan->Source = source;
else
bool foundit;
switch (type)
{
chan->Point[0] == pt->X && chan->Point[2] == pt->Z && chan->Point[1] == pt->Y;
case SOURCE_Actor:
case SOURCE_Sector:
case SOURCE_Polyobj:
foundit = chan->Source == source;
break;
case SOURCE_Unattached:
foundit = chan->Point[0] == pt->X && chan->Point[2] == pt->Z && chan->Point[1] == pt->Y;
break;
default:
foundit = false;
break;
}
if (foundit)
{
StopChannel(chan);
break;
}
}
}