aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/client/hl2/c_env_headcrabcanister.cpp
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/client/hl2/c_env_headcrabcanister.cpp
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/game/client/hl2/c_env_headcrabcanister.cpp')
-rw-r--r--sp/src/game/client/hl2/c_env_headcrabcanister.cpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/sp/src/game/client/hl2/c_env_headcrabcanister.cpp b/sp/src/game/client/hl2/c_env_headcrabcanister.cpp
new file mode 100644
index 00000000..292abc60
--- /dev/null
+++ b/sp/src/game/client/hl2/c_env_headcrabcanister.cpp
@@ -0,0 +1,97 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "cbase.h"
+#include "fx_explosion.h"
+#include "tempentity.h"
+#include "c_tracer.h"
+#include "env_headcrabcanister_shared.h"
+#include "baseparticleentity.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+//-----------------------------------------------------------------------------
+// Headcrab canister Class (Client-side only!)
+//-----------------------------------------------------------------------------
+class C_EnvHeadcrabCanister : public C_BaseAnimating
+{
+ DECLARE_CLASS( C_EnvHeadcrabCanister, C_BaseAnimating );
+ DECLARE_CLIENTCLASS();
+
+public:
+ //-------------------------------------------------------------------------
+ // Initialization/Destruction
+ //-------------------------------------------------------------------------
+ C_EnvHeadcrabCanister();
+ ~C_EnvHeadcrabCanister();
+
+ virtual void OnDataChanged( DataUpdateType_t updateType );
+ virtual void ClientThink();
+
+private:
+ C_EnvHeadcrabCanister( const C_EnvHeadcrabCanister & );
+
+ CEnvHeadcrabCanisterShared m_Shared;
+ CNetworkVar( bool, m_bLanded );
+};
+
+
+EXTERN_RECV_TABLE(DT_EnvHeadcrabCanisterShared);
+
+IMPLEMENT_CLIENTCLASS_DT( C_EnvHeadcrabCanister, DT_EnvHeadcrabCanister, CEnvHeadcrabCanister )
+ RecvPropDataTable( RECVINFO_DT( m_Shared ), 0, &REFERENCE_RECV_TABLE(DT_EnvHeadcrabCanisterShared) ),
+ RecvPropBool( RECVINFO( m_bLanded ) ),
+END_RECV_TABLE()
+
+
+//-----------------------------------------------------------------------------
+// Constructor
+//-----------------------------------------------------------------------------
+C_EnvHeadcrabCanister::C_EnvHeadcrabCanister()
+{
+}
+
+
+//-----------------------------------------------------------------------------
+// Destructor
+//-----------------------------------------------------------------------------
+C_EnvHeadcrabCanister::~C_EnvHeadcrabCanister()
+{
+}
+
+
+//-----------------------------------------------------------------------------
+// On data update
+//-----------------------------------------------------------------------------
+void C_EnvHeadcrabCanister::OnDataChanged( DataUpdateType_t updateType )
+{
+ BaseClass::OnDataChanged( updateType );
+ if ( updateType == DATA_UPDATE_CREATED )
+ {
+ SetNextClientThink( CLIENT_THINK_ALWAYS );
+ }
+
+ // Stop client-side simulation on landing
+ if ( m_bLanded )
+ {
+ SetNextClientThink( CLIENT_THINK_NEVER );
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Compute position
+//-----------------------------------------------------------------------------
+void C_EnvHeadcrabCanister::ClientThink()
+{
+ Vector vecEndPosition;
+ QAngle vecEndAngles;
+ m_Shared.GetPositionAtTime( gpGlobals->curtime, vecEndPosition, vecEndAngles );
+ SetAbsOrigin( vecEndPosition );
+ SetAbsAngles( vecEndAngles );
+}
+