mirror of
https://github.com/ENSL/NS.git
synced 2025-03-25 19:51:13 +00:00
cl_ambientsound and senslock commands
This commit is contained in:
parent
d2f9ceddd9
commit
bec0c1a46c
6 changed files with 57 additions and 8 deletions
|
@ -537,7 +537,7 @@ int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
|
|||
// the clients fov is actually set in the client data update section of the hud
|
||||
|
||||
// Set a new sensitivity
|
||||
if ( m_iFOV == def_fov )
|
||||
if ( m_iFOV == def_fov || CVAR_GET_FLOAT("senslock") == 1.0f)
|
||||
{
|
||||
// reset to saved sensitivity
|
||||
m_flMouseSensitivity = 0;
|
||||
|
|
|
@ -70,7 +70,7 @@ void CHud::Think(void)
|
|||
// the clients fov is actually set in the client data update section of the hud
|
||||
|
||||
// Set a new sensitivity
|
||||
if ( m_iFOV == default_fov->value )
|
||||
if ( m_iFOV == default_fov->value || CVAR_GET_FLOAT("senslock") == 1.0f)
|
||||
{
|
||||
// reset to saved sensitivity
|
||||
m_flMouseSensitivity = 0;
|
||||
|
|
|
@ -138,6 +138,8 @@ cvar_t *cl_dynamiclights;
|
|||
cvar_t *cl_buildmessages;
|
||||
cvar_t *cl_particleinfo;
|
||||
cvar_t *cl_widescreen;
|
||||
cvar_t *cl_ambientsound;
|
||||
cvar_t *senslock;
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
@ -1546,6 +1548,8 @@ void InitInput (void)
|
|||
cl_forcedefaultfov = gEngfuncs.pfnRegisterVariable ( kvForceDefaultFOV, "0", FCVAR_ARCHIVE );
|
||||
cl_particleinfo = gEngfuncs.pfnRegisterVariable ( kvParticleInfo, "0", FCVAR_ARCHIVE );
|
||||
cl_widescreen = gEngfuncs.pfnRegisterVariable ( kvWidescreen, "1", FCVAR_ARCHIVE );
|
||||
cl_ambientsound = gEngfuncs.pfnRegisterVariable ( kvAmbientSound, "2", FCVAR_ARCHIVE);
|
||||
senslock = gEngfuncs.pfnRegisterVariable ("senslock", "0", FCVAR_ARCHIVE);
|
||||
|
||||
// Initialize third person camera controls.
|
||||
CAM_Init();
|
||||
|
|
|
@ -240,8 +240,17 @@ void CAmbientGeneric :: Precache( void )
|
|||
}
|
||||
if ( m_fActive )
|
||||
{
|
||||
UTIL_EmitAmbientSound ( ENT(pev), pev->origin, szSoundFile,
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
}
|
||||
|
@ -433,8 +442,18 @@ void CAmbientGeneric :: RampThink( void )
|
|||
if (pitch == PITCH_NORM)
|
||||
pitch = PITCH_NORM + 1; // don't send 'no pitch' !
|
||||
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
//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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// update ramps at 5hz
|
||||
|
@ -631,8 +650,17 @@ void CAmbientGeneric :: ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCalle
|
|||
|
||||
InitModulationParms();
|
||||
|
||||
UTIL_EmitAmbientSound(ENT(pev), pev->origin, szSoundFile,
|
||||
//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);
|
||||
}
|
||||
|
||||
pev->nextthink = gpGlobals->time + 0.1;
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ extern cvar_t* cl_musicdir;
|
|||
#define kvCMHotKeys "cl_cmhotkeys"
|
||||
#define kvForceDefaultFOV "cl_forcedefaultfov"
|
||||
#define kvWidescreen "cl_widescreen"
|
||||
#define kvAmbientSound "cl_ambientsound"
|
||||
#define kvCenterEntityID "cl_centerentityid"
|
||||
#define kvHighDetail "cl_highdetail"
|
||||
#define kvCMHotkeys "cl_cmhotkeys"
|
||||
|
|
|
@ -684,11 +684,18 @@ void AvHNoBuild::Spawn()
|
|||
|
||||
|
||||
|
||||
|
||||
AvHMP3Audio::AvHMP3Audio()
|
||||
{
|
||||
this->mUseState = false;
|
||||
this->mSoundVolume = 255;
|
||||
//bool ambtoggle = CVAR_GET_FLOAT("cl_ambientsound") != 1;
|
||||
//if (ambtoggle)
|
||||
//{
|
||||
// this->mSoundVolume = 0;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
this->mSoundVolume = 255;
|
||||
// }
|
||||
this->mLooping = false;
|
||||
}
|
||||
|
||||
|
@ -706,7 +713,16 @@ void AvHMP3Audio::KeyValue( KeyValueData* pkvd )
|
|||
}
|
||||
else if(FStrEq(pkvd->szKeyName, "soundvolume"))
|
||||
{
|
||||
this->mSoundVolume = atoi(pkvd->szValue);
|
||||
bool ambtoggle = CVAR_GET_FLOAT("cl_ambientsound") != 1;
|
||||
if (ambtoggle)
|
||||
{
|
||||
this->mSoundVolume = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->mSoundVolume = atoi(pkvd->szValue);
|
||||
}
|
||||
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if(FStrEq(pkvd->szKeyName, "fadedistance"))
|
||||
|
|
Loading…
Reference in a new issue