UTIL_IsLowViolence
UTIL_IsLowViolence is a legacy UTIL provided to check Violence settings.
Warning:The comments say this is only legacy support. See UTIL_ShouldShowBlood instead!
Usage
//-----------------------------------------------------------------------------
// Purpose: These convars are no longer necessary -- the engine is the final arbiter of
// violence settings -- but they're here for legacy support and for testing low
// violence when the engine is in normal violence mode.
// Input : int - color | The color of the blood to check against.
// Output :
//-----------------------------------------------------------------------------
bool UTIL_IsLowViolence( void )
{
if ( !violence_hblood.GetBool() || !violence_ablood.GetBool() || !violence_hgibs.GetBool() || !violence_agibs.GetBool() )
return true;
return engine->IsLowViolence();
}
static ConVar violence_hblood( "violence_hblood","1", 0, "Draw human blood" );
static ConVar violence_hgibs( "violence_hgibs","1", 0, "Show human gib entities" );
static ConVar violence_ablood( "violence_ablood","1", 0, "Draw alien blood" );
static ConVar violence_agibs( "violence_agibs","1", 0, "Show alien gib entities" );
Examples
//Checks to see if the game is in LowViolence mode.
//If it is, it doesn't play sounds. If it's not
//In low violence mode, then it plays some sounds.
if ( !UTIL_IsLowViolence() )
{
RemoveSpawnFlags( SF_NPC_GAG );
MoanSound( envZombieMoanIgnited, ARRAYSIZE( envZombieMoanIgnited ) );
if ( m_pMoanSound )
{
ENVELOPE_CONTROLLER.SoundChangePitch( m_pMoanSound, 120, 1.0 );
ENVELOPE_CONTROLLER.SoundChangeVolume( m_pMoanSound, 1, 1.0 );
}
}