diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/c_te_showline.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/c_te_showline.cpp')
| -rw-r--r-- | game/client/c_te_showline.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/game/client/c_te_showline.cpp b/game/client/c_te_showline.cpp new file mode 100644 index 0000000..294d3cd --- /dev/null +++ b/game/client/c_te_showline.cpp @@ -0,0 +1,110 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "c_te_particlesystem.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// Purpose: Show Line TE +//----------------------------------------------------------------------------- +class C_TEShowLine : public C_TEParticleSystem +{ +public: + DECLARE_CLASS( C_TEShowLine, C_TEParticleSystem ); + DECLARE_CLIENTCLASS(); + + C_TEShowLine( void ); + virtual ~C_TEShowLine( void ); + + virtual void PostDataUpdate( DataUpdateType_t updateType ); + +public: + Vector m_vecEnd; +}; + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +C_TEShowLine::C_TEShowLine( void ) +{ + m_vecEnd.Init(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +C_TEShowLine::~C_TEShowLine( void ) +{ +} + + +//----------------------------------------------------------------------------- +// Purpose: +// Input : bool - +//----------------------------------------------------------------------------- +void C_TEShowLine::PostDataUpdate( DataUpdateType_t updateType ) +{ + Vector vec; + float len; + StandardParticle_t *p; + int dec; + static int tracercount; + + VectorSubtract (m_vecEnd, m_vecOrigin, vec); + len = VectorNormalize (vec); + + dec = 3; + + VectorScale(vec, dec, vec); + + CSmartPtr<CTEParticleRenderer> pRen = CTEParticleRenderer::Create( "TEShowLine", m_vecOrigin ); + if( !pRen ) + return; + + while (len > 0) + { + len -= dec; + + p = pRen->AddParticle(); + if ( p ) + { + p->m_Velocity.Init(); + + pRen->SetParticleLifetime(p, 30); + + p->SetColor(0, 1, 1); + p->SetAlpha(1); + pRen->SetParticleType(p, pt_static); + + p->m_Pos = m_vecOrigin; + + m_vecOrigin += vec; + } + } +} + +IMPLEMENT_CLIENTCLASS_EVENT_DT(C_TEShowLine, DT_TEShowLine, CTEShowLine) + RecvPropVector( RECVINFO(m_vecEnd)), +END_RECV_TABLE() + +void TE_ShowLine( IRecipientFilter& filter, float delay, + const Vector* start, const Vector* end ) +{ + // Major hack to simulate receiving network message + __g_C_TEShowLine.m_vecOrigin = *start; + __g_C_TEShowLine.m_vecEnd = *end; + + __g_C_TEShowLine.PostDataUpdate( DATA_UPDATE_CREATED ); +}
\ No newline at end of file |