diff --git a/mp/game/neo/materials/dev/glow_blue.vtf b/mp/game/neo/materials/dev/glow_blue.vtf new file mode 100644 index 000000000..2d5a7199e Binary files /dev/null and b/mp/game/neo/materials/dev/glow_blue.vtf differ diff --git a/mp/game/neo/materials/dev/glow_blur_x.vmt b/mp/game/neo/materials/dev/glow_blur_x.vmt new file mode 100644 index 000000000..78e94aae5 --- /dev/null +++ b/mp/game/neo/materials/dev/glow_blur_x.vmt @@ -0,0 +1,8 @@ +"BlurFilterX" +{ + "$KERNEL" "1" + "$bloomamount" "1" + "$basetexture" "_rt_SmallFB0" + "$ignorez" 1 + "%noToolTexture" 1 +} diff --git a/mp/game/neo/materials/dev/glow_blur_y.vmt b/mp/game/neo/materials/dev/glow_blur_y.vmt new file mode 100644 index 000000000..87152f00e --- /dev/null +++ b/mp/game/neo/materials/dev/glow_blur_y.vmt @@ -0,0 +1,7 @@ +"BlurFilterY" +{ + "$KERNEL" "1" + "$basetexture" "_rt_SmallFB1" + "$ignorez" 1 + "%noToolTexture" 1 +} diff --git a/mp/game/neo/materials/dev/glow_color.vmt b/mp/game/neo/materials/dev/glow_color.vmt new file mode 100644 index 000000000..e8785b9e5 --- /dev/null +++ b/mp/game/neo/materials/dev/glow_color.vmt @@ -0,0 +1,7 @@ +UnlitGeneric +{ + "$basetexture" "white" + "$ignorez" "1" + "$model" "1" + "$linearwrite" "1" +} diff --git a/mp/game/neo/materials/dev/glow_red.vtf b/mp/game/neo/materials/dev/glow_red.vtf new file mode 100644 index 000000000..a664dc0fa Binary files /dev/null and b/mp/game/neo/materials/dev/glow_red.vtf differ diff --git a/mp/game/neo/materials/dev/glow_white.vtf b/mp/game/neo/materials/dev/glow_white.vtf new file mode 100644 index 000000000..94ac142fa Binary files /dev/null and b/mp/game/neo/materials/dev/glow_white.vtf differ diff --git a/mp/game/neo/materials/dev/halo_add_to_screen.vmt b/mp/game/neo/materials/dev/halo_add_to_screen.vmt new file mode 100644 index 000000000..4e7b97fc5 --- /dev/null +++ b/mp/game/neo/materials/dev/halo_add_to_screen.vmt @@ -0,0 +1,14 @@ +"screenspace_general" +{ + "$PIXSHADER" "haloaddoutline_ps20" + + "$ALPHA_BLEND_COLOR_OVERLAY" 1 + "$basetexture" "_rt_fullframefb" + "$ignorez" 1 + "$linearread_basetexture" 1 + "$linearwrite" 1 + + "$texture1" "dev/glow_red" + "$texture2" "dev/glow_white" + "$texture3" "dev/glow_blue" +} diff --git a/mp/src/CMakeLists.txt b/mp/src/CMakeLists.txt index bd8a9bc82..48dc3db57 100644 --- a/mp/src/CMakeLists.txt +++ b/mp/src/CMakeLists.txt @@ -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 diff --git a/mp/src/game/client/c_basecombatcharacter.cpp b/mp/src/game/client/c_basecombatcharacter.cpp index 846901a5d..14024270c 100644 --- a/mp/src/game/client/c_basecombatcharacter.cpp +++ b/mp/src/game/client/c_basecombatcharacter.cpp @@ -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" @@ -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 } @@ -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); } //----------------------------------------------------------------------------- @@ -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 ); } } @@ -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 diff --git a/mp/src/game/client/c_basecombatcharacter.h b/mp/src/game/client/c_basecombatcharacter.h index 0a135b05a..a0a7839b4 100644 --- a/mp/src/game/client/c_basecombatcharacter.h +++ b/mp/src/game/client/c_basecombatcharacter.h @@ -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(); } @@ -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 diff --git a/mp/src/game/client/c_team_train_watcher.cpp b/mp/src/game/client/c_team_train_watcher.cpp index e58aafb12..ac7e5bbb5 100644 --- a/mp/src/game/client/c_team_train_watcher.cpp +++ b/mp/src/game/client/c_team_train_watcher.cpp @@ -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" @@ -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 ); } } diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index dea26b9c7..a9f661aa6 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -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; @@ -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; } @@ -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() ) { diff --git a/mp/src/game/client/neo/c_neo_player.cpp b/mp/src/game/client/neo/c_neo_player.cpp index 070465b8b..b0a3edda3 100644 --- a/mp/src/game/client/neo/c_neo_player.cpp +++ b/mp/src/game/client/neo/c_neo_player.cpp @@ -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() @@ -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); } diff --git a/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp b/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp index f07bf2870..e993af635 100644 --- a/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp +++ b/mp/src/game/client/neo/ui/neo_hud_friendly_marker.cpp @@ -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(); @@ -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 + ); + } } } diff --git a/mp/src/game/server/basecombatcharacter.cpp b/mp/src/game/server/basecombatcharacter.cpp index b6b6c07fe..6a67753c4 100644 --- a/mp/src/game/server/basecombatcharacter.cpp +++ b/mp/src/game/server/basecombatcharacter.cpp @@ -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 ), diff --git a/mp/src/game/server/basecombatcharacter.h b/mp/src/game/server/basecombatcharacter.h index 090dba1e7..ae702e751 100644 --- a/mp/src/game/server/basecombatcharacter.h +++ b/mp/src/game/server/basecombatcharacter.h @@ -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: diff --git a/mp/src/game/shared/neo/neo_gamerules.h b/mp/src/game/shared/neo/neo_gamerules.h index 6fb4e3048..ce92ee37d 100644 --- a/mp/src/game/shared/neo/neo_gamerules.h +++ b/mp/src/game/shared/neo/neo_gamerules.h @@ -17,6 +17,10 @@ #include "utlhashtable.h" #endif +#ifdef GLOWS_ENABLE +#include "neo_player_shared.h" +#endif + enum { TEAM_JINRAI = LAST_SHARED_TEAM + 1, @@ -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(m_iRoundNumber % 2 == 0); } + int roundNumber() const { return m_iRoundNumber; } + bool roundAlternate() const { return static_cast(m_iRoundNumber % 2 == 0); } + +#ifdef GLOWS_ENABLE + void GetTeamGlowColor(int teamNumber, float &r, float &g, float &b) + { + if (teamNumber == TEAM_JINRAI) + { + r = static_cast(COLOR_JINRAI.r()/255.f); + g = static_cast(COLOR_JINRAI.g()/255.f); + b = static_cast(COLOR_JINRAI.b()/255.f); + } + else if (teamNumber == TEAM_NSF) + { + r = static_cast(COLOR_NSF.r()/255.f); + g = static_cast(COLOR_NSF.g()/255.f); + b = static_cast(COLOR_NSF.b()/255.f); + } + else + { + r = 0.76f; + g = 0.76f; + b = 0.76f; + } + } +#endif public: #ifdef GAME_DLL