From 52293321a8c8f8db765ee8e54ef9cd0a4b39f9a1 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Tue, 15 Oct 2024 11:31:02 +0100 Subject: [PATCH 1/7] check if a spectator, disable when changing teams --- mp/src/game/client/c_basecombatcharacter.cpp | 2 +- mp/src/game/client/clientmode_shared.cpp | 22 ++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/mp/src/game/client/c_basecombatcharacter.cpp b/mp/src/game/client/c_basecombatcharacter.cpp index 14024270c0..d451479008 100644 --- a/mp/src/game/client/c_basecombatcharacter.cpp +++ b/mp/src/game/client/c_basecombatcharacter.cpp @@ -169,7 +169,7 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void ) #else GetGlowEffectColor( &r, &g, &b ); #endif - m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true ); + m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true, true ); } } diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index f24ba09f68..8161ccc1a9 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -814,6 +814,11 @@ int ClientModeShared::HandleSpectatorKeyInput( int down, ButtonCode_t keynum, co #ifdef GLOWS_ENABLE else if (down && pszCurrentBinding && Q_strcmp(pszCurrentBinding, "+attack2") == 0) { + if (GetLocalPlayerTeam() != TEAM_SPECTATOR) + { // Can't use xray when dead spectating friends + return 0; + } + ConVar* glow_outline_effect_enable = cvar->FindVar("glow_outline_effect_enable"); if (!glow_outline_effect_enable) return 0; @@ -823,13 +828,12 @@ int ClientModeShared::HandleSpectatorKeyInput( int down, ButtonCode_t keynum, co else engine->ExecuteClientCmd("glow_outline_effect_enable 1"); + bool enabled = glow_outline_effect_enable->GetBool(); for (int i = 0; i < MAX_PLAYERS; i++) { - auto player = UTIL_PlayerByIndex(i); - if (player) + if (auto player = dynamic_cast(ClientEntityList().GetBaseEntity(i))) { - auto enable = glow_outline_effect_enable->GetBool(); - player->SetClientSideGlowEnabled(enable); + player->SetClientSideGlowEnabled(enabled); } } return 0; @@ -1203,6 +1207,16 @@ void ClientModeShared::FireGameEvent( IGameEvent *event ) { // that's me pPlayer->TeamChange( team ); +#ifdef NEO + // Switch off Xray when switching teams + for (int i = 0; i < MAX_PLAYERS; i++) + { + if (auto player = dynamic_cast(ClientEntityList().GetBaseEntity(i))) + { + player->SetClientSideGlowEnabled(false); + } + } +#endif } } #ifdef NEO From d871a93faa73afd91042a20c42033b990b6ef377 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Tue, 15 Oct 2024 17:21:22 +0100 Subject: [PATCH 2/7] all models glow, albeit very dimly --- mp/src/game/client/glow_outline_effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mp/src/game/client/glow_outline_effect.cpp b/mp/src/game/client/glow_outline_effect.cpp index c8f35b9090..cc70065e8a 100644 --- a/mp/src/game/client/glow_outline_effect.cpp +++ b/mp/src/game/client/glow_outline_effect.cpp @@ -102,7 +102,7 @@ void CGlowObjectManager::RenderGlowModels( const CViewSetup *pSetup, int nSplitS SetRenderTargetAndViewPort( pRtFullFrame, pSetup->width, pSetup->height ); pRenderContext->ClearColor3ub( 0, 0, 0 ); - pRenderContext->ClearBuffers( true, false, false ); + pRenderContext->ClearBuffers( true, true, false ); // Set override material for glow color IMaterial *pMatGlowColor = NULL; From 6f3a44cfa154df08f3ff4ec6a1b63a9d2cf815b7 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 16 Oct 2024 10:35:58 +0100 Subject: [PATCH 3/7] draw outlines around cloaked enemies, can't get guns to draw too still --- mp/src/game/client/glow_outline_effect.cpp | 18 +++++++++-- mp/src/game/client/neo/c_neo_player.cpp | 32 ++++++------------- .../weapons/weapon_neobasecombatweapon.cpp | 20 ++++++++++-- mp/src/public/model_types.h | 3 ++ 4 files changed, 46 insertions(+), 27 deletions(-) diff --git a/mp/src/game/client/glow_outline_effect.cpp b/mp/src/game/client/glow_outline_effect.cpp index cc70065e8a..52935ed186 100644 --- a/mp/src/game/client/glow_outline_effect.cpp +++ b/mp/src/game/client/glow_outline_effect.cpp @@ -102,13 +102,15 @@ void CGlowObjectManager::RenderGlowModels( const CViewSetup *pSetup, int nSplitS SetRenderTargetAndViewPort( pRtFullFrame, pSetup->width, pSetup->height ); pRenderContext->ClearColor3ub( 0, 0, 0 ); - pRenderContext->ClearBuffers( true, true, false ); + pRenderContext->ClearBuffers( true, false, false ); // Set override material for glow color IMaterial *pMatGlowColor = NULL; pMatGlowColor = materials->FindMaterial( "dev/glow_color", TEXTURE_GROUP_OTHER, true ); +#ifndef NEO g_pStudioRender->ForcedMaterialOverride( pMatGlowColor ); +#endif ShaderStencilState_t stencilState; stencilState.m_bEnable = false; @@ -129,12 +131,16 @@ void CGlowObjectManager::RenderGlowModels( const CViewSetup *pSetup, int nSplitS if ( m_GlowObjectDefinitions[i].IsUnused() || !m_GlowObjectDefinitions[i].ShouldDraw( nSplitScreenSlot ) ) continue; +#ifdef NEO + // DrawModel can call ForcedMaterialOverride also + g_pStudioRender->ForcedMaterialOverride(pMatGlowColor); +#endif render->SetBlend( m_GlowObjectDefinitions[i].m_flGlowAlpha ); Vector vGlowColor = m_GlowObjectDefinitions[i].m_vGlowColor * m_GlowObjectDefinitions[i].m_flGlowAlpha; render->SetColorModulation( &vGlowColor[0] ); // This only sets rgb, not alpha m_GlowObjectDefinitions[i].DrawModel(); - } + } if ( g_bDumpRenderTargets ) { @@ -314,14 +320,22 @@ void CGlowObjectManager::GlowObjectDefinition_t::DrawModel() { if ( m_hEntity.Get() ) { +#ifdef NEO + m_hEntity->DrawModel( STUDIO_RENDER | STUDIO_IGNORE_NEO_EFFECTS ); +#else m_hEntity->DrawModel( STUDIO_RENDER ); +#endif C_BaseEntity *pAttachment = m_hEntity->FirstMoveChild(); while ( pAttachment != NULL ) { if ( !g_GlowObjectManager.HasGlowEffect( pAttachment ) && pAttachment->ShouldDraw() ) { +#ifdef NEO + pAttachment->DrawModel( STUDIO_RENDER | STUDIO_IGNORE_NEO_EFFECTS ); +#else pAttachment->DrawModel( STUDIO_RENDER ); +#endif } pAttachment = pAttachment->NextMovePeer(); } diff --git a/mp/src/game/client/neo/c_neo_player.cpp b/mp/src/game/client/neo/c_neo_player.cpp index d959170c88..fe2b09aa6a 100644 --- a/mp/src/game/client/neo/c_neo_player.cpp +++ b/mp/src/game/client/neo/c_neo_player.cpp @@ -594,6 +594,12 @@ extern ConVar mat_neo_toc_test; int C_NEO_Player::DrawModel(int flags) { int ret = 0; + + if (flags & STUDIO_IGNORE_NEO_EFFECTS || !(flags & STUDIO_RENDER)) + { + return BaseClass::DrawModel(flags); + } + auto pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); if (!pLocalPlayer) { @@ -615,6 +621,7 @@ int C_NEO_Player::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("models/player/toc", TEXTURE_GROUP_CLIENT_EFFECTS); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); + modelrender->ForcedMaterialOverride(null); } auto vel = GetAbsVelocity().Length(); @@ -623,6 +630,7 @@ int C_NEO_Player::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/motion_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); + modelrender->ForcedMaterialOverride(null); } else if (inThermalVision && !IsCloaked()) @@ -630,9 +638,9 @@ int C_NEO_Player::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/thermal_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); + modelrender->ForcedMaterialOverride(null); } - modelrender->ForcedMaterialOverride(null); return ret; } @@ -1103,28 +1111,6 @@ 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/shared/neo/weapons/weapon_neobasecombatweapon.cpp b/mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp index 2fd77aee37..d59a3c8262 100644 --- a/mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp +++ b/mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp @@ -17,6 +17,7 @@ extern ConVar weaponstay; #include "prediction.h" #include "hud_crosshair.h" #include "ui/neo_hud_crosshair.h" +#include "model_types.h" #endif #include "basecombatweapon_shared.h" @@ -1057,6 +1058,11 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) if (GetOwner() == localPlayer && ShouldDrawLocalPlayerViewModel()) return 0; + if (flags & STUDIO_IGNORE_NEO_EFFECTS || !(flags & STUDIO_RENDER)) + { + return BaseClass::DrawModel(flags); + } + int ret = 0; auto pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); if (!pLocalPlayer) @@ -1085,6 +1091,7 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("models/player/toc", TEXTURE_GROUP_CLIENT_EFFECTS); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); + modelrender->ForcedMaterialOverride(null); } auto vel = pOwner->GetAbsVelocity().Length(); @@ -1093,6 +1100,7 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/motion_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); + modelrender->ForcedMaterialOverride(null); } else if (inThermalVision && !pOwner->IsCloaked()) @@ -1100,15 +1108,21 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/thermal_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); + modelrender->ForcedMaterialOverride(null); } - modelrender->ForcedMaterialOverride(null); return ret; } int CNEOBaseCombatWeapon::InternalDrawModel(int flags) { int ret = 0; + + if (flags & STUDIO_IGNORE_NEO_EFFECTS || !(flags & STUDIO_RENDER)) + { + return BaseClass::InternalDrawModel(flags); + } + auto pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); if (!pLocalPlayer) { @@ -1136,6 +1150,7 @@ int CNEOBaseCombatWeapon::InternalDrawModel(int flags) IMaterial* pass = materials->FindMaterial("models/player/toc", TEXTURE_GROUP_CLIENT_EFFECTS); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::InternalDrawModel(flags); + modelrender->ForcedMaterialOverride(null); } auto vel = pOwner->GetAbsVelocity().Length(); @@ -1144,6 +1159,7 @@ int CNEOBaseCombatWeapon::InternalDrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/motion_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::InternalDrawModel(flags); + modelrender->ForcedMaterialOverride(null); } else if (inThermalVision && !pOwner->IsCloaked()) @@ -1151,9 +1167,9 @@ int CNEOBaseCombatWeapon::InternalDrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/thermal_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::InternalDrawModel(flags); + modelrender->ForcedMaterialOverride(null); } - modelrender->ForcedMaterialOverride(null); return ret; } diff --git a/mp/src/public/model_types.h b/mp/src/public/model_types.h index 54f3891c86..341151543c 100644 --- a/mp/src/public/model_types.h +++ b/mp/src/public/model_types.h @@ -22,6 +22,9 @@ #define STUDIO_ITEM_BLINK 0x00000040 #define STUDIO_NOSHADOWS 0x00000080 #define STUDIO_WIREFRAME_VCOLLIDE 0x00000100 +#ifdef NEO +#define STUDIO_IGNORE_NEO_EFFECTS 0x00000200 +#endif // Not a studio flag, but used to flag when we want studio stats #define STUDIO_GENERATE_STATS 0x01000000 From 10168da41a1f6b6ed5ab11a27308b9d980182808 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 16 Oct 2024 10:44:37 +0100 Subject: [PATCH 4/7] util_playerbyindex was fine --- mp/src/game/client/clientmode_shared.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index 8161ccc1a9..2c994c2f4d 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -831,7 +831,7 @@ int ClientModeShared::HandleSpectatorKeyInput( int down, ButtonCode_t keynum, co bool enabled = glow_outline_effect_enable->GetBool(); for (int i = 0; i < MAX_PLAYERS; i++) { - if (auto player = dynamic_cast(ClientEntityList().GetBaseEntity(i))) + if (auto player = UTIL_PlayerByIndex(i)) { player->SetClientSideGlowEnabled(enabled); } @@ -1211,7 +1211,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event ) // Switch off Xray when switching teams for (int i = 0; i < MAX_PLAYERS; i++) { - if (auto player = dynamic_cast(ClientEntityList().GetBaseEntity(i))) + if (auto player = UTIL_PlayerByIndex(i)) { player->SetClientSideGlowEnabled(false); } From c0cd383558efd822f33c2d78c5fca90636b3774c Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 17 Oct 2024 10:19:41 +0100 Subject: [PATCH 5/7] glows for everyone, also disable glows on first alive tick --- mp/src/game/client/c_basecombatcharacter.cpp | 3 +- mp/src/game/client/clientmode_shared.cpp | 9 ++--- mp/src/game/client/neo/c_neo_player.cpp | 34 +++++++++++++++---- mp/src/game/client/neo/c_neo_player.h | 1 + mp/src/game/server/neo/neo_player.cpp | 3 ++ .../weapons/weapon_neobasecombatweapon.cpp | 17 +++++----- 6 files changed, 44 insertions(+), 23 deletions(-) diff --git a/mp/src/game/client/c_basecombatcharacter.cpp b/mp/src/game/client/c_basecombatcharacter.cpp index d451479008..4e6c061341 100644 --- a/mp/src/game/client/c_basecombatcharacter.cpp +++ b/mp/src/game/client/c_basecombatcharacter.cpp @@ -166,10 +166,11 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void ) #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 - m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true, true ); } } diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index 2c994c2f4d..be6be5d7ee 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -814,11 +814,6 @@ int ClientModeShared::HandleSpectatorKeyInput( int down, ButtonCode_t keynum, co #ifdef GLOWS_ENABLE else if (down && pszCurrentBinding && Q_strcmp(pszCurrentBinding, "+attack2") == 0) { - if (GetLocalPlayerTeam() != TEAM_SPECTATOR) - { // Can't use xray when dead spectating friends - return 0; - } - ConVar* glow_outline_effect_enable = cvar->FindVar("glow_outline_effect_enable"); if (!glow_outline_effect_enable) return 0; @@ -829,7 +824,7 @@ int ClientModeShared::HandleSpectatorKeyInput( int down, ButtonCode_t keynum, co engine->ExecuteClientCmd("glow_outline_effect_enable 1"); bool enabled = glow_outline_effect_enable->GetBool(); - for (int i = 0; i < MAX_PLAYERS; i++) + for (int i = 1; i <= MAX_PLAYERS; i++) { if (auto player = UTIL_PlayerByIndex(i)) { @@ -1209,7 +1204,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event ) pPlayer->TeamChange( team ); #ifdef NEO // Switch off Xray when switching teams - for (int i = 0; i < MAX_PLAYERS; i++) + for (int i = 1; i <= MAX_PLAYERS; i++) { if (auto player = UTIL_PlayerByIndex(i)) { diff --git a/mp/src/game/client/neo/c_neo_player.cpp b/mp/src/game/client/neo/c_neo_player.cpp index fe2b09aa6a..6b0080be59 100644 --- a/mp/src/game/client/neo/c_neo_player.cpp +++ b/mp/src/game/client/neo/c_neo_player.cpp @@ -438,6 +438,7 @@ C_NEO_Player::C_NEO_Player() m_flLastAirborneJumpOkTime = 0; m_flLastSuperJumpTime = 0; + m_bFirstAliveTick = true; m_bFirstDeathTick = true; m_bPreviouslyReloading = false; m_bLastTickInThermOpticCamo = false; @@ -593,8 +594,6 @@ int C_NEO_Player::GetAttackerHits(const int attackerIdx) const extern ConVar mat_neo_toc_test; int C_NEO_Player::DrawModel(int flags) { - int ret = 0; - if (flags & STUDIO_IGNORE_NEO_EFFECTS || !(flags & STUDIO_RENDER)) { return BaseClass::DrawModel(flags); @@ -610,6 +609,7 @@ int C_NEO_Player::DrawModel(int flags) bool inMotionVision = pLocalPlayer->IsInVision() && pLocalPlayer->GetClass() == NEO_CLASS_ASSAULT; bool inThermalVision = pLocalPlayer->IsInVision() && pLocalPlayer->GetClass() == NEO_CLASS_SUPPORT; + int ret = 0; if (!IsCloaked() || inThermalVision) { ret |= BaseClass::DrawModel(flags); @@ -621,7 +621,7 @@ int C_NEO_Player::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("models/player/toc", TEXTURE_GROUP_CLIENT_EFFECTS); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } auto vel = GetAbsVelocity().Length(); @@ -630,7 +630,7 @@ int C_NEO_Player::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/motion_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } else if (inThermalVision && !IsCloaked()) @@ -638,7 +638,7 @@ int C_NEO_Player::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/thermal_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } return ret; @@ -855,8 +855,30 @@ void C_NEO_Player::PreThink( void ) if (IsAlive()) { + if (IsLocalPlayer() && m_bFirstAliveTick) + { + m_bFirstAliveTick = false; + // NEO TODO (Adam) since the stuff in C_NEO_PLAYER::Spawn() only runs the first time a person spawns in the map, would it be worth moving some of the stuff from there here instead? +#ifdef GLOWS_ENABLE + // Disable client side glow effects of all players + for (int i = 1; i <= MAX_PLAYERS; i++) + { + if (auto player = UTIL_PlayerByIndex(i)) + { + player->SetClientSideGlowEnabled(false); + } + } +#endif // GLOWS_ENABLE + } Lean(); } + else + { + if (IsLocalPlayer()) + { + m_bFirstAliveTick = true; + } + } // Eek. See rationale for this thing in CNEO_Player::PreThink if (IsAirborne()) @@ -956,7 +978,7 @@ void C_NEO_Player::ClientThink(void) } } } - } + } } static ConVar neo_this_client_speed("neo_this_client_speed", "0", FCVAR_SPONLY); diff --git a/mp/src/game/client/neo/c_neo_player.h b/mp/src/game/client/neo/c_neo_player.h index 6b3fc5f7ae..dd7ab5aa60 100644 --- a/mp/src/game/client/neo/c_neo_player.h +++ b/mp/src/game/client/neo/c_neo_player.h @@ -206,6 +206,7 @@ class C_NEO_Player : public C_HL2MP_Player unsigned char m_NeoFlags; private: + bool m_bFirstAliveTick; bool m_bFirstDeathTick; bool m_bPreviouslyReloading; bool m_bIsAllowedToToggleVision; diff --git a/mp/src/game/server/neo/neo_player.cpp b/mp/src/game/server/neo/neo_player.cpp index 5ab5382a6d..113ee2e648 100644 --- a/mp/src/game/server/neo/neo_player.cpp +++ b/mp/src/game/server/neo/neo_player.cpp @@ -2739,6 +2739,9 @@ int CNEO_Player::ShouldTransmit(const CCheckTransmitInfo* pInfo) { // If other is spectator or same team if (otherNeoPlayer->GetTeamNumber() == TEAM_SPECTATOR || +#ifdef GLOWS_ENABLE + otherNeoPlayer->IsDead() || +#endif GetTeamNumber() == otherNeoPlayer->GetTeamNumber()) { return FL_EDICT_ALWAYS; diff --git a/mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp b/mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp index d59a3c8262..098abbdbf0 100644 --- a/mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp +++ b/mp/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp @@ -1063,7 +1063,6 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) return BaseClass::DrawModel(flags); } - int ret = 0; auto pLocalPlayer = C_NEO_Player::GetLocalNEOPlayer(); if (!pLocalPlayer) { @@ -1080,6 +1079,7 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) bool inMotionVision = pLocalPlayer->IsInVision() && pLocalPlayer->GetClass() == NEO_CLASS_ASSAULT; bool inThermalVision = pLocalPlayer->IsInVision() && pLocalPlayer->GetClass() == NEO_CLASS_SUPPORT; + int ret = 0; if (!pOwner->IsCloaked() || inThermalVision) { ret |= BaseClass::DrawModel(flags); @@ -1091,7 +1091,7 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("models/player/toc", TEXTURE_GROUP_CLIENT_EFFECTS); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } auto vel = pOwner->GetAbsVelocity().Length(); @@ -1100,7 +1100,7 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/motion_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } else if (inThermalVision && !pOwner->IsCloaked()) @@ -1108,7 +1108,7 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/thermal_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::DrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } return ret; @@ -1116,8 +1116,6 @@ int CNEOBaseCombatWeapon::DrawModel(int flags) int CNEOBaseCombatWeapon::InternalDrawModel(int flags) { - int ret = 0; - if (flags & STUDIO_IGNORE_NEO_EFFECTS || !(flags & STUDIO_RENDER)) { return BaseClass::InternalDrawModel(flags); @@ -1139,6 +1137,7 @@ int CNEOBaseCombatWeapon::InternalDrawModel(int flags) bool inMotionVision = pLocalPlayer->IsInVision() && pLocalPlayer->GetClass() == NEO_CLASS_ASSAULT; bool inThermalVision = pLocalPlayer->IsInVision() && pLocalPlayer->GetClass() == NEO_CLASS_SUPPORT; + int ret = 0; if (!pOwner->IsCloaked() || inThermalVision) { ret |= BaseClass::InternalDrawModel(flags); @@ -1150,7 +1149,7 @@ int CNEOBaseCombatWeapon::InternalDrawModel(int flags) IMaterial* pass = materials->FindMaterial("models/player/toc", TEXTURE_GROUP_CLIENT_EFFECTS); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::InternalDrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } auto vel = pOwner->GetAbsVelocity().Length(); @@ -1159,7 +1158,7 @@ int CNEOBaseCombatWeapon::InternalDrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/motion_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::InternalDrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } else if (inThermalVision && !pOwner->IsCloaked()) @@ -1167,7 +1166,7 @@ int CNEOBaseCombatWeapon::InternalDrawModel(int flags) IMaterial* pass = materials->FindMaterial("dev/thermal_third", TEXTURE_GROUP_MODEL); modelrender->ForcedMaterialOverride(pass); ret |= BaseClass::InternalDrawModel(flags); - modelrender->ForcedMaterialOverride(null); + modelrender->ForcedMaterialOverride(nullptr); } return ret; From 0e7327ed885e64321970e1b35de431c4d6733e8a Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 17 Oct 2024 10:22:49 +0100 Subject: [PATCH 6/7] no need to turn off glow on team swap now --- mp/src/game/client/clientmode_shared.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/mp/src/game/client/clientmode_shared.cpp b/mp/src/game/client/clientmode_shared.cpp index be6be5d7ee..d53cb410a7 100644 --- a/mp/src/game/client/clientmode_shared.cpp +++ b/mp/src/game/client/clientmode_shared.cpp @@ -1202,16 +1202,6 @@ void ClientModeShared::FireGameEvent( IGameEvent *event ) { // that's me pPlayer->TeamChange( team ); -#ifdef NEO - // Switch off Xray when switching teams - for (int i = 1; i <= MAX_PLAYERS; i++) - { - if (auto player = UTIL_PlayerByIndex(i)) - { - player->SetClientSideGlowEnabled(false); - } - } -#endif } } #ifdef NEO From 1e6bf63cac04e4a529ae0db1358efa39289b5c4f Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 17 Oct 2024 17:24:39 +0100 Subject: [PATCH 7/7] use with haloadd_ps20 --- mp/src/game/client/glow_outline_effect.cpp | 20 +++++++++++++++++ .../client/neo/ui/neo_hud_friendly_marker.cpp | 22 +++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/mp/src/game/client/glow_outline_effect.cpp b/mp/src/game/client/glow_outline_effect.cpp index 52935ed186..a3549d05e5 100644 --- a/mp/src/game/client/glow_outline_effect.cpp +++ b/mp/src/game/client/glow_outline_effect.cpp @@ -307,12 +307,32 @@ void CGlowObjectManager::ApplyEntityGlowEffects( const CViewSetup *pSetup, int n stencilState.SetStencilState( pRenderContext ); // Draw quad +#ifdef NEO pRenderContext->DrawScreenSpaceRectangle( pMatHaloAddToScreen, 0, 0, nViewportWidth, nViewportHeight, + -0.25f, -0.25f, nSrcWidth / 4 - 1, nSrcHeight / 4 - 1, + pRtQuarterSize1->GetActualWidth(), + pRtQuarterSize1->GetActualHeight() ); + + pRenderContext->DrawScreenSpaceRectangle(pMatHaloAddToScreen, 0, 0, nViewportWidth, nViewportHeight, + 0.25f, 0.25f, nSrcWidth / 4 - 1, nSrcHeight / 4 - 1, + pRtQuarterSize1->GetActualWidth(), + pRtQuarterSize1->GetActualHeight()); + + stencilStateDisable.SetStencilState( pRenderContext ); + + pDimVar->SetFloatValue(0.15f); + pRenderContext->DrawScreenSpaceRectangle(pMatHaloAddToScreen, 0, 0, nViewportWidth, nViewportHeight, + 0, 0, nSrcWidth / 4 - 1, nSrcHeight / 4 - 1, + pRtQuarterSize1->GetActualWidth(), + pRtQuarterSize1->GetActualHeight()); +#else + pRenderContext->DrawScreenSpaceRectangle(pMatHaloAddToScreen, 0, 0, nViewportWidth, nViewportHeight, 0.0f, -0.5f, nSrcWidth / 4 - 1, nSrcHeight / 4 - 1, pRtQuarterSize1->GetActualWidth(), pRtQuarterSize1->GetActualHeight() ); stencilStateDisable.SetStencilState( pRenderContext ); +#endif } } 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 e993af6354..f5c9c31a35 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 @@ -123,18 +123,16 @@ void CNEOHud_FriendlyMarker::DrawPlayerForTeam(C_Team *team, const C_NEO_Player } } +extern ConVar glow_outline_effect_enable; void CNEOHud_FriendlyMarker::DrawPlayer(Color teamColor, C_NEO_Player *player, const C_NEO_Player *localPlayer) const { int x, y; 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)) + bool drawOutline = glow_outline_effect_enable.GetBool(); + Vector offset = drawOutline ? Vector(0, 0, 7) : vec3_origin; + if (GetVectorInScreenSpace(pos, x, y, &offset)) { auto playerName = player->GetNeoPlayerName(); @@ -147,22 +145,22 @@ void CNEOHud_FriendlyMarker::DrawPlayer(Color teamColor, C_NEO_Player *player, c surface()->DrawSetTextFont(m_hFont); surface()->DrawSetTextColor(FadeColour(teamColor, fadeTextMultiplier)); - int textYOffset = 0; + int textYOffset = drawOutline ? vgui::surface()->GetFontTall(m_hFont) * -2 : 0; char textASCII[MAX_MARKER_STRLEN]; - auto DisplayText = [this, &textYOffset, x, y](const char *textASCII) { + auto DisplayText = [this, &textYOffset, x, y](const char *textASCII, bool drawOutline) { wchar_t textUTF[MAX_MARKER_STRLEN]; g_pVGuiLocalize->ConvertANSIToUnicode(textASCII, textUTF, sizeof(textUTF)); int textWidth, textHeight; surface()->GetTextSize(m_hFont, textUTF, textWidth, textHeight); - surface()->DrawSetTextPos(x - (textWidth / 2), y + m_iMarkerHeight + textYOffset); + surface()->DrawSetTextPos(x - (textWidth / 2), y + (drawOutline ? 0 : m_iMarkerHeight) + textYOffset); surface()->DrawPrintText(textUTF, V_strlen(textASCII)); textYOffset += textHeight; }; // Draw player's name and health V_snprintf(textASCII, MAX_MARKER_STRLEN, "%s", playerName); - DisplayText(textASCII); + DisplayText(textASCII, drawOutline); // Draw distance to player - Only if local player alive and same team // OR local not alive or spectator and this player has ghost @@ -173,11 +171,11 @@ void CNEOHud_FriendlyMarker::DrawPlayer(Color teamColor, C_NEO_Player *player, c V_snprintf(textASCII, MAX_MARKER_STRLEN, "%s: %.0fm", player->IsCarryingGhost() ? "GHOST DISTANCE" : "DISTANCE", flDistance); - DisplayText(textASCII); + DisplayText(textASCII, drawOutline); } V_snprintf(textASCII, MAX_MARKER_STRLEN, "%d%%", player->GetHealth()); - DisplayText(textASCII); + DisplayText(textASCII, drawOutline); } if (!drawOutline)