Hi Jonathan,

I'm not really friendly with particle behaviours meaning that I can't really
test that your fix is working but looking at your explaination I feel
confident. I would have like having an answer from Valve in order to be sure
this origin is not set in any other location but nothing for few days.

Anyway, I wanted to thank you for sharing this fix with the hlcoders list.
It is really a very nice attitude that I sincerelly appreciate. Thank you.
Keep up the good spirit.

J.

2009/8/5 Jonathan White <killermonke...@gmail.com>

> When trying to dispatch a particle effect from the server to the client
> using DispatchParticleEffect( const char *pszParticleName,
> ParticleAttachment_t iAttachType, CBaseEntity *pEntity, const char
> *pszAttachmentName, bool bResetAllParticlesOnEntity ) I noticed that it
> wasn't working at all, meaning the client never received the dispatch. My
> first intuition was that it was being suppressed by prediction, but that
> quickly resolved to not being the case.
>
> I finally resolved that it was because when you dispatch an effect, the
> recipient list is calculated based on whoever is in PAS range. Well, the
> origin for the effect is never initialized when you try to dispatch an
> effect that originates from an attachment point on an entity! The following
> is a fix to this problem:
>
> particle_parse.cpp, Lines 196 - 219
> In Function: void DispatchParticleEffect( const char *pszParticleName,
> ParticleAttachment_t iAttachType, CBaseEntity *pEntity, int
> iAttachmentPoint, bool bResetAllParticlesOnEntity )
>
> OLD FUNCTION:
> void DispatchParticleEffect( const char *pszParticleName,
> ParticleAttachment_t iAttachType, CBaseEntity *pEntity, int
> iAttachmentPoint, bool bResetAllParticlesOnEntity )
> {
>    CEffectData    data;
>
>    data.m_nHitBox = GetParticleSystemIndex( pszParticleName );
>    if ( pEntity )
>    {
> #ifdef CLIENT_DLL
>        data.m_hEntity = pEntity;
> #else
>        data.m_nEntIndex = pEntity->entindex();
> #endif
>        data.m_fFlags |= PARTICLE_DISPATCH_FROM_ENTITY;
>    }
>    data.m_nDamageType = iAttachType;
>    data.m_nAttachmentIndex = iAttachmentPoint;
>
>    if ( bResetAllParticlesOnEntity )
>    {
>        data.m_fFlags |= PARTICLE_DISPATCH_RESET_PARTICLES;
>    }
>
>    DispatchEffect( "ParticleEffect", data );
> }
>
> CORRECTED FUNCTION:
> void DispatchParticleEffect( const char *pszParticleName,
> ParticleAttachment_t iAttachType, CBaseEntity *pEntity, int
> iAttachmentPoint, bool bResetAllParticlesOnEntity )
> {
>    CEffectData    data;
>
>    data.m_nHitBox = GetParticleSystemIndex( pszParticleName );
>    if ( pEntity )
>    {
>        data.m_vOrigin = pEntity->GetAbsOrigin();
> #ifdef CLIENT_DLL
>        data.m_hEntity = pEntity;
> #else
>        data.m_nEntIndex = pEntity->entindex();
> #endif
>        data.m_fFlags |= PARTICLE_DISPATCH_FROM_ENTITY;
>    }
>    data.m_nDamageType = iAttachType;
>    data.m_nAttachmentIndex = iAttachmentPoint;
>
>    if ( bResetAllParticlesOnEntity )
>    {
>        data.m_fFlags |= PARTICLE_DISPATCH_RESET_PARTICLES;
>    }
>
>    DispatchEffect( "ParticleEffect", data );
> }
>
> Note the addition of data.m_vOrigin, that is what the recipient list filter
> uses to calculate the PAS recipients and must be initialized even if the
> particle effect isn't ultimately going to use it.
>
> Jonathan White
> GoldenEye: Source
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>


-- 
-------------------
j...@nek
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to