aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/server/point_spotlight.cpp
diff options
context:
space:
mode:
authorJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
committerJohn Schoenick <[email protected]>2015-09-09 18:35:41 -0700
commit0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch)
treec831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/game/server/point_spotlight.cpp
parentUpdated the SDK with the latest code from the TF and HL2 branches. (diff)
downloadsource-sdk-2013-master.tar.xz
source-sdk-2013-master.zip
Updated the SDK with the latest code from the TF and HL2 branches.HEADmaster
Diffstat (limited to 'mp/src/game/server/point_spotlight.cpp')
-rw-r--r--mp/src/game/server/point_spotlight.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/mp/src/game/server/point_spotlight.cpp b/mp/src/game/server/point_spotlight.cpp
index 9ff28cf6..030537ed 100644
--- a/mp/src/game/server/point_spotlight.cpp
+++ b/mp/src/game/server/point_spotlight.cpp
@@ -56,6 +56,7 @@ private:
private:
bool m_bSpotlightOn;
bool m_bEfficientSpotlight;
+ bool m_bIgnoreSolid;
Vector m_vSpotlightTargetPos;
Vector m_vSpotlightCurrentPos;
Vector m_vSpotlightDir;
@@ -88,6 +89,7 @@ BEGIN_DATADESC( CPointSpotlight )
DEFINE_FIELD( m_vSpotlightDir, FIELD_VECTOR ),
DEFINE_FIELD( m_nHaloSprite, FIELD_INTEGER ),
+ DEFINE_KEYFIELD( m_bIgnoreSolid, FIELD_BOOLEAN, "IgnoreSolid" ),
DEFINE_KEYFIELD( m_flSpotlightMaxLength,FIELD_FLOAT, "SpotlightLength"),
DEFINE_KEYFIELD( m_flSpotlightGoalWidth,FIELD_FLOAT, "SpotlightWidth"),
DEFINE_KEYFIELD( m_flHDRColorScale, FIELD_FLOAT, "HDRColorScale" ),
@@ -118,6 +120,7 @@ CPointSpotlight::CPointSpotlight()
#endif
m_flHDRColorScale = 1.0f;
m_nMinDXLevel = 0;
+ m_bIgnoreSolid = false;
}
@@ -332,12 +335,21 @@ void CPointSpotlight::SpotlightCreate(void)
AngleVectors( GetAbsAngles(), &m_vSpotlightDir );
- trace_t tr;
- UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + m_vSpotlightDir * m_flSpotlightMaxLength, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr);
+ Vector vTargetPos;
+ if ( m_bIgnoreSolid )
+ {
+ vTargetPos = GetAbsOrigin() + m_vSpotlightDir * m_flSpotlightMaxLength;
+ }
+ else
+ {
+ trace_t tr;
+ UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + m_vSpotlightDir * m_flSpotlightMaxLength, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
+ vTargetPos = tr.endpos;
+ }
m_hSpotlightTarget = (CSpotlightEnd*)CreateEntityByName( "spotlight_end" );
m_hSpotlightTarget->Spawn();
- m_hSpotlightTarget->SetAbsOrigin( tr.endpos );
+ m_hSpotlightTarget->SetAbsOrigin( vTargetPos );
m_hSpotlightTarget->SetOwnerEntity( this );
m_hSpotlightTarget->m_clrRender = m_clrRender;
m_hSpotlightTarget->m_Radius = m_flSpotlightMaxLength;
@@ -381,9 +393,17 @@ Vector CPointSpotlight::SpotlightCurrentPos(void)
AngleVectors( GetAbsAngles(), &m_vSpotlightDir );
// Get beam end point. Only collide with solid objects, not npcs
- trace_t tr;
- UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + (m_vSpotlightDir * 2 * m_flSpotlightMaxLength), MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
- return tr.endpos;
+ Vector vEndPos = GetAbsOrigin() + ( m_vSpotlightDir * 2 * m_flSpotlightMaxLength );
+ if ( m_bIgnoreSolid )
+ {
+ return vEndPos;
+ }
+ else
+ {
+ trace_t tr;
+ UTIL_TraceLine( GetAbsOrigin(), vEndPos, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
+ return tr.endpos;
+ }
}
//------------------------------------------------------------------------------