mirror of
https://github.com/ENSL/NS.git
synced 2024-11-10 15:21:54 +00:00
cl_ambientsound corrected to be client side instead of server side. Works for mp3s. Wav ambient sound files in maps can't be toggled via client cvar due to engine limitation.
This commit is contained in:
parent
10a602433a
commit
e5d4653cf3
3 changed files with 16 additions and 54 deletions
|
@ -240,17 +240,8 @@ void CAmbientGeneric :: Precache( void )
|
|||
}
|
||||
if ( m_fActive )
|
||||
{
|
||||
|
||||
if (CVAR_GET_FLOAT("cl_ambientsound") == 0.0f)
|
||||
{
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
0, m_flAttenuation, SND_SPAWNING, m_dpv.pitch);
|
||||
}
|
||||
else if (CVAR_GET_FLOAT("cl_ambientsound") == 2.0f)
|
||||
{
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
(m_dpv.vol * 0.01), m_flAttenuation, SND_SPAWNING, m_dpv.pitch);
|
||||
}
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
(m_dpv.vol * 0.01), m_flAttenuation, SND_SPAWNING, m_dpv.pitch);
|
||||
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
|
@ -442,18 +433,8 @@ void CAmbientGeneric :: RampThink( void )
|
|||
if (pitch == PITCH_NORM)
|
||||
pitch = PITCH_NORM + 1; // don't send 'no pitch' !
|
||||
|
||||
//bool ambtoggle = CVAR_GET_FLOAT("cl_ambientsound") == 0.0f;
|
||||
if (CVAR_GET_FLOAT("cl_ambientsound") == 0.0f)
|
||||
{
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
0, m_flAttenuation, flags, pitch);
|
||||
}
|
||||
else if (CVAR_GET_FLOAT("cl_ambientsound") == 2.0f)
|
||||
{
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
(vol * 0.01), m_flAttenuation, flags, pitch);
|
||||
}
|
||||
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
(vol * 0.01), m_flAttenuation, flags, pitch);
|
||||
}
|
||||
|
||||
// update ramps at 5hz
|
||||
|
@ -650,17 +631,8 @@ void CAmbientGeneric :: ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCalle
|
|||
|
||||
InitModulationParms();
|
||||
|
||||
//bool ambtoggle = CVAR_GET_FLOAT("cl_ambientsound") == 0.0f;
|
||||
if (CVAR_GET_FLOAT("cl_ambientsound") == 0.0f)
|
||||
{
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
0, m_flAttenuation, 0, m_dpv.pitch);
|
||||
}
|
||||
else if (CVAR_GET_FLOAT("cl_ambientsound") == 2.0f)
|
||||
{
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
(m_dpv.vol * 0.01), m_flAttenuation, 0, m_dpv.pitch);
|
||||
}
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
(m_dpv.vol * 0.01), m_flAttenuation, 0, m_dpv.pitch);
|
||||
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
|
|
|
@ -101,7 +101,14 @@ void AvHAmbientSound::UpdateVolume(const Vector& inListenerPosition)
|
|||
theVolume = this->mVolume - this->mVolume*(theDistance/(float)this->mFadeDistance);
|
||||
}
|
||||
|
||||
theVolume = min(max(0, theVolume), 255);
|
||||
if (CVAR_GET_FLOAT("cl_ambientsound") != 1.0f)
|
||||
{
|
||||
theVolume = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
theVolume = min(max(0, theVolume), 255);
|
||||
}
|
||||
|
||||
FMOD_INSTANCE* theFMOD = gHUD.GetFMOD();
|
||||
|
||||
|
|
|
@ -687,15 +687,7 @@ void AvHNoBuild::Spawn()
|
|||
AvHMP3Audio::AvHMP3Audio()
|
||||
{
|
||||
this->mUseState = false;
|
||||
//bool ambtoggle = CVAR_GET_FLOAT("cl_ambientsound") != 1;
|
||||
//if (ambtoggle)
|
||||
//{
|
||||
// this->mSoundVolume = 0;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this->mSoundVolume = 255;
|
||||
// }
|
||||
this->mSoundVolume = 255;
|
||||
this->mLooping = false;
|
||||
}
|
||||
|
||||
|
@ -713,16 +705,7 @@ void AvHMP3Audio::KeyValue( KeyValueData* pkvd )
|
|||
}
|
||||
else if(FStrEq(pkvd->szKeyName, "soundvolume"))
|
||||
{
|
||||
bool ambtoggle = CVAR_GET_FLOAT("cl_ambientsound") != 1;
|
||||
if (ambtoggle)
|
||||
{
|
||||
this->mSoundVolume = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->mSoundVolume = atoi(pkvd->szValue);
|
||||
}
|
||||
|
||||
this->mSoundVolume = atoi(pkvd->szValue);
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if(FStrEq(pkvd->szKeyName, "fadedistance"))
|
||||
|
|
Loading…
Reference in a new issue