void FX_CreateLight(const FXSegment_t *segment, vec3_t origin) { FXLightSegment_t *light; fxLight_t *effect; if(!segment) { // NULL segment pointer? return; } if(!segment->SegmentData.FXLightSegment) { // No particle segment data? return; } if(segment->segmentType != EFXS_LIGHT) { // Not a particle? return; } light = segment->SegmentData.FXLightSegment; effect = (fxLight_t *)malloc(sizeof(fxLight_t)); FX_LightInit((fxPrimitive_t *)effect); effect->culldist = flrand(light->cullrange[0], light->cullrange[1]); effect->culldist *= effect->culldist; // allows for VLSquared effect->startTime = fx_time + Q_irand(light->delay[0], light->delay[1]); effect->endTime = effect->startTime + Q_irand(light->life[0], light->life[1]); VectorCopy(origin, effect->origin); if((segment->spawnflags & FXSFLAG_CHEAPORIGINCALC)) { vec3_t offset; vecrandom(light->origin[0], light->origin[1], offset); VectorAdd(effect->origin, offset, effect->origin); } vecrandom(light->rgb.start.sv[0], light->rgb.start.sv[1], effect->startRGB); if(light->rgb.flags != 0 || !(light->rgb.flags & FXTLF_CONSTANT)) { vecrandom(light->rgb.end.ev[0], light->rgb.end.ev[1], effect->endRGB); } else { VectorCopy(effect->startRGB, effect->endRGB); } //effect->RGBflags = light->rgb.flags; VectorCopy(effect->startRGB, effect->RGB); effect->startsize = effect->size = flrand(light->size.start.sf[0], light->size.start.sf[1]); if(light->size.flags != 0 || !(light->size.flags & FXTLF_CONSTANT)) { // TODO: make the distinction between wave, clamp, nonlinear, etc effect->endsize = flrand(light->size.end.ef[0], light->size.end.ef[1]); } else { effect->endsize = effect->startsize; } //effect->sizeFlags = light->size.flags; FX_AddPrimitive((fxPrimitive_t *)effect, effect->startTime, effect->endTime); }
//------------------------- // FX_AddLight //------------------------- CLight *FX_AddLight( vec3_t org, float size1, float size2, float sizeParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, int killTime, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding effects when the system is paused return 0; } CLight *fx = new CLight; if ( fx ) { fx->SetOrigin1( org ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetFlags( flags ); FX_AddPrimitive( (CEffect**)&fx, killTime ); // in the editor, fx may now be NULL } return fx; }
//------------------------- // FX_AddTail //------------------------- CTail *FX_AddTail( vec3_t org, vec3_t vel, vec3_t accel, float size1, float size2, float sizeParm, float length1, float length2, float lengthParm, float alpha1, float alpha2, float alphaParm, vec3_t sRGB, vec3_t eRGB, float rgbParm, vec3_t min, vec3_t max, float elasticity, int deathID, int impactID, int killTime, qhandle_t shader, int flags = 0, EMatImpactEffect matImpactFX /*MATIMPACTFX_NONE*/, int fxParm /*-1*/, int iGhoul2/*0*/, int entNum/*-1*/, int modelNum/*-1*/, int boltNum/*-1*/ ) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding effects when the system is paused return 0; } CTail *fx = new CTail; if ( fx ) { if (flags&FX_RELATIVE && iGhoul2>0) { fx->SetOrigin1( NULL ); fx->SetOrgOffset( org ); fx->SetBoltinfo( iGhoul2, entNum, modelNum, boltNum ); } else { fx->SetOrigin1( org ); } fx->SetMatImpactFX(matImpactFX); fx->SetMatImpactParm(fxParm); fx->SetVel( vel ); fx->SetAccel( accel ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(sizeParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Length---------------- fx->SetLengthStart( length1 ); fx->SetLengthEnd( length2 ); if (( flags & FX_LENGTH_PARM_MASK ) == FX_LENGTH_WAVE ) { fx->SetLengthParm( lengthParm * PI * 0.001f ); } else if ( flags & FX_LENGTH_PARM_MASK ) { fx->SetLengthParm(lengthParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetFlags( flags ); fx->SetShader( shader ); fx->SetElasticity( elasticity ); fx->SetMin( min ); fx->SetMax( max ); fx->SetSTScale( 1.0f, 1.0f ); fx->SetDeathFxID( deathID ); fx->SetImpactFxID( impactID ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddElectricity //------------------------- CElectricity *FX_AddElectricity( vec3_t start, vec3_t end, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t sRGB, vec3_t eRGB, float rgbParm, float chaos, int killTime, qhandle_t shader, int flags = 0, EMatImpactEffect matImpactFX /*MATIMPACTFX_NONE*/, int fxParm /*-1*/, int iGhoul2/*0*/, int entNum/*-1*/, int modelNum/*-1*/, int boltNum/*-1*/ ) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding new effects when the system is paused return 0; } CElectricity *fx = new CElectricity; if ( fx ) { if (flags&FX_RELATIVE && iGhoul2>0) { fx->SetOrigin1( NULL ); fx->SetOrgOffset( start );//offset fx->SetVel( end ); //vel is the vector offset from bolt+orgOffset fx->SetBoltinfo( iGhoul2, entNum, modelNum, boltNum ); } else { fx->SetOrigin1( start ); fx->SetOrigin2( end ); } fx->SetMatImpactFX(matImpactFX); fx->SetMatImpactParm(fxParm); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(sizeParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetShader( shader ); fx->SetFlags( flags ); fx->SetChaos( chaos ); fx->SetSTScale( 1.0f, 1.0f ); FX_AddPrimitive( (CEffect**)&fx, killTime ); // in the editor, fx may now be NULL? if ( fx ) { fx->Initialize(); } } return fx; }
//------------------------- // FX_AddBezier //------------------------- CBezier *FX_AddBezier( vec3_t start, vec3_t end, vec3_t control1, vec3_t control1Vel, vec3_t control2, vec3_t control2Vel, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t sRGB, vec3_t eRGB, float rgbParm, int killTime, qhandle_t shader, int flags ) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding new effects when the system is paused return 0; } CBezier *fx = new CBezier; if ( fx ) { fx->SetOrigin1( start ); fx->SetOrigin2( end ); fx->SetControlPoints( control1, control2 ); fx->SetControlVel( control1Vel, control2Vel ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(sizeParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetShader( shader ); fx->SetFlags( flags ); fx->SetSTScale( 1.0f, 1.0f ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddFlash //------------------------- CFlash *FX_AddFlash( vec3_t origin, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t sRGB, vec3_t eRGB, float rgbParm, int killTime, qhandle_t shader, int flags, EMatImpactEffect matImpactFX /*MATIMPACTFX_NONE*/, int fxParm /*-1*/ ) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding new effects when the system is paused return 0; } if (!shader) { //yeah..this is bad, I guess, but SP seems to handle it by not drawing the flash, so I will too. assert(shader); return 0; } CFlash *fx = new CFlash; if ( fx ) { fx->SetMatImpactFX(matImpactFX); fx->SetMatImpactParm(fxParm); fx->SetOrigin1( origin ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(sizeParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetShader( shader ); fx->SetFlags( flags ); // fx->SetSTScale( 1.0f, 1.0f ); fx->Init(); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddPoly //------------------------- CPoly *FX_AddPoly( vec3_t *verts, vec2_t *st, int numVerts, vec3_t vel, vec3_t accel, float alpha1, float alpha2, float alphaParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, vec3_t rotationDelta, float bounce, int motionDelay, int killTime, qhandle_t shader, int flags ) { if ( theFxHelper.mFrameTime < 0 || !verts ) { // disallow adding effects when the system is paused or the user doesn't pass in a vert array return 0; } CPoly *fx = new CPoly; if ( fx ) { // Do a cheesy copy of the verts and texture coords into our own structure for ( int i = 0; i < numVerts; i++ ) { VectorCopy( verts[i], fx->mOrg[i] ); Vector2Copy( st[i], fx->mST[i] ); } fx->SetVel( vel ); fx->SetAccel( accel ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetFlags( flags ); fx->SetShader( shader ); fx->SetRot( rotationDelta ); fx->SetElasticity( bounce ); fx->SetMotionTimeStamp( motionDelay ); fx->SetNumVerts( numVerts ); // Now that we've set our data up, let's process it into a useful format fx->PolyInit(); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddLight //------------------------- CLight *FX_AddLight( vec3_t org, float size1, float size2, float sizeParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, int killTime, int flags = 0, EMatImpactEffect matImpactFX /*MATIMPACTFX_NONE*/, int fxParm /*-1*/, int iGhoul2/*0*/, int entNum/*-1*/, int modelNum/*-1*/, int boltNum/*-1*/) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding effects when the system is paused return 0; } CLight *fx = new CLight; if ( fx ) { if (flags&FX_RELATIVE && iGhoul2>0) { fx->SetOrigin1( NULL ); fx->SetOrgOffset( org );//offset fx->SetBoltinfo( iGhoul2, entNum, modelNum, boltNum ); } else { fx->SetOrigin1( org ); } fx->SetMatImpactFX(matImpactFX); fx->SetMatImpactParm(fxParm); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(sizeParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetFlags( flags ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddElectricity //------------------------- CElectricity *FX_AddElectricity( vec3_t start, vec3_t end, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t sRGB, vec3_t eRGB, float rgbParm, float chaos, int killTime, qhandle_t shader, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding new effects when the system is paused return 0; } CElectricity *fx = new CElectricity; if ( fx ) { fx->SetOrigin1( start ); fx->SetOrigin2( end ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetShader( shader ); fx->SetFlags( flags ); fx->SetChaos( chaos ); fx->SetSTScale( 1.0f, 1.0f ); FX_AddPrimitive( (CEffect**)&fx, killTime ); // in the editor, fx may now be NULL? if ( fx ) { fx->Initialize(); } } return fx; }
//------------------------- // FX_AddLine //------------------------- CLine *FX_AddLine( int clientID, vec3_t start, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t sRGB, vec3_t eRGB, float rgbParm, int killTime, qhandle_t shader, int impactFX_id, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding new effects when the system is paused return 0; } CLine *fx = new CLine; if ( fx ) { fx->SetOrgOffset( start ); fx->SetOrigin1( NULL ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetShader( shader ); fx->SetFlags( flags ); fx->SetSTScale( 1.0f, 1.0f ); fx->SetClient( clientID ); fx->SetImpactFxID( impactFX_id ); FX_AddPrimitive( (CEffect**)&fx, killTime ); // in the editor, fx may now be NULL } return fx; }
//------------------------- // FX_AddParticle //------------------------- CParticle *FX_AddParticle( int clientID, const vec3_t org, const vec3_t vel, const vec3_t accel, float gravity, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, const vec3_t rgb1, const vec3_t rgb2, float rgbParm, float rotation, float rotationDelta, int killTime, qhandle_t shader, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding effects when the system is paused return 0; } CParticle *fx = new CParticle; if ( fx ) { fx->SetOrigin1( NULL ); fx->SetOrgOffset( org ); fx->SetVel( vel ); fx->SetAccel( accel ); fx->SetGravity( gravity ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetFlags( flags ); fx->SetShader( shader ); fx->SetRotation( rotation ); fx->SetRotationDelta( rotationDelta ); fx->SetElasticity( 0.0f ); fx->SetMin( NULL ); fx->SetMax( NULL ); fx->SetClient( clientID ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddParticle //------------------------- CParticle *FX_AddParticle( const vec3_t org, const vec3_t vel, const vec3_t accel, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, const vec3_t sRGB, const vec3_t eRGB, float rgbParm, float rotation, float rotationDelta, const vec3_t min, const vec3_t max, float elasticity, int deathID, int impactID, int killTime, qhandle_t shader, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding effects when the system is paused return 0; } CParticle *fx = new CParticle; if ( fx ) { fx->SetOrigin1( org ); fx->SetVel( vel ); fx->SetAccel( accel ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetFlags( flags ); fx->SetShader( shader ); fx->SetRotation( rotation ); fx->SetRotationDelta( rotationDelta ); fx->SetElasticity( elasticity ); fx->SetMin( min ); fx->SetMax( max ); fx->SetDeathFxID( deathID ); fx->SetImpactFxID( impactID ); FX_AddPrimitive( (CEffect**)&fx, killTime ); // in the editor, fx may now be NULL } return fx; }
//------------------------- // FX_AddFlash //------------------------- CFlash *FX_AddFlash( vec3_t origin, vec3_t sRGB, vec3_t eRGB, float rgbParm, int killTime, qhandle_t shader, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding new effects when the system is paused return 0; } CFlash *fx = new CFlash; if ( fx ) { fx->SetOrigin1( origin ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } /* // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } */ fx->SetShader( shader ); fx->SetFlags( flags ); // fx->SetSTScale( 1.0f, 1.0f ); fx->Init(); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddEmitter //------------------------- CEmitter *FX_AddEmitter( vec3_t org, vec3_t vel, vec3_t accel, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, vec3_t angs, vec3_t deltaAngs, vec3_t min, vec3_t max, float elasticity, int deathID, int impactID, int emitterID, float density, float variance, int killTime, qhandle_t model, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding effects when the system is paused return 0; } CEmitter *fx = new CEmitter; if ( fx ) { fx->SetOrigin1( org ); fx->SetVel( vel ); fx->SetAccel( accel ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetAngles( angs ); fx->SetAngleDelta( deltaAngs ); fx->SetFlags( flags ); fx->SetModel( model ); fx->SetElasticity( elasticity ); fx->SetMin( min ); fx->SetMax( max ); fx->SetDeathFxID( deathID ); fx->SetImpactFxID( impactID ); fx->SetEmitterFxID( emitterID ); fx->SetDensity( density ); fx->SetVariance( variance ); fx->SetOldTime( theFxHelper.mTime ); fx->SetLastOrg( org ); fx->SetLastVel( vel ); FX_AddPrimitive( (CEffect**)&fx, killTime ); // in the editor, fx may now be NULL } return fx; }
//------------------------- // FX_AddCylinder //------------------------- CCylinder *FX_AddCylinder( vec3_t start, vec3_t normal, float size1s, float size1e, float size1Parm, float size2s, float size2e, float size2Parm, float length1, float length2, float lengthParm, float alpha1, float alpha2, float alphaParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, int killTime, qhandle_t shader, int flags, EMatImpactEffect matImpactFX /*MATIMPACTFX_NONE*/, int fxParm /*-1*/, int iGhoul2/*0*/, int entNum/*-1*/, int modelNum/*-1*/, int boltNum/*-1*/, qboolean traceEnd) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding new effects when the system is paused return 0; } CCylinder *fx = new CCylinder; if ( fx ) { if (flags&FX_RELATIVE && iGhoul2>0) { fx->SetOrigin1( NULL ); fx->SetOrgOffset( start );//offset fx->SetBoltinfo( iGhoul2, entNum, modelNum, boltNum ); } else { fx->SetOrigin1( start ); } fx->SetTraceEnd(traceEnd); fx->SetMatImpactFX(matImpactFX); fx->SetMatImpactParm(fxParm); fx->SetOrigin1( start ); fx->SetNormal( normal ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size1---------------- fx->SetSizeStart( size1s ); fx->SetSizeEnd( size1e ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( size1Parm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(size1Parm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size2---------------- fx->SetSize2Start( size2s ); fx->SetSize2End( size2e ); if (( flags & FX_SIZE2_PARM_MASK ) == FX_SIZE2_WAVE ) { fx->SetSize2Parm( size2Parm * PI * 0.001f ); } else if ( flags & FX_SIZE2_PARM_MASK ) { fx->SetSize2Parm(size2Parm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Length1--------------- fx->SetLengthStart( length1 ); fx->SetLengthEnd( length2 ); if (( flags & FX_LENGTH_PARM_MASK ) == FX_LENGTH_WAVE ) { fx->SetLengthParm( lengthParm * PI * 0.001f ); } else if ( flags & FX_LENGTH_PARM_MASK ) { fx->SetLengthParm(lengthParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetShader( shader ); fx->SetFlags( flags ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddTail //------------------------- CTail *FX_AddTail( int clientID, vec3_t org, vec3_t vel, vec3_t accel, float size1, float size2, float sizeParm, float length1, float length2, float lengthParm, float alpha1, float alpha2, float alphaParm, vec3_t sRGB, vec3_t eRGB, float rgbParm, vec3_t min, vec3_t max, float elasticity, int deathID, int impactID, int killTime, qhandle_t shader, int flags = 0 ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding effects when the system is paused return 0; } CTail *fx = new CTail; if ( fx ) { fx->SetOrigin1( NULL ); fx->SetOrgOffset( org ); fx->SetVel( vel ); fx->SetAccel( accel ); // RGB---------------- fx->SetRGBStart( sRGB ); fx->SetRGBEnd( eRGB ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } // Length---------------- fx->SetLengthStart( length1 ); fx->SetLengthEnd( length2 ); if (( flags & FX_LENGTH_PARM_MASK ) == FX_LENGTH_WAVE ) { fx->SetLengthParm( lengthParm * PI * 0.001f ); } else if ( flags & FX_LENGTH_PARM_MASK ) { fx->SetLengthParm( lengthParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetFlags( flags ); fx->SetShader( shader ); fx->SetElasticity( elasticity ); fx->SetMin( min ); fx->SetMax( max ); fx->SetSTScale( 1.0f, 1.0f ); fx->SetDeathFxID( deathID ); fx->SetImpactFxID( impactID ); fx->SetClient( clientID ); FX_AddPrimitive( (CEffect**)&fx, killTime ); // in the editor, fx may now be NULL } return fx; }
//------------------------- // FX_AddEmitter //------------------------- CEmitter *FX_AddEmitter( vec3_t org, vec3_t vel, vec3_t accel, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, vec3_t angs, vec3_t deltaAngs, vec3_t min, vec3_t max, float elasticity, int deathID, int impactID, int emitterID, float density, float variance, int killTime, qhandle_t model, int flags = 0, EMatImpactEffect matImpactFX /*MATIMPACTFX_NONE*/, int fxParm /*-1*/, int iGhoul2/*0*/, int entNum/*-1*/, int modelNum/*-1*/, int boltNum/*-1*/ ) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding effects when the system is paused return 0; } CEmitter *fx = new CEmitter; if ( fx ) { if (flags&FX_RELATIVE && iGhoul2>0) { assert(0);//not done // fx->SetBoltinfo( iGhoul2, entNum, modelNum, boltNum ); } fx->SetMatImpactFX(matImpactFX); fx->SetMatImpactParm(fxParm); fx->SetOrigin1( org ); fx->SetVel( vel ); fx->SetAccel( accel ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(sizeParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetAngles( angs ); fx->SetAngleDelta( deltaAngs ); fx->SetFlags( flags ); fx->SetModel( model ); fx->SetElasticity( elasticity ); fx->SetMin( min ); fx->SetMax( max ); fx->SetDeathFxID( deathID ); fx->SetImpactFxID( impactID ); fx->SetEmitterFxID( emitterID ); fx->SetDensity( density ); fx->SetVariance( variance ); fx->SetOldTime( theFxHelper.mTime ); fx->SetLastOrg( org ); fx->SetLastVel( vel ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddCylinder //------------------------- CCylinder *FX_AddCylinder( vec3_t start, vec3_t normal, float size1s, float size1e, float sizeParm, float size2s, float size2e, float size2Parm, float length1, float length2, float lengthParm, float alpha1, float alpha2, float alphaParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, int killTime, qhandle_t shader, int flags ) { if ( theFxHelper.mFrameTime < 1 ) { // disallow adding new effects when the system is paused return 0; } CCylinder *fx = new CCylinder; if ( fx ) { fx->SetOrigin1( start ); fx->SetNormal( normal ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm( rgbParm * 0.01f * killTime + theFxHelper.mTime ); } // Size1---------------- fx->SetSizeStart( size1s ); fx->SetSizeEnd( size1e ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm( sizeParm * 0.01f * killTime + theFxHelper.mTime ); } // Size2---------------- fx->SetSize2Start( size2s ); fx->SetSize2End( size2e ); if (( flags & FX_SIZE2_PARM_MASK ) == FX_SIZE2_WAVE ) { fx->SetSize2Parm( size2Parm * PI * 0.001f ); } else if ( flags & FX_SIZE2_PARM_MASK ) { fx->SetSize2Parm( size2Parm * 0.01f * killTime + theFxHelper.mTime ); } // Length1--------------- fx->SetLengthStart( length1 ); fx->SetLengthEnd( length2 ); if (( flags & FX_LENGTH_PARM_MASK ) == FX_LENGTH_WAVE ) { fx->SetLengthParm( lengthParm * PI * 0.001f ); } else if ( flags & FX_LENGTH_PARM_MASK ) { fx->SetLengthParm( lengthParm * 0.01f * killTime + theFxHelper.mTime ); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm( alphaParm * 0.01f * killTime + theFxHelper.mTime ); } fx->SetShader( shader ); fx->SetFlags( flags ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
//------------------------- // FX_AddOrientedParticle //------------------------- COrientedParticle *FX_AddOrientedParticle( vec3_t org, vec3_t norm, vec3_t vel, vec3_t accel, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, vec3_t rgb1, vec3_t rgb2, float rgbParm, float rotation, float rotationDelta, vec3_t min, vec3_t max, float bounce, int deathID, int impactID, int killTime, qhandle_t shader, int flags = 0, EMatImpactEffect matImpactFX /*MATIMPACTFX_NONE*/, int fxParm /*-1*/, int iGhoul2/*0*/, int entNum/*-1*/, int modelNum/*-1*/, int boltNum/*-1*/ ) { if ( theFxHelper.mFrameTime < 0 ) { // disallow adding effects when the system is paused return 0; } COrientedParticle *fx = new COrientedParticle; if ( fx ) { if (flags&FX_RELATIVE && iGhoul2>0) { fx->SetOrigin1( NULL ); fx->SetOrgOffset( org );//offset fx->SetBoltinfo( iGhoul2, entNum, modelNum, boltNum ); } else { fx->SetOrigin1( org ); } fx->SetMatImpactFX(matImpactFX); fx->SetMatImpactParm(fxParm); fx->SetOrigin1( org ); fx->SetNormal( norm ); fx->SetVel( vel ); fx->SetAccel( accel ); // RGB---------------- fx->SetRGBStart( rgb1 ); fx->SetRGBEnd( rgb2 ); if (( flags & FX_RGB_PARM_MASK ) == FX_RGB_WAVE ) { fx->SetRGBParm( rgbParm * PI * 0.001f ); } else if ( flags & FX_RGB_PARM_MASK ) { // rgbParm should be a value from 0-100.. fx->SetRGBParm(rgbParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Alpha---------------- fx->SetAlphaStart( alpha1 ); fx->SetAlphaEnd( alpha2 ); if (( flags & FX_ALPHA_PARM_MASK ) == FX_ALPHA_WAVE ) { fx->SetAlphaParm( alphaParm * PI * 0.001f ); } else if ( flags & FX_ALPHA_PARM_MASK ) { fx->SetAlphaParm(alphaParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } // Size---------------- fx->SetSizeStart( size1 ); fx->SetSizeEnd( size2 ); if (( flags & FX_SIZE_PARM_MASK ) == FX_SIZE_WAVE ) { fx->SetSizeParm( sizeParm * PI * 0.001f ); } else if ( flags & FX_SIZE_PARM_MASK ) { fx->SetSizeParm(sizeParm * 0.01f * killTime + theFxHelper.mTime + theFxHelper.mTimeFraction); } fx->SetFlags( flags ); fx->SetShader( shader ); fx->SetRotation( rotation ); fx->SetRotationDelta( rotationDelta ); fx->SetElasticity( bounce ); fx->SetMin( min ); fx->SetMax( max ); fx->SetDeathFxID( deathID ); fx->SetImpactFxID( impactID ); FX_AddPrimitive( (CEffect**)&fx, killTime ); } return fx; }
void FX_CreateParticle(const FXSegment_t *segment, vec3_t origin, vec3_t dir) { FXParticleSegment_t *particle; fxParticle_t *effect; if(!segment) { // NULL segment pointer? return; } if(!segment->SegmentData.FXParticleSegment) { // No particle segment data? return; } if(segment->segmentType != EFXS_PARTICLE) { // Not a particle? return; } particle = segment->SegmentData.FXParticleSegment; effect = (fxParticle_t *)malloc(sizeof(fxParticle_t)); FX_ParticleInit((fxPrimitive_t *)effect); effect->culldist = flrand(particle->cullrange[0], particle->cullrange[1]); effect->culldist *= effect->culldist; // allows for VLSquared effect->startTime = fx_time + Q_irand(particle->delay[0], particle->delay[1]); effect->endTime = effect->startTime + Q_irand(particle->life[0], particle->life[1]); effect->flags = segment->flags; VectorCopy(origin, effect->origin); //if((segment->spawnflags & FXSFLAG_CHEAPORIGINCALC)) { vec3_t offset; vecrandom(particle->origin[0], particle->origin[1], offset); VectorAdd(effect->origin, offset, effect->origin); } vecrandom(particle->rgb.start.sv[0], particle->rgb.start.sv[1], effect->startRGB); if(particle->rgb.flags != 0 || !(particle->rgb.flags & FXTLF_CONSTANT)) { vecrandom(particle->rgb.end.ev[0], particle->rgb.end.ev[1], effect->endRGB); } else { VectorCopy(effect->startRGB, effect->endRGB); } //effect->RGBflags = light->rgb.flags; VectorCopy(effect->startRGB, effect->RGB); effect->startsize = effect->size = flrand(particle->size.start.sf[0], particle->size.start.sf[1]); if(particle->size.flags != 0 || !(particle->size.flags & FXTLF_CONSTANT)) { // TODO: make the distinction between wave, clamp, nonlinear, etc effect->endsize = flrand(particle->size.end.ef[0], particle->size.end.ef[1]); } else { effect->endsize = effect->startsize; } //effect->sizeFlags = light->size.flags; effect->startalpha = effect->alpha = flrand(particle->alpha.start.sf[0], particle->alpha.start.sf[1]); if(particle->alpha.flags != 0 || !(particle->alpha.flags & FXTLF_CONSTANT)) { // TODO: make the distinction between wave, clamp, nonlinear, etc effect->endalpha = flrand(particle->alpha.end.ef[0], particle->alpha.end.ef[1]); } else { effect->endalpha = effect->startalpha; } //effect->alphaFlags = particle->alpha.flags; effect->startrotation = effect->rotation = flrand(particle->rotation[0], particle->rotation[1]); effect->deltarotation = flrand(particle->rotationDelta[0], particle->rotationDelta[1]); vecrandom(particle->velocity[0], particle->velocity[1], effect->velocity); vecrandom(particle->acceleration[0], particle->acceleration[1], effect->accel); effect->shader = particle->shader.fieldHandles[Q_irand(0, particle->shader.numFields-1)]; FX_AddPrimitive((fxPrimitive_t *)effect, effect->startTime, effect->endTime); }