From ba90de20d9655d73f35f8643461747438065d4cb Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 31 Oct 2022 19:59:10 +0300 Subject: [PATCH] game/server: fix particle transition from trigger_vphysics_motion --- game/server/triggers.cpp | 3 ++- game/shared/baseparticleentity.cpp | 1 + game/shared/baseparticleentity.h | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/game/server/triggers.cpp b/game/server/triggers.cpp index 5bdda3d7..0df3ca07 100644 --- a/game/server/triggers.cpp +++ b/game/server/triggers.cpp @@ -4623,7 +4623,8 @@ void CTriggerVPhysicsMotion::StartTouch( CBaseEntity *pOther ) #ifndef _XBOX if ( m_ParticleTrail.m_strMaterialName != NULL_STRING ) { - CEntityParticleTrail::Create( pOther, m_ParticleTrail, this ); + CEntityParticleTrail *pTrail = CEntityParticleTrail::Create( pOther, m_ParticleTrail, this ); + pTrail->SetShouldDeletedOnChangelevel( true ); } #endif diff --git a/game/shared/baseparticleentity.cpp b/game/shared/baseparticleentity.cpp index 85c989b3..92a95874 100644 --- a/game/shared/baseparticleentity.cpp +++ b/game/shared/baseparticleentity.cpp @@ -35,6 +35,7 @@ CBaseParticleEntity::CBaseParticleEntity( void ) m_bSimulate = true; m_nToolParticleEffectId = TOOLPARTICLESYSTEMID_INVALID; #endif + m_bShouldDeletedOnChangelevel = false; } CBaseParticleEntity::~CBaseParticleEntity( void ) diff --git a/game/shared/baseparticleentity.h b/game/shared/baseparticleentity.h index 7de9f4a7..600b442b 100644 --- a/game/shared/baseparticleentity.h +++ b/game/shared/baseparticleentity.h @@ -35,6 +35,16 @@ public: CBaseParticleEntity(); virtual ~CBaseParticleEntity(); + virtual int ObjectCaps() + { + if( m_bShouldDeletedOnChangelevel ) + return BaseClass::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; + else + return BaseClass::ObjectCaps(); + } + + void SetShouldDeletedOnChangelevel( bool bDel ) { m_bShouldDeletedOnChangelevel = bDel; } + // CBaseEntity overrides. public: #if !defined( CLIENT_DLL ) @@ -76,6 +86,8 @@ public: void SetLifetime(float lifetime); private: + bool m_bShouldDeletedOnChangelevel; + CBaseParticleEntity( const CBaseParticleEntity & ); // not defined, not accessible };