- Exhumed: Switch sounds must use CHANF_LISTENERZ because they use no z-coordinate for their position.

This commit is contained in:
Christoph Oelckers 2020-11-24 00:14:32 +01:00
parent 8cbd67974e
commit 7470286d5b
3 changed files with 10 additions and 10 deletions

View file

@ -485,7 +485,7 @@ void EXSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
}
if ((chanflags & CHANF_LISTENERZ) && type != SOURCE_None)
{
pos->Y = fcampos.Z;
pos->Y = fcampos.Y;
}
}
}
@ -558,7 +558,7 @@ void GameInterface::UpdateSounds()
int soundx, soundy, soundz;
short soundsect;
void PlayFX2(unsigned short nSound, short nSprite, int sectf)
void PlayFX2(unsigned short nSound, short nSprite, int sectf, EChanFlags chanflags)
{
if (!SoundEnabled()) return;
if ((nSound&0x1ff) >= kMaxSounds || !soundEngine->isValidSoundId((nSound & 0x1ff)+1))
@ -637,11 +637,11 @@ void PlayFX2(unsigned short nSound, short nSprite, int sectf)
FSoundChan* chan = nullptr;
if (nSprite >= 0)
{
chan = soundEngine->StartSound(SOURCE_Actor, &sprite[nSprite], nullptr, CHAN_BODY, CHANF_OVERLAP, nSound+1, nVolume / 255.f,fullvol? 0.5 : ATTN_NORM, nullptr, (11025 + nPitch) / 11025.f);
chan = soundEngine->StartSound(SOURCE_Actor, &sprite[nSprite], nullptr, CHAN_BODY, chanflags| CHANF_OVERLAP, nSound+1, nVolume / 255.f,fullvol? 0.5 : ATTN_NORM, nullptr, (11025 + nPitch) / 11025.f);
}
else
{
chan = soundEngine->StartSound(SOURCE_Unattached, nullptr, &vv, CHAN_BODY, CHANF_OVERLAP, nSound+1, nVolume / 255.f, ATTN_NORM, nullptr, (11025 + nPitch) / 11025.f);
chan = soundEngine->StartSound(SOURCE_Unattached, nullptr, &vv, CHAN_BODY, chanflags | CHANF_OVERLAP, nSound+1, nVolume / 255.f, ATTN_NORM, nullptr, (11025 + nPitch) / 11025.f);
}
if (chan)
{
@ -660,13 +660,13 @@ void PlayFX2(unsigned short nSound, short nSprite, int sectf)
//
//==========================================================================
void PlayFXAtXYZ(unsigned short ax, int x, int y, int z, int nSector)
void PlayFXAtXYZ(unsigned short ax, int x, int y, int z, int nSector, EChanFlags chanflags)
{
soundx = x;
soundy = y;
soundz = z;
soundsect = nSector&0x3fff;
PlayFX2(ax, -1, nSector & 0x4000);
PlayFX2(ax, -1, nSector & 0x4000, chanflags);
}
//==========================================================================

View file

@ -131,8 +131,8 @@ int LoadSound(const char* sound);
void BendAmbientSound();
void CheckAmbience(short nSector);
void PlayFX2(unsigned short nSound, short nSprite, int sectf = 0);
void PlayFXAtXYZ(unsigned short nSound, int x, int y, int z, int nSector);
void PlayFX2(unsigned short nSound, short nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE);
void PlayFXAtXYZ(unsigned short nSound, int x, int y, int z, int nSector, EChanFlags chanflags = CHANF_NONE);
inline void D3PlayFX(unsigned short nSound, short nVal)
{
PlayFX2(nSound, nVal);

View file

@ -463,7 +463,7 @@ void FuncSwPressSector(int a, int, int nRun)
if (SwitchData[nSwitch].field_12)
{
short nSprite = PlayerList[nPlayer].nSprite;
PlayFXAtXYZ(StaticSound[nSwitchSound], sprite[nSprite].x, sprite[nSprite].y, 0, sprite[nSprite].sectnum);
PlayFXAtXYZ(StaticSound[nSwitchSound], sprite[nSprite].x, sprite[nSprite].y, 0, sprite[nSprite].sectnum, CHANF_LISTENERZ);
StatusMessage(300, "YOU NEED THE KEY FOR THIS DOOR");
}
@ -540,7 +540,7 @@ void FuncSwPressWall(int a, int, int nRun)
short nWall = SwitchData[nSwitch].nWall;
short nSector = SwitchData[nSwitch].nSector; // CHECKME - where is this set??
PlayFXAtXYZ(StaticSound[nSwitchSound], wall[nWall].x, wall[nWall].y, 0, nSector);
PlayFXAtXYZ(StaticSound[nSwitchSound], wall[nWall].x, wall[nWall].y, 0, nSector, CHANF_LISTENERZ);
return;
}