MCPcopy Create free account
hub / github.com/JACoders/OpenJK / FX_AddParticle

Function FX_AddParticle

code/cgame/FxUtil.cpp:406–493  ·  view source on GitHub ↗

------------------------- FX_AddParticle -------------------------

Source from the content-addressed store, hash-verified

404// FX_AddParticle
405//-------------------------
406CParticle *FX_AddParticle( int clientID, const vec3_t org, const vec3_t vel, const vec3_t accel, float gravity,
407 float size1, float size2, float sizeParm,
408 float alpha1, float alpha2, float alphaParm,
409 const vec3_t sRGB, const vec3_t eRGB, float rgbParm,
410 float rotation, float rotationDelta,
411 const vec3_t min, const vec3_t max, float elasticity,
412 int deathID, int impactID,
413 int killTime, qhandle_t shader, int flags, int modelNum, int boltNum )
414{
415 if ( theFxHelper.mFrameTime < 1 )
416 { // disallow adding effects when the system is paused
417 return 0;
418 }
419
420 CParticle *fx = new CParticle;
421
422 if ( fx )
423 {
424 if (flags&FX_RELATIVE && clientID>=0)
425 {
426 fx->SetOrigin1( NULL );
427 fx->SetOrgOffset( org );
428 fx->SetClient( clientID, modelNum, boltNum );
429 }
430 else
431 {
432 fx->SetOrigin1( org );
433 }
434 fx->SetVel( vel );
435 fx->SetAccel( accel );
436 fx->SetGravity( gravity );
437
438 // RGB----------------
439 fx->SetRGBStart( sRGB );
440 fx->SetRGBEnd( eRGB );
441
442 if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE )
443 {
444 fx->SetRGBParm( rgbParm * PI * 0.001f );
445 }
446 else if ( flags & FX_RGB_PARM_MASK )
447 {
448 // rgbParm should be a value from 0-100..
449 fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime );
450 }
451
452 // Alpha----------------
453 fx->SetAlphaStart( alpha1 );
454 fx->SetAlphaEnd( alpha2 );
455
456 if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE )
457 {
458 fx->SetAlphaParm( alphaParm * PI * 0.001f );
459 }
460 else if ( flags & FX_ALPHA_PARM_MASK )
461 {
462 fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime );
463 }

Callers 2

CreateEffectMethod · 0.70
FX_AddSpriteFunction · 0.70

Calls 15

FX_AddPrimitiveFunction · 0.70
SetOrigin1Method · 0.45
SetOrgOffsetMethod · 0.45
SetClientMethod · 0.45
SetVelMethod · 0.45
SetAccelMethod · 0.45
SetGravityMethod · 0.45
SetRGBStartMethod · 0.45
SetRGBEndMethod · 0.45
SetRGBParmMethod · 0.45
SetAlphaStartMethod · 0.45
SetAlphaEndMethod · 0.45

Tested by

no test coverage detected