mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
- fixed a few sound issues in Shadow Warrior.
Ingame sound appears to be mostly working, menu doesn't yet.
This commit is contained in:
parent
a6395c0ed9
commit
52d13f5ee0
1 changed files with 19 additions and 2 deletions
|
@ -150,6 +150,7 @@ void InitFX(void)
|
|||
newsfx.name = entry.name;
|
||||
newsfx.lumpnum = lump;
|
||||
newsfx.NearLimit = 6;
|
||||
newsfx.bTentative = false;
|
||||
}
|
||||
}
|
||||
soundEngine->HashSounds();
|
||||
|
@ -350,7 +351,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
|
|||
// For unpanned sounds the volume must be set directly and the position taken from the listener.
|
||||
*pos = campos;
|
||||
auto sdist = SoundDist(vpos->x, vpos->y, vpos->z, voc[chanSound].voc_distance);
|
||||
SetVolume(chan, (255 - sdist) * (1 / 255.f));
|
||||
if (chan) SetVolume(chan, (255 - sdist) * (1 / 255.f));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -385,6 +386,22 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
|
|||
|
||||
void DoUpdateSounds(void)
|
||||
{
|
||||
PLAYERp pp = Player + screenpeek;
|
||||
SoundListener listener;
|
||||
|
||||
listener.angle = -(float)pp->pang * pi::pi() / 1024; // Build uses a period of 2048.
|
||||
listener.velocity.Zero();
|
||||
listener.position = GetSoundPos((vec3_t*)&pp->posx);
|
||||
listener.underwater = false;
|
||||
// This should probably use a real environment instead of the pitch hacking in S_PlaySound3D.
|
||||
// listenactor->waterlevel == 3;
|
||||
//assert(primaryLevel->Zones.Size() > listenactor->Sector->ZoneNumber);
|
||||
listener.Environment = 0;// primaryLevel->Zones[listenactor->Sector->ZoneNumber].Environment;
|
||||
listener.valid = true;
|
||||
|
||||
listener.ListenerObject = pp;
|
||||
soundEngine->SetListener(listener);
|
||||
|
||||
soundEngine->EnumerateChannels([](FSoundChan* chan)
|
||||
{
|
||||
if (chan->ChanFlags & EChanFlags::FromInt(CHANEXF_INTERMIT))
|
||||
|
@ -538,7 +555,7 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t *pos, Voc3D_Flags flags,
|
|||
float fpitch = S_ConvertPitch(pitch);
|
||||
|
||||
auto rolloff = GetRolloff(vp->voc_distance);
|
||||
auto spos = GetSoundPos(pos);
|
||||
FVector3 spos = pos ? GetSoundPos(pos) : FVector3(0, 0, 0);
|
||||
auto chan = soundEngine->StartSound(sourcetype, source, &spos, CHAN_BODY, cflags, num, 1.f, ATTN_NORM, &rolloff, fpitch);
|
||||
if (chan)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue