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_tesla.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_tesla.cpp')
| -rw-r--r-- | game/client/c_tesla.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/game/client/c_tesla.cpp b/game/client/c_tesla.cpp new file mode 100644 index 0000000..691192a --- /dev/null +++ b/game/client/c_tesla.cpp @@ -0,0 +1,65 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" +#include "c_tesla.h" +#include "fx.h" +#include <bitbuf.h> + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +IMPLEMENT_CLIENTCLASS_DT( C_Tesla, DT_Tesla, CTesla ) + RecvPropString( RECVINFO( m_SoundName ) ), + RecvPropString( RECVINFO( m_iszSpriteName ) ) +END_RECV_TABLE() + + +C_Tesla::C_Tesla() +{ +} + +void C_Tesla::ReceiveMessage( int classID, bf_read &msg ) +{ + CTeslaInfo teslaInfo; + + msg.ReadBitVec3Coord( teslaInfo.m_vPos ); + teslaInfo.m_vAngles.Init(); + + teslaInfo.m_nEntIndex = msg.ReadShort(); + teslaInfo.m_flRadius = msg.ReadFloat(); + + teslaInfo.m_vColor.x = ((unsigned char)msg.ReadChar()) / 255.0f; + teslaInfo.m_vColor.y = ((unsigned char)msg.ReadChar()) / 255.0f; + teslaInfo.m_vColor.z = ((unsigned char)msg.ReadChar()) / 255.0f; + + float flAlpha = 0; + flAlpha = ((unsigned char)msg.ReadChar()) / 255.0f; + + teslaInfo.m_nBeams = msg.ReadChar(); + + teslaInfo.m_flBeamWidth = msg.ReadFloat(); + teslaInfo.m_flTimeVisible = msg.ReadFloat(); + teslaInfo.m_pszSpriteName = m_iszSpriteName; + + EmitSound( m_SoundName ); + + m_QueuedCommands.AddToTail( teslaInfo ); + SetNextClientThink( CLIENT_THINK_ALWAYS ); +} + + +void C_Tesla::ClientThink() +{ + FOR_EACH_LL( m_QueuedCommands, i ) + { + FX_Tesla( m_QueuedCommands[i] ); + } + m_QueuedCommands.Purge(); + SetNextClientThink( CLIENT_THINK_NEVER ); +} + + |