Sources/CryGame C++/Solution1/CryGame/GameMisc.cpp
//////////////////////////////////////////////////////////////////////////
//! Check if a sound is potentially hearable (used to check if loading a dialog is needed)

Check if a sound is potentially hearable (used to check if loading a dialog is needed)
Check if a sound is potentially hearable ( used to check if loading a dialog is needed )
bool CXGame::IsSoundPotentiallyHearable(Vec3d &SoundPos, float fClipRadius)
{
	ASSERT(m_pSystem);
	ISoundSystem *pSoundSystem=m_pSystem->GetISoundSystem();
	if (!pSoundSystem)
		return false;
	if (pSoundSystem->UsingDirectionalAttenuation())
		return true;
	CCamera &Cam=m_pSystem->GetViewCamera();
	float fDist=(Cam.GetPos()-SoundPos).GetLengthSquared();
	if (fDist<fClipRadius)
		return true;
	return false;
}
bool CXGame :: IsSoundPotentiallyHearable ( Vec3d & SoundPos , float fClipRadius ) { ASSERT ( m_pSystem ) ; ISoundSystem * pSoundSystem = m_pSystem -> GetISoundSystem ( ) ; if ( ! pSoundSystem ) return false ; if ( pSoundSystem -> UsingDirectionalAttenuation ( ) ) return true ; CCamera & Cam = m_pSystem -> GetViewCamera ( ) ; float fDist = ( Cam . GetPos ( ) - SoundPos ) . GetLengthSquared ( ) ; if ( fDist < fClipRadius ) return true ; return false ; }
Check if a sound is potentially hearable (used to check if loading a dialog is needed)
Check if a sound is potentially hearable ( used to check if loading a dialog is needed )