From f56bb35301836e56582a575a75864392a0177875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20P=2E=20Tjern=C3=B8?= Date: Mon, 2 Dec 2013 19:31:46 -0800 Subject: Fix line endings. WHAMMY. --- mp/src/game/client/c_func_tracktrain.cpp | 244 +++++++++++++++---------------- 1 file changed, 122 insertions(+), 122 deletions(-) (limited to 'mp/src/game/client/c_func_tracktrain.cpp') diff --git a/mp/src/game/client/c_func_tracktrain.cpp b/mp/src/game/client/c_func_tracktrain.cpp index 7a395ded..c25c7448 100644 --- a/mp/src/game/client/c_func_tracktrain.cpp +++ b/mp/src/game/client/c_func_tracktrain.cpp @@ -1,122 +1,122 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -// $NoKeywords: $ -//=============================================================================// - -#include "cbase.h" -#include "c_baseentity.h" -#include "soundinfo.h" - -// memdbgon must be the last include file in a .cpp file!!! -#include "tier0/memdbgon.h" - -//----------------------------------------------------------------------------- -// An entity which emits other entities at points -//----------------------------------------------------------------------------- -class C_FuncTrackTrain : public C_BaseEntity -{ -public: - DECLARE_CLASS( C_FuncTrackTrain, C_BaseEntity ); - DECLARE_CLIENTCLASS(); - -public: - virtual void OnDataChanged( DataUpdateType_t updateType ); - virtual bool GetSoundSpatialization( SpatializationInfo_t& info ); - - virtual bool IsBaseTrain( void ) const { return true; } - - -private: - int m_nLongAxis; - float m_flRadius; - float m_flLineLength; -}; - - -//----------------------------------------------------------------------------- -// Datatable -//----------------------------------------------------------------------------- -IMPLEMENT_CLIENTCLASS_DT( C_FuncTrackTrain, DT_FuncTrackTrain, CFuncTrackTrain ) -END_RECV_TABLE() - - -//----------------------------------------------------------------------------- -// Sound spatialization -//----------------------------------------------------------------------------- -void C_FuncTrackTrain::OnDataChanged( DataUpdateType_t updateType ) -{ - BaseClass::OnDataChanged( updateType ); - - if (updateType == DATA_UPDATE_CREATED) - { - // Compute the cross-sectional area and dimension and length of the line segment - int nIndex1, nIndex2; - const Vector &vecOBBSize = CollisionProp()->OBBSize(); - if ( ( vecOBBSize.x > vecOBBSize.y ) && ( vecOBBSize.x > vecOBBSize.z ) ) - { - m_nLongAxis = 0; - nIndex1 = 1; nIndex2 = 2; - } - else if ( vecOBBSize.y > vecOBBSize.z ) - { - m_nLongAxis = 1; - nIndex1 = 0; nIndex2 = 2; - } - else - { - m_nLongAxis = 2; - nIndex1 = 0; nIndex2 = 1; - } - - m_flRadius = sqrt( vecOBBSize[nIndex1] * vecOBBSize[nIndex1] + vecOBBSize[nIndex2] * vecOBBSize[nIndex2] ) * 0.5f; - m_flLineLength = vecOBBSize[m_nLongAxis]; - } -} - - -//----------------------------------------------------------------------------- -// Sound spatialization -//----------------------------------------------------------------------------- -bool C_FuncTrackTrain::GetSoundSpatialization( SpatializationInfo_t& info ) -{ - // Out of PVS - if ( IsDormant() ) - return false; - - if ( info.pflRadius ) - { - *info.pflRadius = m_flRadius; - } - - if ( info.pOrigin ) - { - Vector vecStart, vecEnd, vecWorldDir; - Vector vecDir = vec3_origin; - vecDir[m_nLongAxis] = 1.0f; - VectorRotate( vecDir, EntityToWorldTransform(), vecWorldDir ); - VectorMA( WorldSpaceCenter(), -0.5f * m_flLineLength, vecWorldDir, vecStart ); - VectorMA( vecStart, m_flLineLength, vecWorldDir, vecEnd ); - - float t; - CalcClosestPointOnLine( info.info.vListenerOrigin, vecStart, vecEnd, *info.pOrigin, &t ); - if ( t < 0.0f ) - { - *info.pOrigin = vecStart; - } - else if ( t > 1.0f ) - { - *info.pOrigin = vecEnd; - } - } - - if ( info.pAngles ) - { - VectorCopy( CollisionProp()->GetCollisionAngles(), *info.pAngles ); - } - - return true; -} - - +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" +#include "c_baseentity.h" +#include "soundinfo.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// An entity which emits other entities at points +//----------------------------------------------------------------------------- +class C_FuncTrackTrain : public C_BaseEntity +{ +public: + DECLARE_CLASS( C_FuncTrackTrain, C_BaseEntity ); + DECLARE_CLIENTCLASS(); + +public: + virtual void OnDataChanged( DataUpdateType_t updateType ); + virtual bool GetSoundSpatialization( SpatializationInfo_t& info ); + + virtual bool IsBaseTrain( void ) const { return true; } + + +private: + int m_nLongAxis; + float m_flRadius; + float m_flLineLength; +}; + + +//----------------------------------------------------------------------------- +// Datatable +//----------------------------------------------------------------------------- +IMPLEMENT_CLIENTCLASS_DT( C_FuncTrackTrain, DT_FuncTrackTrain, CFuncTrackTrain ) +END_RECV_TABLE() + + +//----------------------------------------------------------------------------- +// Sound spatialization +//----------------------------------------------------------------------------- +void C_FuncTrackTrain::OnDataChanged( DataUpdateType_t updateType ) +{ + BaseClass::OnDataChanged( updateType ); + + if (updateType == DATA_UPDATE_CREATED) + { + // Compute the cross-sectional area and dimension and length of the line segment + int nIndex1, nIndex2; + const Vector &vecOBBSize = CollisionProp()->OBBSize(); + if ( ( vecOBBSize.x > vecOBBSize.y ) && ( vecOBBSize.x > vecOBBSize.z ) ) + { + m_nLongAxis = 0; + nIndex1 = 1; nIndex2 = 2; + } + else if ( vecOBBSize.y > vecOBBSize.z ) + { + m_nLongAxis = 1; + nIndex1 = 0; nIndex2 = 2; + } + else + { + m_nLongAxis = 2; + nIndex1 = 0; nIndex2 = 1; + } + + m_flRadius = sqrt( vecOBBSize[nIndex1] * vecOBBSize[nIndex1] + vecOBBSize[nIndex2] * vecOBBSize[nIndex2] ) * 0.5f; + m_flLineLength = vecOBBSize[m_nLongAxis]; + } +} + + +//----------------------------------------------------------------------------- +// Sound spatialization +//----------------------------------------------------------------------------- +bool C_FuncTrackTrain::GetSoundSpatialization( SpatializationInfo_t& info ) +{ + // Out of PVS + if ( IsDormant() ) + return false; + + if ( info.pflRadius ) + { + *info.pflRadius = m_flRadius; + } + + if ( info.pOrigin ) + { + Vector vecStart, vecEnd, vecWorldDir; + Vector vecDir = vec3_origin; + vecDir[m_nLongAxis] = 1.0f; + VectorRotate( vecDir, EntityToWorldTransform(), vecWorldDir ); + VectorMA( WorldSpaceCenter(), -0.5f * m_flLineLength, vecWorldDir, vecStart ); + VectorMA( vecStart, m_flLineLength, vecWorldDir, vecEnd ); + + float t; + CalcClosestPointOnLine( info.info.vListenerOrigin, vecStart, vecEnd, *info.pOrigin, &t ); + if ( t < 0.0f ) + { + *info.pOrigin = vecStart; + } + else if ( t > 1.0f ) + { + *info.pOrigin = vecEnd; + } + } + + if ( info.pAngles ) + { + VectorCopy( CollisionProp()->GetCollisionAngles(), *info.pAngles ); + } + + return true; +} + + -- cgit v1.2.3