summaryrefslogtreecommitdiff
path: root/game/client/tf/c_entity_currencypack.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/client/tf/c_entity_currencypack.cpp')
-rw-r--r--game/client/tf/c_entity_currencypack.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/game/client/tf/c_entity_currencypack.cpp b/game/client/tf/c_entity_currencypack.cpp
new file mode 100644
index 0000000..5ec9843
--- /dev/null
+++ b/game/client/tf/c_entity_currencypack.cpp
@@ -0,0 +1,93 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+#include "cbase.h"
+
+#include "c_entity_currencypack.h"
+#include "c_tf_player.h"
+
+IMPLEMENT_CLIENTCLASS_DT( C_CurrencyPack, DT_CurrencyPack, CCurrencyPack )
+ RecvPropBool( RECVINFO( m_bDistributed ) ),
+END_RECV_TABLE()
+
+C_CurrencyPack::C_CurrencyPack()
+{
+ m_bDistributed = false;
+
+ m_pGlowEffect = NULL;
+ m_bShouldGlowForLocalPlayer = false;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+C_CurrencyPack::~C_CurrencyPack()
+{
+ DestroyGlowEffect();
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void C_CurrencyPack::OnDataChanged( DataUpdateType_t updateType )
+{
+ BaseClass::OnDataChanged( updateType );
+
+ if ( updateType == DATA_UPDATE_CREATED )
+ {
+ SetNextClientThink( CLIENT_THINK_ALWAYS );
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void C_CurrencyPack::ClientThink()
+{
+#ifdef STAGING_ONLY
+ int iSeeCashThroughWall = 0;
+ C_TFPlayer *pTFPlayer = C_TFPlayer::GetLocalTFPlayer();
+ if ( pTFPlayer && pTFPlayer->IsAlive() )
+ {
+ CALL_ATTRIB_HOOK_INT_ON_OTHER( pTFPlayer, iSeeCashThroughWall, mvm_see_cash_through_wall );
+ }
+
+ bool bShouldGlowForLocalPlayer = iSeeCashThroughWall != 0;
+ if ( m_bShouldGlowForLocalPlayer != bShouldGlowForLocalPlayer )
+ {
+ m_bShouldGlowForLocalPlayer = bShouldGlowForLocalPlayer;
+ UpdateGlowEffect();
+ }
+#endif // STAGING_ONLY
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void C_CurrencyPack::UpdateGlowEffect( void )
+{
+ // destroy the existing effect
+ if ( m_pGlowEffect )
+ {
+ DestroyGlowEffect();
+ }
+
+ // create a new effect if we have a cart
+ if ( m_bShouldGlowForLocalPlayer )
+ {
+ Vector color = m_bDistributed ? Vector( 150, 0, 0 ) : Vector( 0, 150, 0 );
+ m_pGlowEffect = new CGlowObject( this, color, 1.0, true );
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void C_CurrencyPack::DestroyGlowEffect( void )
+{
+ if ( m_pGlowEffect )
+ {
+ delete m_pGlowEffect;
+ m_pGlowEffect = NULL;
+ }
+}