From 27c02cd0e0c7717ff66433fcc60f4f7cd87e0512 Mon Sep 17 00:00:00 2001 From: Connor <34824423+EasterLee@users.noreply.github.com> Date: Mon, 15 Apr 2024 14:16:20 -0400 Subject: [PATCH] use selfillum field for particle lifetime --- .../particles/cs2fixes/simple_overlay.vpcf_c | Bin 3048 -> 3081 bytes .../particles/cs2fixes/simple_overlay.vpcf | 73 +++++++++++++++++- src/zombiereborn.cpp | 34 +++----- 3 files changed, 79 insertions(+), 28 deletions(-) diff --git a/assets/particles/cs2fixes/simple_overlay.vpcf_c b/assets/particles/cs2fixes/simple_overlay.vpcf_c index 61df58320c78055e88ea3a19539b1d3f97f70d7e..d2201701563adb92da61b0216cb65b2f932d7c35 100644 GIT binary patch delta 1099 zcmZ9KO>7%Q6vyApe#GmwvtB#YCM0p%2$TafO)4cJ1trE#8;i6yc0SvHv$e;~HtXGG zy>^m9NYy|kBqG&WkO~K?O1wB(^tSKY(`8Z9{2hp=Gmp_MT znLGU9iY&@k{su3HK95YCfWjpDsjv9`192MF3^I$HM=l_9on$}q>OdM^xD&~+nO&rjG1{`E3(mYnH62A6uh^^AyV+}iV1SxBTc8;8cC~STP8Ez zOK>x%nI)@oRyUiWQ(Nxanr@2IF*jo~M{}(@|4WJ$wH2(AV`hmt8$4CO$=iI7SMYYwZf0=xr}1r_c=MRS>>Yeuz)iQeZ@d$K{e0pM(&qy;BwXcc>MYC+h^Gozd~ zj9Mj8v1)lfcQIocE1PgMZC(~0RL^J?mig~z#wc9zg8t~*r+kT(9j)l%ML&jI(lRVZ z<&xQ{(c~hrvxTX|_~d98$a#TNfD8a^gMQjF3~Najo~m!~yu~e=DQ39Zb)mPO%npKZ zjenTT=9rWu?Q7%g5Xb-T?T77b5`WT~hRA7;V_Qrm0OxC;G z_1Z}aC8b4thz~XFr8flP&UICE&A-p(|{D&gP{& z`NAkWnBe2=%UyMr!Xj~sm?P$ig&Xp{=;&FYw8bV{C7!ljX~F6HT&R zu9H|KDnykKWp*#IQ0pXn?!H+fv%~9@d4X6a45G26M$G|u7U}yVIp4`VhkTQ8L%6H8 zNVJI+VwG4UE)XwzKPWv1zUvr(>_;M&WWzxQ?cny99~bvL@%67)LNw9fB%;9^?8o3W zCcKzB`M55gwpwO2g6&wo;s{~pZM`BgwVJ57Xq0M3+A^E2Zn`cXh`dj37P~!Lu2&Iv7G^ z$n#Pi(e;0LI$O-73(U@zimB<@%)`(|6^S{f(gt9DerL#F<=x)6&vR3m8)wc(I6ZKWFFjrnydgmhOosS^45J70_x)ikyiIy~Q zQBuMP4Xp_95Y#uMKp5yp?zlr!hMLN|mOaJ&J~iG}RrL{8nYJo4l_<(MDOQU5&!|j@ zn%*+Td^jty0OUF5)KjjjSC&4MDyc#tm7e^YmygX%PtTls-AihRc$eax(;l-fso{X% zA6Md|zzEjEs-|hd$Os;MKuaPKN@5@T1mmxQf_PyT~R+LCURh2)GxE)aG nwWfA!aYYNhg|PAsf>Y=V4&$Bu;m9cD^XzIMO#jAjfA0PZn7j6C diff --git a/assets_source/particles/cs2fixes/simple_overlay.vpcf b/assets_source/particles/cs2fixes/simple_overlay.vpcf index 09c7ee619..1e8273f81 100644 --- a/assets_source/particles/cs2fixes/simple_overlay.vpcf +++ b/assets_source/particles/cs2fixes/simple_overlay.vpcf @@ -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 = [ { @@ -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 = [ @@ -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 diff --git a/src/zombiereborn.cpp b/src/zombiereborn.cpp index 07facb533..5a8129b6b 100644 --- a/src/zombiereborn.cpp +++ b/src/zombiereborn.cpp @@ -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 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) @@ -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) { @@ -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()); } }