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/server/te_clientprojectile.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'game/server/te_clientprojectile.cpp')
| -rw-r--r-- | game/server/te_clientprojectile.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/game/server/te_clientprojectile.cpp b/game/server/te_clientprojectile.cpp new file mode 100644 index 0000000..16e1b94 --- /dev/null +++ b/game/server/te_clientprojectile.cpp @@ -0,0 +1,117 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#include "cbase.h" +#include "basetempentity.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CTEClientProjectile : public CBaseTempEntity +{ +public: + DECLARE_CLASS( CTEClientProjectile, CBaseTempEntity ); + + CTEClientProjectile( const char *name ); + virtual ~CTEClientProjectile( void ); + + virtual void Test( const Vector& current_origin, const QAngle& current_angles ); + + DECLARE_SERVERCLASS(); + +public: + CNetworkVector( m_vecOrigin ); + CNetworkVector( m_vecVelocity ); + CNetworkVar( int, m_nModelIndex ); + CNetworkVar( int, m_nLifeTime ); + CNetworkHandle( CBaseEntity, m_hOwner ); +}; + +//----------------------------------------------------------------------------- +// Purpose: +// Input : *name - +//----------------------------------------------------------------------------- +CTEClientProjectile::CTEClientProjectile( const char *name ) : + CBaseTempEntity( name ) +{ + m_vecOrigin.Init(); + m_vecVelocity.Init(); + m_nModelIndex = 0; + m_nLifeTime = 0; + m_hOwner = NULL; +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +CTEClientProjectile::~CTEClientProjectile( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : *current_origin - +// *current_angles - +//----------------------------------------------------------------------------- +void CTEClientProjectile::Test( const Vector& current_origin, const QAngle& current_angles ) +{ + // Fill in data + m_vecOrigin = current_origin; + + Vector forward; + AngleVectors( current_angles, &forward ); + forward[2] = 0.0; + VectorNormalize( forward ); + + m_vecVelocity = forward * 2048; + + m_nLifeTime = 5; + m_hOwner = NULL; + + CBroadcastRecipientFilter filter; + Create( filter, 0.0 ); +} + +IMPLEMENT_SERVERCLASS_ST(CTEClientProjectile, DT_TEClientProjectile) + SendPropVector( SENDINFO(m_vecOrigin), -1, SPROP_COORD), + SendPropVector( SENDINFO(m_vecVelocity), -1, SPROP_COORD), + SendPropModelIndex( SENDINFO(m_nModelIndex) ), + SendPropInt( SENDINFO(m_nLifeTime), 6, SPROP_UNSIGNED ), + SendPropEHandle(SENDINFO(m_hOwner)), +END_SEND_TABLE() + + +// Singleton to fire TEClientProjectile objects +static CTEClientProjectile g_TEClientProjectile( "Client Projectile" ); + +//----------------------------------------------------------------------------- +// Purpose: +// Input : msg_dest - +// delay - +// *origin - +// *recipient - +// *mins - +// *maxs - +// height - +// modelindex - +// count - +// speed - +//----------------------------------------------------------------------------- +void TE_ClientProjectile( IRecipientFilter& filter, float delay, + const Vector* vecOrigin, const Vector* vecVelocity, int modelindex, int lifetime, CBaseEntity *pOwner ) +{ + g_TEClientProjectile.m_vecOrigin = *vecOrigin; + g_TEClientProjectile.m_vecVelocity = *vecVelocity; + g_TEClientProjectile.m_nModelIndex = modelindex; + g_TEClientProjectile.m_nLifeTime = lifetime; + g_TEClientProjectile.m_hOwner = pOwner; + + // Send it over the wire + g_TEClientProjectile.Create( filter, delay ); +}
\ No newline at end of file |