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
Binary file modified assets/particles/cs2fixes/simple_overlay.vpcf_c
Binary file not shown.
73 changes: 69 additions & 4 deletions assets_source/particles/cs2fixes/simple_overlay.vpcf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
m_nBehaviorVersion = 12
m_nMaxParticles = 1
m_bInfiniteBounds = true
m_bScreenSpaceEffect = true
m_flConstantRadius = 100.0
m_bScreenSpaceEffect = true
m_controlPointConfigurations =
[
{
Expand Down Expand Up @@ -195,6 +195,71 @@
}
}
},
{
_class = "C_INIT_InitFloat"
m_InputValue =
{
m_nType = "PF_TYPE_CONTROL_POINT_COMPONENT"
m_nMapType = "PF_MAP_TYPE_DIRECT"
m_flLiteralValue = 0.0
m_NamedValue = ""
m_nControlPoint = 17
m_nScalarAttribute = 3
m_nVectorAttribute = 6
m_nVectorComponent = 2
m_flRandomMin = 0.0
m_flRandomMax = 1.0
m_bHasRandomSignFlip = false
m_nRandomSeed = -1
m_nRandomMode = "PF_RANDOM_MODE_CONSTANT"
m_flLOD0 = 0.0
m_flLOD1 = 0.0
m_flLOD2 = 0.0
m_flLOD3 = 0.0
m_nNoiseInputVectorAttribute = 0
m_flNoiseOutputMin = 0.0
m_flNoiseOutputMax = 1.0
m_flNoiseScale = 0.1
m_vecNoiseOffsetRate = [ 0.0, 0.0, 0.0 ]
m_flNoiseOffset = 0.0
m_nNoiseOctaves = 1
m_nNoiseTurbulence = "PF_NOISE_TURB_NONE"
m_nNoiseType = "PF_NOISE_TYPE_PERLIN"
m_nNoiseModifier = "PF_NOISE_MODIFIER_NONE"
m_flNoiseTurbulenceScale = 1.0
m_flNoiseTurbulenceMix = 0.5
m_flNoiseImgPreviewScale = 1.0
m_bNoiseImgPreviewLive = true
m_flNoCameraFallback = 0.0
m_bUseBoundsCenter = false
m_nInputMode = "PF_INPUT_MODE_CLAMPED"
m_flMultFactor = 1.0
m_flInput0 = 0.0
m_flInput1 = 1.0
m_flOutput0 = 0.0
m_flOutput1 = 1.0
m_flNotchedRangeMin = 0.0
m_flNotchedRangeMax = 1.0
m_flNotchedOutputOutside = 0.0
m_flNotchedOutputInside = 1.0
m_nBiasType = "PF_BIAS_TYPE_STANDARD"
m_flBiasParameter = 0.0
m_Curve =
{
m_spline = [ ]
m_tangents = [ ]
m_vDomainMins = [ 0.0, 0.0 ]
m_vDomainMaxs = [ 0.0, 0.0 ]
}
}
m_nOutputField = 1
},
]
m_Operators =
[
{
_class = "C_OP_Decay"
},
]
m_Renderers =
[
Expand All @@ -212,14 +277,14 @@
]
m_flSelfIllumAmount =
{
m_nType = "PF_TYPE_CONTROL_POINT_COMPONENT"
m_nType = "PF_TYPE_LITERAL"
m_nMapType = "PF_MAP_TYPE_DIRECT"
m_flLiteralValue = 1.0
m_NamedValue = ""
m_nControlPoint = 17
m_nControlPoint = 0
m_nScalarAttribute = 3
m_nVectorAttribute = 6
m_nVectorComponent = 2
m_nVectorComponent = 0
m_flRandomMin = 0.0
m_flRandomMax = 1.0
m_bHasRandomSignFlip = false
Expand Down
34 changes: 10 additions & 24 deletions src/zombiereborn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,39 +121,25 @@ void ZR_Precache(IEntityResourceManifest* pResourceManifest)
pResourceManifest->AddResource("soundevents/soundevents_zr.vsndevts");
}

CEnvParticleGlow* ZR_CreateOverlay(const char* pszOverlayParticlePath, float flAlpha, float flRadius, float flSelfIllum, float flLifeTime, Color clrTint, const char* pszMaterialOverride)
void ZR_CreateOverlay(const char* pszOverlayParticlePath, float flAlpha, float flRadius, float flLifeTime, Color clrTint, const char* pszMaterialOverride)
{
CEnvParticleGlow* particle = (CEnvParticleGlow*)CreateEntityByName("env_particle_glow");

CEntityKeyValues* pKeyValues = new CEntityKeyValues();

pKeyValues->SetString("effect_name", pszOverlayParticlePath);
pKeyValues->SetFloat("alphascale", flAlpha);
pKeyValues->SetFloat("scale", flRadius);
pKeyValues->SetFloat("selfillumscale", flSelfIllum);
pKeyValues->SetColor("colortint", clrTint);
// these properties are mapped to control point position by the entity
pKeyValues->SetFloat("alphascale", flAlpha); //17.x
pKeyValues->SetFloat("scale", flRadius); //17.y
pKeyValues->SetFloat("selfillumscale", flLifeTime); //17.z
pKeyValues->SetColor("colortint", clrTint); //16.xyz

pKeyValues->SetString("effect_textureOverride", pszMaterialOverride);

particle->DispatchSpawn(pKeyValues);
particle->AcceptInput("Start");

CHandle<CEnvParticleGlow> hParticle = particle->GetHandle();

// destroy particle first, then kill the entity
new CTimer(flLifeTime, false, [hParticle]()
{
CEnvParticleGlow* particle = hParticle.Get();

//Note: for simple_overlay, if the entity is somehow killed before the particle is destroyed, it will stay on forever until the round reset, which doesn't matter in this specific use case
if (particle)
{
particle->AcceptInput("DestroyImmediately");
UTIL_AddEntityIOEvent(particle, "Kill", nullptr, nullptr, "", 0.02f);
}
return -1.0f;
});

return particle;
UTIL_AddEntityIOEvent(particle, "Kill", nullptr, nullptr, "", flLifeTime + 1.0);
}

bool ZRClass::IsApplicableTo(CCSPlayerController *pController)
Expand Down Expand Up @@ -1299,7 +1285,7 @@ void ZR_EndRoundAndAddTeamScore(int iTeamNum)
}
g_hTeamCT->m_iScore = g_hTeamCT->m_iScore() + 1;
if (!g_szHumanWinOverlayParticle.empty())
ZR_CreateOverlay(g_szHumanWinOverlayParticle.c_str(), 1.0f, g_flHumanWinOverlaySize, 1.0f, flRestartDelay, Color(255, 255, 255), g_szHumanWinOverlayMaterial.c_str());
ZR_CreateOverlay(g_szHumanWinOverlayParticle.c_str(), 1.0f, g_flHumanWinOverlaySize, flRestartDelay, Color(255, 255, 255), g_szHumanWinOverlayMaterial.c_str());
}
else if (iTeamNum == CS_TEAM_T)
{
Expand All @@ -1310,7 +1296,7 @@ void ZR_EndRoundAndAddTeamScore(int iTeamNum)
}
g_hTeamT->m_iScore = g_hTeamT->m_iScore() + 1;
if (!g_szZombieWinOverlayParticle.empty())
ZR_CreateOverlay(g_szZombieWinOverlayParticle.c_str(), 1.0f, g_flZombieWinOverlaySize, 1.0f, flRestartDelay, Color(255, 255, 255), g_szZombieWinOverlayMaterial.c_str());
ZR_CreateOverlay(g_szZombieWinOverlayParticle.c_str(), 1.0f, g_flZombieWinOverlaySize, flRestartDelay, Color(255, 255, 255), g_szZombieWinOverlayMaterial.c_str());
}
}

Expand Down