summaryrefslogtreecommitdiff
path: root/game/client/tf/halloween/c_merasmus.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/tf/halloween/c_merasmus.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/tf/halloween/c_merasmus.cpp')
-rw-r--r--game/client/tf/halloween/c_merasmus.cpp148
1 files changed, 148 insertions, 0 deletions
diff --git a/game/client/tf/halloween/c_merasmus.cpp b/game/client/tf/halloween/c_merasmus.cpp
new file mode 100644
index 0000000..6e287dc
--- /dev/null
+++ b/game/client/tf/halloween/c_merasmus.cpp
@@ -0,0 +1,148 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+//
+//
+//=============================================================================
+#include "cbase.h"
+#include "NextBot/C_NextBot.h"
+#include "c_merasmus.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+#undef NextBot
+
+//-----------------------------------------------------------------------------
+IMPLEMENT_CLIENTCLASS_DT( C_Merasmus, DT_Merasmus, CMerasmus )
+ RecvPropBool( RECVINFO( m_bRevealed ) ),
+ RecvPropBool( RECVINFO( m_bIsDoingAOEAttack ) ),
+ RecvPropBool( RECVINFO( m_bStunned ) ),
+END_RECV_TABLE()
+
+
+//-----------------------------------------------------------------------------
+C_Merasmus::C_Merasmus()
+{
+ m_ghostEffect = NULL;
+ m_aoeEffect = NULL;
+ m_stunEffect = NULL;
+ m_bRevealed = false;
+ m_bWasRevealed = false;
+ m_bIsDoingAOEAttack = false;
+ m_bStunned = false;
+}
+
+
+//-----------------------------------------------------------------------------
+C_Merasmus::~C_Merasmus()
+{
+ if ( m_ghostEffect )
+ {
+ ParticleProp()->StopEmission( m_ghostEffect );
+ m_ghostEffect = NULL;
+ }
+
+ if ( m_aoeEffect )
+ {
+ ParticleProp()->StopEmission( m_aoeEffect );
+ m_aoeEffect = NULL;
+ }
+
+ if ( m_stunEffect )
+ {
+ ParticleProp()->StopEmission( m_stunEffect );
+ m_stunEffect = NULL;
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+void C_Merasmus::Spawn( void )
+{
+ BaseClass::Spawn();
+
+ m_vecViewOffset = Vector( 0, 0, 100.0f );
+}
+
+
+//-----------------------------------------------------------------------------
+// Return the origin for player observers tracking this target
+Vector C_Merasmus::GetObserverCamOrigin( void )
+{
+ return EyePosition();
+}
+
+
+//-----------------------------------------------------------------------------
+void C_Merasmus::OnPreDataChanged( DataUpdateType_t updateType )
+{
+ BaseClass::OnPreDataChanged( updateType );
+
+ m_bWasRevealed = m_bRevealed;
+}
+
+
+//-----------------------------------------------------------------------------
+void C_Merasmus::OnDataChanged( DataUpdateType_t updateType )
+{
+ BaseClass::OnDataChanged( updateType );
+
+ if ( m_bRevealed != m_bWasRevealed )
+ {
+ if ( m_bRevealed )
+ {
+ if ( !m_ghostEffect )
+ {
+ m_ghostEffect = ParticleProp()->Create( "merasmus_ambient_body", PATTACH_ABSORIGIN_FOLLOW );
+ }
+ }
+ else
+ {
+ if ( m_ghostEffect )
+ {
+ ParticleProp()->StopEmission( m_ghostEffect );
+ m_ghostEffect = NULL;
+ }
+ }
+ }
+
+ // book attack
+ if ( m_bIsDoingAOEAttack )
+ {
+ if ( !m_aoeEffect )
+ {
+ m_aoeEffect = ParticleProp()->Create( "merasmus_book_attack", PATTACH_POINT_FOLLOW, LookupAttachment( "effect_hand_R" ), Vector( 16.f, 0.f, 0.f ) );
+ }
+ }
+ else
+ {
+ if ( m_aoeEffect )
+ {
+ ParticleProp()->StopEmission( m_aoeEffect );
+ m_aoeEffect = NULL;
+ }
+ }
+
+ // stunned
+ if ( m_bStunned )
+ {
+ if ( !m_stunEffect )
+ {
+ m_stunEffect = ParticleProp()->Create( "merasmus_dazed", PATTACH_POINT_FOLLOW, LookupAttachment( "head" ) );
+ }
+ }
+ else
+ {
+ if ( m_stunEffect )
+ {
+ ParticleProp()->StopEmission( m_stunEffect );
+ m_stunEffect = NULL;
+ }
+ }
+}
+
+
+int C_Merasmus::GetSkin()
+{
+ return ( m_bIsDoingAOEAttack || m_bStunned ) ? 0 : 1;
+}