mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-30 05:59:20 +00:00
upload "kind" alien swarm
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
@@ -46,6 +46,8 @@ private:
|
||||
// ------------------------------
|
||||
void InputLightOn( inputdata_t &inputdata );
|
||||
void InputLightOff( inputdata_t &inputdata );
|
||||
void InputSetColor( inputdata_t &inputdata );
|
||||
void InputForceUpdate( inputdata_t &inputdata );
|
||||
|
||||
// Creates the efficient spotlight
|
||||
void CreateEfficientSpotlight();
|
||||
@@ -67,7 +69,6 @@ private:
|
||||
float m_flSpotlightCurLength;
|
||||
float m_flSpotlightGoalWidth;
|
||||
float m_flHDRColorScale;
|
||||
int m_nMinDXLevel;
|
||||
|
||||
public:
|
||||
COutputEvent m_OnOn, m_OnOff; ///< output fires when turned on, off
|
||||
@@ -91,11 +92,13 @@ BEGIN_DATADESC( CPointSpotlight )
|
||||
DEFINE_KEYFIELD( m_flSpotlightMaxLength,FIELD_FLOAT, "SpotlightLength"),
|
||||
DEFINE_KEYFIELD( m_flSpotlightGoalWidth,FIELD_FLOAT, "SpotlightWidth"),
|
||||
DEFINE_KEYFIELD( m_flHDRColorScale, FIELD_FLOAT, "HDRColorScale" ),
|
||||
DEFINE_KEYFIELD( m_nMinDXLevel, FIELD_INTEGER, "mindxlevel" ),
|
||||
|
||||
// Inputs
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "LightOn", InputLightOn ),
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "LightOff", InputLightOff ),
|
||||
DEFINE_INPUTFUNC( FIELD_COLOR32, "SetColor", InputSetColor ),
|
||||
DEFINE_INPUTFUNC( FIELD_VOID, "ForceUpdate", InputForceUpdate ),
|
||||
|
||||
DEFINE_OUTPUT( m_OnOn, "OnLightOn" ),
|
||||
DEFINE_OUTPUT( m_OnOff, "OnLightOff" ),
|
||||
|
||||
@@ -117,7 +120,6 @@ CPointSpotlight::CPointSpotlight()
|
||||
m_vSpotlightDir.Init();
|
||||
#endif
|
||||
m_flHDRColorScale = 1.0f;
|
||||
m_nMinDXLevel = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,23 +191,23 @@ void CPointSpotlight::ComputeRenderInfo()
|
||||
// Fade out spotlight end if past max length.
|
||||
if ( m_flSpotlightCurLength > 2*m_flSpotlightMaxLength )
|
||||
{
|
||||
m_hSpotlightTarget->SetRenderColorA( 0 );
|
||||
m_hSpotlightTarget->SetRenderAlpha( 0 );
|
||||
m_hSpotlight->SetFadeLength( m_flSpotlightMaxLength );
|
||||
}
|
||||
else if ( m_flSpotlightCurLength > m_flSpotlightMaxLength )
|
||||
{
|
||||
m_hSpotlightTarget->SetRenderColorA( (1-((m_flSpotlightCurLength-m_flSpotlightMaxLength)/m_flSpotlightMaxLength)) );
|
||||
m_hSpotlightTarget->SetRenderAlpha( (1-((m_flSpotlightCurLength-m_flSpotlightMaxLength)/m_flSpotlightMaxLength)) );
|
||||
m_hSpotlight->SetFadeLength( m_flSpotlightMaxLength );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hSpotlightTarget->SetRenderColorA( 1.0 );
|
||||
m_hSpotlightTarget->SetRenderAlpha( 1.0 );
|
||||
m_hSpotlight->SetFadeLength( m_flSpotlightCurLength );
|
||||
}
|
||||
|
||||
// Adjust end width to keep beam width constant
|
||||
float flNewWidth = m_flSpotlightGoalWidth * (m_flSpotlightCurLength / m_flSpotlightMaxLength);
|
||||
flNewWidth = clamp(flNewWidth, 0.f, MAX_BEAM_WIDTH );
|
||||
flNewWidth = clamp(flNewWidth, 0, MAX_BEAM_WIDTH );
|
||||
m_hSpotlight->SetEndWidth(flNewWidth);
|
||||
|
||||
// Adjust width of light on the end.
|
||||
@@ -359,7 +361,6 @@ void CPointSpotlight::SpotlightCreate(void)
|
||||
m_hSpotlight->SetBeamFlags( (FBEAM_SHADEOUT|FBEAM_NOTILE) );
|
||||
m_hSpotlight->SetBrightness( 64 );
|
||||
m_hSpotlight->SetNoise( 0 );
|
||||
m_hSpotlight->SetMinDXLevel( m_nMinDXLevel );
|
||||
|
||||
if ( m_bEfficientSpotlight )
|
||||
{
|
||||
@@ -509,3 +510,23 @@ void CPointSpotlight::InputLightOff( inputdata_t &inputdata )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Set the beam's color
|
||||
//-----------------------------------------------------------------------------
|
||||
void CPointSpotlight::InputSetColor( inputdata_t &inputdata )
|
||||
{
|
||||
if ( m_hSpotlight )
|
||||
{
|
||||
color32 clr = inputdata.value.Color32();
|
||||
m_hSpotlight->SetColor( clr.r, clr.g, clr.b );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Force update the spotlight
|
||||
//-----------------------------------------------------------------------------
|
||||
void CPointSpotlight::InputForceUpdate( inputdata_t &inputdata )
|
||||
{
|
||||
SpotlightUpdate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user