mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
- SW: fixed ownership of non-following sounds.
This commit is contained in:
parent
b06c84ad8c
commit
fde633041b
2 changed files with 10 additions and 3 deletions
|
@ -1731,7 +1731,7 @@ FString SoundEngine::NoiseDebug()
|
|||
CalcPosVel(chan, &origin, nullptr);
|
||||
out.AppendFormat(TEXTCOLOR_GOLD "%5.0f | %5.0f | %5.0f | %5.0f ", origin.X, origin.Z, origin.Y, (origin - listener).Length());
|
||||
}
|
||||
out.AppendFormat("%-.2g %-4d %-4d %sF%s3%sZ%sU%sM%sN%sA%sL%sE%sV" TEXTCOLOR_GOLD " %-5.4f %-4u %d: %s\n", chan->Volume, chan->EntChannel, chan->Priority,
|
||||
out.AppendFormat("%-.2g %-4d %-4d %sF%s3%sZ%sU%sM%sN%sA%sL%sE%sV" TEXTCOLOR_GOLD " %-5.4f %-4u %d: %s %p\n", chan->Volume, chan->EntChannel, chan->Priority,
|
||||
(chan->ChanFlags & CHANF_FORGETTABLE) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||
(chan->ChanFlags & CHANF_IS3D) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||
(chan->ChanFlags & CHANF_LISTENERZ) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||
|
@ -1742,7 +1742,7 @@ FString SoundEngine::NoiseDebug()
|
|||
(chan->ChanFlags & CHANF_LOOP) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||
(chan->ChanFlags & CHANF_EVICTED) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||
(chan->ChanFlags & CHANF_VIRTUAL) ? TEXTCOLOR_GREEN : TEXTCOLOR_DARKRED,
|
||||
GSnd->GetAudibility(chan), GSnd->GetPosition(chan), ((int)chan->OrgID)-1, S_sfx[chan->SoundID].name.GetChars());
|
||||
GSnd->GetAudibility(chan), GSnd->GetPosition(chan), ((int)chan->OrgID)-1, S_sfx[chan->SoundID].name.GetChars(), chan->Source);
|
||||
ch++;
|
||||
}
|
||||
out.AppendFormat("%d channels\n", ch);
|
||||
|
|
|
@ -432,6 +432,7 @@ public:
|
|||
int SoundSourceIndex(FSoundChan* chan) override
|
||||
{
|
||||
if (chan->SourceType == SOURCE_Player) return int(PLAYERp(chan->Source) - Player);
|
||||
if (chan->SourceType == SOURCE_Unattached && chan->Source) return int(SPRITEp(chan->Source) - sprite);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -442,6 +443,10 @@ public:
|
|||
if (index < 0 || index >= MAX_SW_PLAYERS_REG) index = 0;
|
||||
chan->Source = &Player[index];
|
||||
}
|
||||
else if (chan->SourceType == SOURCE_Unattached && chan->Source >= 0)
|
||||
{
|
||||
chan->Source = &sprite[index];
|
||||
}
|
||||
else chan->Source = nullptr;
|
||||
}
|
||||
|
||||
|
@ -609,6 +614,7 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
|
|||
if (Prediction || !SoundEnabled() || !soundEngine->isValidSoundId(num))
|
||||
return -1;
|
||||
|
||||
SPRITEp sps = sp;
|
||||
// Weed out parental lock sounds if PLock is active
|
||||
if (adult_lockout || Global_PLock)
|
||||
{
|
||||
|
@ -664,7 +670,8 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
|
|||
|
||||
auto rolloff = GetRolloff(vp->voc_distance);
|
||||
FVector3 spos = pos ? GetSoundPos(pos) : FVector3(0, 0, 0);
|
||||
soundEngine->StartSound(sourcetype, source, &spos, channel, cflags, num, 1.f, ATTN_NORM, &rolloff, S_ConvertPitch(pitch));
|
||||
auto chan = soundEngine->StartSound(sourcetype, source, &spos, channel, cflags, num, 1.f, ATTN_NORM, &rolloff, S_ConvertPitch(pitch));
|
||||
if (sourcetype == SOURCE_Unattached) chan->Source = sps; // needed for sound termination.
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue