diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /mp/src/game/client/c_te_showline.cpp | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'mp/src/game/client/c_te_showline.cpp')
| -rw-r--r-- | mp/src/game/client/c_te_showline.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/mp/src/game/client/c_te_showline.cpp b/mp/src/game/client/c_te_showline.cpp new file mode 100644 index 00000000..b34f80b8 --- /dev/null +++ b/mp/src/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 |