1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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;
}
}
|