Rain splashes

From Valve Developer Community
Revision as of 19:03, 2 April 2009 by Ghost12332 (talk | contribs) (New page: Category:Free source code == Source Code == By default the rain splashes done in c_effects.cpp in the Simulate Rain function take place randomly, and more importantly only on water...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Source Code

By default the rain splashes done in c_effects.cpp in the Simulate Rain function take place randomly, and more importantly only on water. This snippet will allow the rain to work on all surfaces, and also allows for a custom Rain Splash Particle Effect.

NOTE: PLEASE REPLACE XXX'S WITH YOUR PARTICLE SYSTEM

Simply replace the "if" function at line 331 in c_effects.cpp, in the Temporary Entites section of the client code, with the following code.

     if ( m_Splashes.Count() < 20 )
     {
        if ( RandomInt( 0, 100 ) < r_RainSplashPercentage.GetInt() )
        {
           trace_t trace;
           UTIL_TraceLine(vOldPos, pParticle->m_Pos, MASK_ALL, NULL, COLLISION_GROUP_NPC, &trace);
           if( trace.fraction < 1 )
           {
              DispatchParticleEffect( "XXXX", trace.endpos, trace.m_pEnt->GetAbsAngles() , NULL );                      
           }
        }
     }