Skip to content
Open
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
158 changes: 79 additions & 79 deletions src/game/client/c_particle_smokegrenade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
21 changes: 19 additions & 2 deletions src/game/client/smoke_fog_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -152,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;
}
Expand Down
17 changes: 0 additions & 17 deletions src/game/shared/gamevars_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down