- 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

View file

@ -527,10 +527,27 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
{ {
if (chan->SourceType == type && chan->EntChannel == channel) if (chan->SourceType == type && chan->EntChannel == channel)
{ {
if (type != SOURCE_Unattached) chan->Source = source; bool foundit;
else
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;
} }
} }
} }