Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ endif()
add_compile_definitions(
SDK2013CE
NEO
GLOWS_ENABLE
_DLL_EXT=${CMAKE_SHARED_LIBRARY_SUFFIX}
_EXTERNAL_DLL_EXT=${CMAKE_SHARED_LIBRARY_SUFFIX}
_GLIBCXX_USE_CXX11_ABI=0
Expand Down
35 changes: 30 additions & 5 deletions mp/src/game/client/c_basecombatcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
#include "cbase.h"
#include "c_basecombatcharacter.h"

#ifdef GLOWS_ENABLE
#ifdef NEO
#include "neo_gamerules.h"
#endif // NEO
#endif // GLOWS_ENABLE
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

Expand All @@ -35,6 +40,9 @@ C_BaseCombatCharacter::C_BaseCombatCharacter()
m_bGlowEnabled = false;
m_bOldGlowEnabled = false;
m_bClientSideGlowEnabled = false;
m_flGlowR = 0.76f;
m_flGlowG = 0.76f;
m_flGlowB = 0.76f;
#endif // GLOWS_ENABLE
}

Expand Down Expand Up @@ -109,9 +117,19 @@ void C_BaseCombatCharacter::DoMuzzleFlash()
//-----------------------------------------------------------------------------
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b )
{
*r = 0.76f;
*g = 0.76f;
*b = 0.76f;
*r = m_flGlowR;
*g = m_flGlowG;
*b = m_flGlowB;
}

//-----------------------------------------------------------------------------
// Purpose: Change the colour of the glow outline of a combat character
//-----------------------------------------------------------------------------
void C_BaseCombatCharacter::SetGlowEffectColor(float r, float g, float b)
{
m_flGlowR.Set(r);
m_flGlowG.Set(g);
m_flGlowB.Set(b);
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -145,8 +163,12 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
if ( m_bGlowEnabled || m_bClientSideGlowEnabled )
{
float r, g, b;
#ifdef NEO
NEORules()->GetTeamGlowColor(GetTeamNumber(), r, g, b);
SetGlowEffectColor(r, g, b);
#else
GetGlowEffectColor( &r, &g, &b );

#endif
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
}
}
Expand Down Expand Up @@ -177,7 +199,10 @@ BEGIN_RECV_TABLE(C_BaseCombatCharacter, DT_BaseCombatCharacter)
RecvPropEHandle( RECVINFO( m_hActiveWeapon ) ),
RecvPropArray3( RECVINFO_ARRAY(m_hMyWeapons), RecvPropEHandle( RECVINFO( m_hMyWeapons[0] ) ) ),
#ifdef GLOWS_ENABLE
RecvPropBool( RECVINFO( m_bGlowEnabled ) ),
RecvPropBool( RECVINFO( m_bGlowEnabled ) ), // NEOTODO (Adam) Should the declaration of this variable in c_basecombatcharacter.h be a CNetworkVar?
RecvPropFloat( RECVINFO( m_flGlowR ) ),
RecvPropFloat( RECVINFO( m_flGlowG ) ),
RecvPropFloat( RECVINFO( m_flGlowB ) ),
#endif // GLOWS_ENABLE

#ifdef INVASION_CLIENT_DLL
Expand Down
4 changes: 4 additions & 0 deletions mp/src/game/client/c_basecombatcharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class C_BaseCombatCharacter : public C_BaseFlex
#ifdef GLOWS_ENABLE
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
virtual void GetGlowEffectColor( float *r, float *g, float *b );
void SetGlowEffectColor(float r, float g, float b);
// void EnableGlowEffect( float r, float g, float b );

void SetClientSideGlowEnabled( bool bEnabled ){ m_bClientSideGlowEnabled = bEnabled; UpdateGlowEffect(); }
Expand Down Expand Up @@ -128,6 +129,9 @@ class C_BaseCombatCharacter : public C_BaseFlex
bool m_bClientSideGlowEnabled; // client-side only value used for spectator
bool m_bGlowEnabled; // networked value
bool m_bOldGlowEnabled;
CNetworkVar(float, m_flGlowR);
CNetworkVar(float, m_flGlowG);
CNetworkVar(float, m_flGlowB);
CGlowObject *m_pGlowEffect;
#endif // GLOWS_ENABLE

Expand Down
12 changes: 12 additions & 0 deletions mp/src/game/client/c_team_train_watcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
#include "teamplayroundbased_gamerules.h"
#endif

#ifdef NEO
#include "neo_gamerules.h"
#else
#ifdef GLOW_ENABLED
#include "teamplayroundbased_gamerules.h" // if GLOW_ENABLED this needs to be included regardless of TF_CLIENT_DLL
#endif
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

Expand Down Expand Up @@ -86,7 +94,11 @@ void C_TeamTrainWatcher::UpdateGlowEffect( void )
if ( m_hGlowEnt )
{
float r, g, b;
#ifdef NEO
NEORules()->GetTeamGlowColor(GetTeamNumber(), r, g, b);
#else
TeamplayRoundBasedRules()->GetTeamGlowColor( GetTeamNumber(), r, g, b );
#endif
m_pGlowEffect = new CGlowObject( m_hGlowEnt, Vector( r, g, b ), 1.0, true );
}
}
Expand Down
37 changes: 37 additions & 0 deletions mp/src/game/client/clientmode_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@ extern ConVar replay_rendersetting_renderglow;
#include "c_neo_player.h"
#endif

#ifdef GLOWS_ENABLE
#include "clienteffectprecachesystem.h"
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

#ifdef GLOWS_ENABLE
CLIENTEFFECT_REGISTER_BEGIN(PrecachePostProcessingEffectsGlow)
CLIENTEFFECT_MATERIAL("dev/glow_color")
CLIENTEFFECT_MATERIAL("dev/halo_add_to_screen")
CLIENTEFFECT_REGISTER_END_CONDITIONAL(engine->GetDXSupportLevel() >= 90)
#endif
#define ACHIEVEMENT_ANNOUNCEMENT_MIN_TIME 10

class CHudWeaponSelection;
Expand Down Expand Up @@ -769,6 +779,30 @@ int ClientModeShared::HandleSpectatorKeyInput( int down, ButtonCode_t keynum, co
#endif
return 0;
}
#ifdef GLOWS_ENABLE
else if (down && pszCurrentBinding && Q_strcmp(pszCurrentBinding, "+attack2") == 0)
{
ConVar* glow_outline_effect_enable = cvar->FindVar("glow_outline_effect_enable");
if (!glow_outline_effect_enable)
return 0;

if (glow_outline_effect_enable->GetBool())
engine->ExecuteClientCmd("glow_outline_effect_enable 0");
else
engine->ExecuteClientCmd("glow_outline_effect_enable 1");

for (int i = 0; i < MAX_PLAYERS; i++)
{
auto player = UTIL_PlayerByIndex(i);
if (player)
{
auto enable = glow_outline_effect_enable->GetBool();
player->SetClientSideGlowEnabled(enable);
}
}
return 0;
}
#endif // GLOWS_ENABLE

return 1;
}
Expand Down Expand Up @@ -805,6 +839,9 @@ int ClientModeShared::HudElementKeyInput( int down, ButtonCode_t keynum, const c
//-----------------------------------------------------------------------------
bool ClientModeShared::DoPostScreenSpaceEffects( const CViewSetup *pSetup )
{
#ifdef GLOWS_ENABLE
g_GlowObjectManager.RenderGlowEffects(pSetup, 0);
#endif
#if defined( REPLAY_ENABLED )
if ( engine->IsPlayingDemo() )
{
Expand Down
25 changes: 25 additions & 0 deletions mp/src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ C_NEO_Player::C_NEO_Player()
C_NEO_Player::~C_NEO_Player()
{
m_pPlayerAnimState->Release();
#ifdef GLOWS_ENABLE
DestroyGlowEffect();
#endif // GLOWS_ENABLE
}

void C_NEO_Player::CheckThermOpticButtons()
Expand Down Expand Up @@ -1127,6 +1130,28 @@ void C_NEO_Player::TeamChange(int iNewTeam)
if (IsLocalPlayer())
{
engine->ClientCmd(classmenu.GetName());
if (iNewTeam == TEAM_SPECTATOR)
{
for (int i = 0; i < MAX_PLAYERS; i++)
{
auto player = UTIL_PlayerByIndex(i);
if (player)
{
player->SetClientSideGlowEnabled(true);
}
}
}
else
{
for (int i = 0; i < MAX_PLAYERS; i++)
{
auto player = UTIL_PlayerByIndex(i);
if (player)
{
player->SetClientSideGlowEnabled(false);
}
}
}
}
BaseClass::TeamChange(iNewTeam);
}
Expand Down
24 changes: 16 additions & 8 deletions mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ void CNEOHud_FriendlyMarker::DrawPlayer(Color teamColor, C_NEO_Player *player, c
static const float heightOffset = 48.0f;
auto pos = player->EyePosition();

bool drawOutline = false;
ConVar* glow_outline_effect_enable = cvar->FindVar("glow_outline_effect_enable");
if (glow_outline_effect_enable)
drawOutline = glow_outline_effect_enable->GetBool();

if (GetVectorInScreenSpace(pos, x, y))
{
auto playerName = player->GetNeoPlayerName();
Expand Down Expand Up @@ -175,14 +180,17 @@ void CNEOHud_FriendlyMarker::DrawPlayer(Color teamColor, C_NEO_Player *player, c
DisplayText(textASCII);
}

surface()->DrawSetTexture(m_hTex);
surface()->DrawSetColor(teamColor);
surface()->DrawTexturedRect(
x - m_iMarkerWidth,
y - m_iMarkerHeight,
x + m_iMarkerWidth,
y + m_iMarkerHeight
);
if (!drawOutline)
{
surface()->DrawSetTexture(m_hTex);
surface()->DrawSetColor(teamColor);
surface()->DrawTexturedRect(
x - m_iMarkerWidth,
y - m_iMarkerHeight,
x + m_iMarkerWidth,
y + m_iMarkerHeight
);
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions mp/src/game/server/basecombatcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ END_SEND_TABLE();
IMPLEMENT_SERVERCLASS_ST(CBaseCombatCharacter, DT_BaseCombatCharacter)
#ifdef GLOWS_ENABLE
SendPropBool( SENDINFO( m_bGlowEnabled ) ),
SendPropFloat( SENDINFO( m_flGlowR ) ),
SendPropFloat( SENDINFO( m_flGlowG ) ),
SendPropFloat( SENDINFO( m_flGlowB ) ),
#endif // GLOWS_ENABLE
// Data that only gets sent to the local player.
SendPropDataTable( "bcc_localdata", 0, &REFERENCE_SEND_TABLE(DT_BCCLocalPlayerExclusive), SendProxy_SendBaseCombatCharacterLocalDataTable ),
Expand Down
3 changes: 3 additions & 0 deletions mp/src/game/server/basecombatcharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ class CBaseCombatCharacter : public CBaseFlex
#ifdef GLOWS_ENABLE
protected:
CNetworkVar( bool, m_bGlowEnabled );
CNetworkVar( float, m_flGlowR );
CNetworkVar( float, m_flGlowG );
CNetworkVar( float, m_flGlowB );
#endif // GLOWS_ENABLE

private:
Expand Down
32 changes: 30 additions & 2 deletions mp/src/game/shared/neo/neo_gamerules.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#include "utlhashtable.h"
#endif

#ifdef GLOWS_ENABLE
#include "neo_player_shared.h"
#endif

enum
{
TEAM_JINRAI = LAST_SHARED_TEAM + 1,
Expand Down Expand Up @@ -250,8 +254,32 @@ class CNEORules : public CHL2MPRules, public CGameEventListener
return GetOpposingTeam(player->GetTeamNumber());
}

int roundNumber() const { return m_iRoundNumber; }
bool roundAlternate() const { return static_cast<bool>(m_iRoundNumber % 2 == 0); }
int roundNumber() const { return m_iRoundNumber; }
bool roundAlternate() const { return static_cast<bool>(m_iRoundNumber % 2 == 0); }

#ifdef GLOWS_ENABLE
void GetTeamGlowColor(int teamNumber, float &r, float &g, float &b)
{
if (teamNumber == TEAM_JINRAI)
{
r = static_cast<float>(COLOR_JINRAI.r()/255.f);
g = static_cast<float>(COLOR_JINRAI.g()/255.f);
b = static_cast<float>(COLOR_JINRAI.b()/255.f);
}
else if (teamNumber == TEAM_NSF)
{
r = static_cast<float>(COLOR_NSF.r()/255.f);
g = static_cast<float>(COLOR_NSF.g()/255.f);
b = static_cast<float>(COLOR_NSF.b()/255.f);
}
else
{
r = 0.76f;
g = 0.76f;
b = 0.76f;
}
}
#endif

public:
#ifdef GAME_DLL
Expand Down