Skip to content

Commit e6d4fd5

Browse files
committed
update glow effect render flags based upon new functionality
1 parent 44de751 commit e6d4fd5

11 files changed

Lines changed: 54 additions & 28 deletions

src/game/client/c_basecombatcharacter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,12 @@ void C_BaseCombatCharacter::DoMuzzleFlash()
107107
//-----------------------------------------------------------------------------
108108
// Purpose:
109109
//-----------------------------------------------------------------------------
110-
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b )
110+
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b, float *a )
111111
{
112112
*r = 0.76f;
113113
*g = 0.76f;
114114
*b = 0.76f;
115+
*a = 1.0f;
115116
}
116117

117118
void C_BaseCombatCharacter::SetClientSideGlowEnabled(bool bEnabled, int iSourceFlag)
@@ -171,10 +172,10 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
171172
// create a new effect
172173
if ( m_bGlowEnabled || m_bClientSideGlowEnabled )
173174
{
174-
float r, g, b;
175-
GetGlowEffectColor( &r, &g, &b );
175+
float r, g, b, a = 1.0f;
176+
GetGlowEffectColor( &r, &g, &b, &a );
176177

177-
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
178+
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), a, true );
178179
}
179180
}
180181

src/game/client/c_basecombatcharacter.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class C_BaseCombatCharacter : public C_BaseFlex
100100

101101
#ifdef GLOWS_ENABLE
102102
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
103-
virtual void GetGlowEffectColor( float *r, float *g, float *b );
103+
virtual void GetGlowEffectColor( float *r, float *g, float *b, float *a );
104104
// void EnableGlowEffect( float r, float g, float b );
105105

106106
void SetClientSideGlowEnabled( bool bEnabled, int iSourceFlag = CLIENTSIDE_GLOW_ANONYMOUS );
@@ -116,6 +116,14 @@ class C_BaseCombatCharacter : public C_BaseFlex
116116
#ifdef GLOWS_ENABLE
117117
virtual void UpdateGlowEffect( void );
118118
virtual void DestroyGlowEffect( void );
119+
int GetGlowSources( void ) const { return m_iClientSideGlowSources; }
120+
void SetGlowRenderFlags( bool bRenderWhenOccluded, bool bRenderWhenUnoccluded )
121+
{
122+
if ( m_pGlowEffect )
123+
{
124+
m_pGlowEffect->SetRenderFlags( bRenderWhenOccluded, bRenderWhenUnoccluded );
125+
}
126+
}
119127
#endif // GLOWS_ENABLE
120128

121129
int m_bloodColor; // color of blood particles

src/game/client/tf/c_baseobject.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,17 +848,19 @@ void C_BaseObject::DisplayHintTo( C_BasePlayer *pPlayer )
848848
//-----------------------------------------------------------------------------
849849
// Purpose:
850850
//-----------------------------------------------------------------------------
851-
void C_BaseObject::GetGlowEffectColor( float *r, float *g, float *b )
851+
void C_BaseObject::GetGlowEffectColor( float *r, float *g, float *b, float *a )
852852
{
853853
if ( TFGameRules() )
854854
{
855855
TFGameRules()->GetTeamGlowColor( GetTeamNumber(), *r, *g, *b );
856+
*a = 1.0f;
856857
}
857858
else
858859
{
859860
*r = 0.76f;
860861
*g = 0.76f;
861862
*b = 0.76f;
863+
*a = 1.0f;
862864
}
863865
}
864866

src/game/client/tf/c_baseobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class C_BaseObject : public C_BaseCombatCharacter, public IHasBuildPoints, publi
229229
public:
230230
virtual void DisplayHintTo( C_BasePlayer *pPlayer );
231231

232-
virtual void GetGlowEffectColor( float *r, float *g, float *b );
232+
virtual void GetGlowEffectColor( float *r, float *g, float *b, float *a );
233233

234234
bool IsMapPlaced( void ){ return m_bWasMapPlaced; }
235235

src/game/client/tf/c_entity_currencypack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void C_CurrencyPack::UpdateGlowEffect( void )
5757
DestroyGlowEffect();
5858
}
5959

60-
// create a new effect if we have a cart
60+
// create a new effect if we have some money
6161
if ( m_bShouldGlowForLocalPlayer )
6262
{
6363
Vector color = m_bDistributed ? Vector( 150, 0, 0 ) : Vector( 0, 150, 0 );

src/game/client/tf/c_tf_player.cpp

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11876,22 +11876,31 @@ void C_TFPlayer::UpdateGlowEffect( void )
1187611876

1187711877
BaseClass::UpdateGlowEffect();
1187811878

11879+
if ( ( GetGlowSources() & CLIENTSIDE_GLOW_HEALER ) || ( GetGlowSources() & CLIENTSIDE_GLOW_SAVEME ) )
11880+
{
11881+
SetGlowRenderFlags( true, true );
11882+
}
11883+
else
11884+
{
11885+
SetGlowRenderFlags( true, false );
11886+
}
11887+
1187911888
// create a new effect if we have a coach
1188011889
if ( m_hCoach && m_hCoach->IsLocalPlayer() && m_hCoach->m_bIsCoaching )
1188111890
{
11882-
float r, g, b;
11883-
GetGlowEffectColor( &r, &g, &b );
11891+
float r, g, b, a = 1.0f;
11892+
GetGlowEffectColor( &r, &g, &b, &a );
1188411893

11885-
m_pStudentGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
11894+
m_pStudentGlowEffect = new CGlowObject( this, Vector( r, g, b ), a, true, true );
1188611895
}
1188711896

1188811897
// create a power up effect if needed
1188911898
if ( ShouldShowPowerupGlowEffect() )
1189011899
{
11891-
float r, g, b;
11892-
GetPowerupGlowEffectColor( &r, &g, &b );
11900+
float r, g, b, a = 1.0f;
11901+
GetPowerupGlowEffectColor( &r, &g, &b, &a );
1189311902

11894-
m_pPowerupGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
11903+
m_pPowerupGlowEffect = new CGlowObject( this, Vector( r, g, b ), a, true, true );
1189511904
}
1189611905
}
1189711906

@@ -11920,26 +11929,30 @@ void C_TFPlayer::UpdateGlowColor( void )
1192011929
CGlowObject* pGlowObject = GetGlowObject();
1192111930
if ( pGlowObject )
1192211931
{
11923-
float r, g, b;
11924-
GetGlowEffectColor( &r, &g, &b );
11932+
float r, g, b, a = 1.0f;
11933+
GetGlowEffectColor( &r, &g, &b, &a );
1192511934

1192611935
pGlowObject->SetColor( Vector( r, g, b ) );
11936+
pGlowObject->SetAlpha( a );
1192711937
}
1192811938

1192911939
if ( m_pPowerupGlowEffect )
1193011940
{
11931-
float r, g, b;
11932-
GetPowerupGlowEffectColor( &r, &g, &b );
11941+
float r, g, b, a = 1.0f;
11942+
GetPowerupGlowEffectColor( &r, &g, &b, &a );
1193311943

1193411944
m_pPowerupGlowEffect->SetColor( Vector( r, g, b ) );
11945+
m_pPowerupGlowEffect->SetAlpha( a );
1193511946
}
1193611947
}
1193711948

1193811949
//-----------------------------------------------------------------------------
1193911950
// Purpose:
1194011951
//-----------------------------------------------------------------------------
11941-
void C_TFPlayer::GetGlowEffectColor( float *r, float *g, float *b )
11952+
void C_TFPlayer::GetGlowEffectColor( float *r, float *g, float *b, float *a )
1194211953
{
11954+
*a = 1.0f;
11955+
1194311956
#ifdef TF_CREEP_MODE
1194411957
if ( TFGameRules() && TFGameRules()->IsCreepWaveMode() )
1194511958
{
@@ -12070,7 +12083,7 @@ bool C_TFPlayer::ShouldShowPowerupGlowEffect()
1207012083
//-----------------------------------------------------------------------------
1207112084
// Purpose:
1207212085
//-----------------------------------------------------------------------------
12073-
void C_TFPlayer::GetPowerupGlowEffectColor( float *r, float *g, float *b )
12086+
void C_TFPlayer::GetPowerupGlowEffectColor( float *r, float *g, float *b, float *a )
1207412087
{
1207512088
C_TFPlayer *pLocalPlayer = GetLocalTFPlayer();
1207612089
// no need to add extra logics here. we already know that other players are glowing from SUPERNOVA
@@ -12079,10 +12092,11 @@ void C_TFPlayer::GetPowerupGlowEffectColor( float *r, float *g, float *b )
1207912092
*r = 255;
1208012093
*g = 255;
1208112094
*b = 0;
12095+
*a = 1.0f;
1208212096
}
1208312097
else
1208412098
{
12085-
GetGlowEffectColor( r, g, b );
12099+
GetGlowEffectColor( r, g, b, a );
1208612100
}
1208712101
}
1208812102

src/game/client/tf/c_tf_player.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class C_TFPlayer : public C_BasePlayer, public IHasAttributes, public IInventory
339339
void SetTauntCameraTargets( float back, float up );
340340

341341
// TF-specific color values for GlowEffect
342-
virtual void GetGlowEffectColor( float *r, float *g, float *b );
342+
virtual void GetGlowEffectColor( float *r, float *g, float *b, float *a );
343343
void UpdateGlowColor( void );
344344

345345
virtual const Vector& GetRenderOrigin( void );
@@ -545,7 +545,7 @@ class C_TFPlayer : public C_BasePlayer, public IHasAttributes, public IInventory
545545
bool ComputeCompetitiveVisibility(void);
546546

547547
bool ShouldShowPowerupGlowEffect();
548-
void GetPowerupGlowEffectColor( float *r, float *g, float *b );
548+
void GetPowerupGlowEffectColor( float *r, float *g, float *b, float *a );
549549

550550
void HandleTaunting( void );
551551
void TauntCamInterpolation( void );

src/game/client/tf/player_vs_environment/c_tf_tank_boss.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ C_TFTankBoss::C_TFTankBoss()
1717
{
1818
}
1919

20-
void C_TFTankBoss::GetGlowEffectColor( float *r, float *g, float *b )
20+
void C_TFTankBoss::GetGlowEffectColor( float *r, float *g, float *b, float *a )
2121
{
2222
TeamplayRoundBasedRules()->GetTeamGlowColor( GetTeamNumber(), *r, *g, *b );
23+
*a = 1.0f;
2324
}
2425

src/game/client/tf/player_vs_environment/c_tf_tank_boss.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class C_TFTankBoss : public C_TFBaseBoss
1313

1414
C_TFTankBoss();
1515

16-
virtual void GetGlowEffectColor( float *r, float *g, float *b );
16+
virtual void GetGlowEffectColor( float *r, float *g, float *b, float *a );
1717

1818
// ITFMvMBossProgressUser
1919
virtual const char* GetBossProgressImageName() const OVERRIDE { return "tank"; }

src/game/shared/tf/tf_dropped_weapon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ void CTFDroppedWeapon::UpdateGlowEffect( void )
453453
if ( m_bShouldGlowForLocalPlayer )
454454
{
455455
Vector color = Vector( 0.745f, 0.773f, 0.157f );
456-
m_pGlowEffect = new CGlowObject( this, color, 1.0, true );
456+
m_pGlowEffect = new CGlowObject( this, color, 1.0, true, true );
457457
}
458458
}
459459

0 commit comments

Comments
 (0)