From b4446e731e6ed7332dcac65b1fe558b98eebb925 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Mon, 12 Jan 2026 14:24:06 +0000 Subject: [PATCH 1/2] init --- src/game/client/c_particle_smokegrenade.cpp | 158 ++++++++++---------- src/game/client/smoke_fog_overlay.cpp | 17 +++ 2 files changed, 96 insertions(+), 79 deletions(-) diff --git a/src/game/client/c_particle_smokegrenade.cpp b/src/game/client/c_particle_smokegrenade.cpp index 59db9fd559..de64cfedec 100644 --- a/src/game/client/c_particle_smokegrenade.cpp +++ b/src/game/client/c_particle_smokegrenade.cpp @@ -403,29 +403,26 @@ void C_ParticleSmokeGrenade::Start(CParticleMgr *pParticleMgr, IPrototypeArgAcce void C_ParticleSmokeGrenade::ClientThink() { - if (!CanSeeThroughSmokeGrenades()) + if (m_CurrentStage == 1) { - if (m_CurrentStage == 1) - { - // Add our influence to the global smoke fog alpha. + // Add our influence to the global smoke fog alpha. - float testDist = (MainViewOrigin() - m_SmokeBasePos).Length(); + float testDist = (MainViewOrigin() - m_SmokeBasePos).Length(); - float fadeEnd = m_ExpandRadius; + float fadeEnd = m_ExpandRadius; - // The center of the smoke cloud that always gives full fog overlay - float flCoreDistance = fadeEnd * 0.3; + // The center of the smoke cloud that always gives full fog overlay + float flCoreDistance = fadeEnd * 0.3; - if (testDist < fadeEnd) + if (testDist < fadeEnd) + { + if (testDist < flCoreDistance) { - if (testDist < flCoreDistance) - { - EngineGetSmokeFogOverlayAlpha() += m_FadeAlpha; - } - else - { - EngineGetSmokeFogOverlayAlpha() += (1 - (testDist - flCoreDistance) / (fadeEnd - flCoreDistance)) * m_FadeAlpha; - } + EngineGetSmokeFogOverlayAlpha() += m_FadeAlpha; + } + else + { + EngineGetSmokeFogOverlayAlpha() += (1 - (testDist - flCoreDistance) / (fadeEnd - flCoreDistance)) * m_FadeAlpha; } } } @@ -690,87 +687,90 @@ inline void C_ParticleSmokeGrenade::ApplyDynamicLight( const Vector &vParticlePo void C_ParticleSmokeGrenade::RenderParticles( CParticleRenderIterator *pIterator ) { - if (!CanSeeThroughSmokeGrenades()) + const SmokeGrenadeParticle* pParticle = (const SmokeGrenadeParticle*)pIterator->GetFirst(); + while (pParticle) { - const SmokeGrenadeParticle* pParticle = (const SmokeGrenadeParticle*)pIterator->GetFirst(); - while (pParticle) - { - Vector vWorldSpacePos = m_SmokeBasePos + pParticle->m_Pos; + Vector vWorldSpacePos = m_SmokeBasePos + pParticle->m_Pos; - float sortKey; + float sortKey; - // Draw. - float len = pParticle->m_Pos.Length(); - if (len > m_ExpandRadius) + // Draw. + float len = pParticle->m_Pos.Length(); + if (len > m_ExpandRadius) + { + Vector vTemp; + TransformParticle(ParticleMgr()->GetModelView(), vWorldSpacePos, vTemp); + sortKey = vTemp.z; + } + else + { + // This smooths out the growing sphere. Rather than having particles appear in one spot as the sphere + // expands, they stay at the borders. + Vector renderPos; + if (len > m_ExpandRadius * 0.5f) { - Vector vTemp; - TransformParticle(ParticleMgr()->GetModelView(), vWorldSpacePos, vTemp); - sortKey = vTemp.z; + renderPos = m_SmokeBasePos + (pParticle->m_Pos * (m_ExpandRadius * 0.5f)) / len; } else { - // This smooths out the growing sphere. Rather than having particles appear in one spot as the sphere - // expands, they stay at the borders. - Vector renderPos; - if (len > m_ExpandRadius * 0.5f) - { - renderPos = m_SmokeBasePos + (pParticle->m_Pos * (m_ExpandRadius * 0.5f)) / len; - } - else - { - renderPos = vWorldSpacePos; - } + renderPos = vWorldSpacePos; + } - // Figure out the alpha based on where it is in the sphere. - float alpha = 1 - len / m_ExpandRadius; + // Figure out the alpha based on where it is in the sphere. + float alpha = 1 - len / m_ExpandRadius; - // This changes the ramp to be very solid in the core, then taper off. - static float testCutoff = 0.3; - if (alpha > testCutoff) - { - alpha = 1; - } - else - { - // at testCutoff it's 1, at 0, it's 0 - alpha = alpha / testCutoff; - } + // This changes the ramp to be very solid in the core, then taper off. + static float testCutoff = 0.3; + if (alpha > testCutoff) + { + alpha = 1; + } + else + { + // at testCutoff it's 1, at 0, it's 0 + alpha = alpha / testCutoff; + } - // Fade out globally. - alpha *= m_FadeAlpha; + // Fade out globally. + alpha *= m_FadeAlpha; - // Apply the precalculated fade alpha from world geometry. - alpha *= pParticle->m_FadeAlpha; + // Apply the precalculated fade alpha from world geometry. + alpha *= pParticle->m_FadeAlpha; - // TODO: optimize this whole routine! - Vector color = m_MinColor + (m_MaxColor - m_MinColor) * (pParticle->m_ColorInterp / 255.1f); - color.x *= pParticle->m_Color[0] / 255.0f; - color.y *= pParticle->m_Color[1] / 255.0f; - color.z *= pParticle->m_Color[2] / 255.0f; + if (CanSeeThroughSmokeGrenades()) + { + constexpr float THERMAL_VISION_ALPHA_MULTIPLIER = 0.1f; + alpha *= THERMAL_VISION_ALPHA_MULTIPLIER; + } - // Lighting. - ApplyDynamicLight(renderPos, color); + // TODO: optimize this whole routine! + Vector color = m_MinColor + (m_MaxColor - m_MinColor) * (pParticle->m_ColorInterp / 255.1f); + color.x *= pParticle->m_Color[0] / 255.0f; + color.y *= pParticle->m_Color[1] / 255.0f; + color.z *= pParticle->m_Color[2] / 255.0f; - color = (color + Vector(0.5, 0.5, 0.5)) / 2; //Desaturate + // Lighting. + ApplyDynamicLight(renderPos, color); - Vector tRenderPos; - TransformParticle(ParticleMgr()->GetModelView(), renderPos, tRenderPos); - sortKey = tRenderPos.z; + color = (color + Vector(0.5, 0.5, 0.5)) / 2; //Desaturate - //debugoverlay->AddBoxOverlay( renderPos, Vector( -2, -2, -2), Vector( 2, 2, 2), vec3_angle, 255, 255, 255, 255, 1.0f ); + Vector tRenderPos; + TransformParticle(ParticleMgr()->GetModelView(), renderPos, tRenderPos); + sortKey = tRenderPos.z; - RenderParticle_ColorSizeAngle( - pIterator->GetParticleDraw(), - tRenderPos, - color, - alpha * GetAlphaDistanceFade(tRenderPos, 0, 10), // Alpha - SMOKEPARTICLE_SIZE, - pParticle->m_CurRotation - ); - } + //debugoverlay->AddBoxOverlay( renderPos, Vector( -2, -2, -2), Vector( 2, 2, 2), vec3_angle, 255, 255, 255, 255, 1.0f ); - pParticle = (SmokeGrenadeParticle*)pIterator->GetNext(sortKey); + RenderParticle_ColorSizeAngle( + pIterator->GetParticleDraw(), + tRenderPos, + color, + alpha * GetAlphaDistanceFade(tRenderPos, 0, 10), // Alpha + SMOKEPARTICLE_SIZE, + pParticle->m_CurRotation + ); } + + pParticle = (SmokeGrenadeParticle*)pIterator->GetNext(sortKey); } } diff --git a/src/game/client/smoke_fog_overlay.cpp b/src/game/client/smoke_fog_overlay.cpp index d160c49fd5..76cd0c50f2 100644 --- a/src/game/client/smoke_fog_overlay.cpp +++ b/src/game/client/smoke_fog_overlay.cpp @@ -74,6 +74,15 @@ void DrawSmokeFogOverlay() CMatRenderContextPtr pRenderContext( materials ); +#ifdef NEO + VMatrix matrixProjection; + pRenderContext->GetMatrix(MATERIAL_PROJECTION, &matrixProjection); + VMatrix matrixView; + pRenderContext->GetMatrix(MATERIAL_VIEW, &matrixView); + VMatrix matrixModel; + pRenderContext->GetMatrix(MATERIAL_MODEL, &matrixModel); +#endif // NEO + pRenderContext->MatrixMode( MATERIAL_PROJECTION ); pRenderContext->LoadIdentity(); pRenderContext->Ortho( 0, 0, 1, 1, -99999, 99999 ); @@ -119,6 +128,14 @@ void DrawSmokeFogOverlay() meshBuilder.End(); pMesh->Draw(); + +#ifdef NEO + pRenderContext->LoadMatrix(matrixModel); + pRenderContext->MatrixMode( MATERIAL_PROJECTION ); + pRenderContext->LoadMatrix(matrixProjection); + pRenderContext->MatrixMode( MATERIAL_VIEW ); + pRenderContext->LoadMatrix(matrixView); +#endif // NEO } #ifdef GLOWS_ENABLE From cf414f4044f97f9e39119d35036bd8931bc08b2c Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Mon, 12 Jan 2026 14:47:27 +0000 Subject: [PATCH 2/2] dont draw fog overlay in third person spectate, dont toggle glow enabled when mp_forcecamera value changes since we dont glow enemies ever when spectating as a game player anyway --- src/game/client/smoke_fog_overlay.cpp | 4 ++-- src/game/shared/gamevars_shared.cpp | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/game/client/smoke_fog_overlay.cpp b/src/game/client/smoke_fog_overlay.cpp index 76cd0c50f2..362ae5ec7a 100644 --- a/src/game/client/smoke_fog_overlay.cpp +++ b/src/game/client/smoke_fog_overlay.cpp @@ -169,9 +169,9 @@ void UpdateThermalOverride() } } #ifdef GLOWS_ENABLE - else if (localPlayer->IsObserver() && glow_outline_effect_enable.GetBool() && (localPlayer->GetTeamNumber() == TEAM_SPECTATOR || mp_forcecamera.GetInt() == OBS_ALLOW_ALL)) + else if (localPlayer->IsObserver() && (localPlayer->GetTeamNumber() == TEAM_SPECTATOR || mp_forcecamera.GetInt() == OBS_ALLOW_ALL)) { - g_SmokeFogOverlayThermalOverride = true; + g_SmokeFogOverlayThermalOverride = false; g_SmokeFogOverlayAlpha = 0; return; } diff --git a/src/game/shared/gamevars_shared.cpp b/src/game/shared/gamevars_shared.cpp index efeb93f0b5..77074b345c 100644 --- a/src/game/shared/gamevars_shared.cpp +++ b/src/game/shared/gamevars_shared.cpp @@ -17,23 +17,6 @@ void MPForceCameraCallback( IConVar *var, const char *pOldString, float flOldVal { mp_forcecamera.SetValue( OBS_ALLOW_TEAM ); } - -#ifdef NEO - if (mp_forcecamera.GetInt() != OBS_ALLOW_ALL) - { - for (int i = 1; i <= gpGlobals->maxClients; i++) - { - if (auto player = UTIL_PlayerByIndex(i)) - { - if (player->GetTeamNumber() == TEAM_SPECTATOR) - { - continue; - } - engine->ClientCommand(player->edict(), "glow_outline_effect_enable false"); - } - } - } -#endif // NEO } #endif