Skip to content

Commit

Permalink
update player glow colour and glow status when they change team
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamTadeusz committed Nov 6, 2024
1 parent d207cc6 commit 87d473c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 1 addition & 3 deletions mp/src/game/client/c_basecombatcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,10 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
if ( m_bGlowEnabled || m_bClientSideGlowEnabled )
{
float r, g, b;
GetGlowEffectColor( &r, &g, &b );
#ifdef NEO
NEORules()->GetTeamGlowColor(GetTeamNumber(), r, g, b);
SetGlowEffectColor(r, g, b);
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true, true );
#else
GetGlowEffectColor( &r, &g, &b );
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
#endif
}
Expand Down
13 changes: 13 additions & 0 deletions mp/src/game/client/clientmode_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ extern ConVar replay_rendersetting_renderglow;
#include "c_neo_player.h"
#include <GameUI/IGameUI.h>
#include "ui/neo_loading.h"
#include "neo_gamerules.h"
#endif

#ifdef GLOWS_ENABLE
Expand Down Expand Up @@ -1126,6 +1127,18 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
else if ( Q_strcmp( "player_team", eventname ) == 0 )
{
C_BasePlayer *pPlayer = USERID2PLAYER( event->GetInt("userid") );
#ifdef NEO
#ifdef GLOWS_ENABLE
if (pPlayer && glow_outline_effect_enable.GetBool())
{ // NEO JANK (Adam) bots join their final team before they are created client side, so pPlayer here will be null for them, and setting clientsideglow on them in c_neo_player::Spawn() results in an incorrect glow colour. This works for players though
float r, g, b;
NEORules()->GetTeamGlowColor(event->GetInt("team"), r, g, b);
pPlayer->SetGlowEffectColor(r, g, b);
pPlayer->SetClientSideGlowEnabled(true);
}
#endif // GLOWS_ENABLE
#endif // NEO

if ( !hudChat )
return;

Expand Down
8 changes: 8 additions & 0 deletions mp/src/game/client/glow_outline_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
#include "materialsystem/itexture.h"
#include "view_shared.h"
#include "viewpostprocess.h"
#ifdef GLOWS_ENABLE
#ifdef NEO
#include "neo_gamerules.h"
#endif // NEO
#endif // GLOWS_ENABLE

#define FULL_FRAME_TEXTURE "_rt_FullFrameFB"

Expand All @@ -24,6 +29,9 @@ static void glowOutlineEffectToggleCallBack(IConVar* var, const char* pOldValue,
{
if (auto player = UTIL_PlayerByIndex(i))
{
float r, g, b;
NEORules()->GetTeamGlowColor(player->GetTeamNumber(), r, g, b);
player->SetGlowEffectColor(r, g, b);
player->SetClientSideGlowEnabled(!flOldValue);
}
}
Expand Down

0 comments on commit 87d473c

Please sign in to comment.