void FX_GrenadeAltThink( centity_t *cent, const struct weaponInfo_s *weapon ) { vec3_t dir, org; VectorCopy( cent->gent->s.pos.trDelta, dir ); VectorNormalize( dir ); // Move away from the ent origin so that the glow doesn't clip into the model so much. VectorMA( cent->lerpOrigin, 1.4, dir, org ); FX_AddQuad( org, dir, NULL, NULL, 12.0f + random() * 32.0f, 0.0f, 0.75f, 0.75f, 0, 0, 0.0f, 1, cgs.media.dkorangeParticleShader ); if ( rand() & 1 ) FX_AddQuad( org, dir, NULL, NULL, 28.0f + random() * 32.0f, 0.0f, 0.5f, 0.5f, 0, 0, 0.0f, 1, cgs.media.yellowParticleShader ); if ( cent->gent ) { vec3_t rgb = { 1.0f, 1.0f, 0.4f }, rgb2 = { 1.0f, 0.5f, 0.0f }; // This flag controls whether or not the thing was initial fire, or shrapnel if ( cent->gent->trigger_formation ) // Shot from first person so beef it up a bit... FX_AddLine( cent->lerpOrigin, cent->gent->pos2, 1.0f, 4.0f, 8.0f, 0.7f, 0.1f, rgb, rgb2, 200, cgs.media.whiteLaserShader ); else FX_AddLine( cent->lerpOrigin, cent->gent->pos2, 1.0f, 16.0f, 4.0f, 0.2f, 0.1f, rgb, rgb2, 100, cgs.media.whiteLaserShader ); VectorCopy( cent->lerpOrigin, cent->gent->pos2 ); } }
void FX_DisruptorMainShot( vec3_t start, vec3_t end ) { FX_AddLine( start, end, 0.1f, 4.0f, 0.0f, 1.0f, 0.0f, 0.0f, WHITE, WHITE, 0.0f, 120, cgi_R_RegisterShader( "gfx/effects/redLine" ), FX_SIZE_LINEAR | FX_ALPHA_LINEAR ); }
/* ------------------------- FX_ProtonAltShot ------------------------- */ void FX_ProtonAltShot( vec3_t start, vec3_t end ) { float length = 20; vec3_t white = {1.0,1.0,1.0}; vec3_t dir; FX_AddLine( start, end, 1.0f, 4.0f, -8.0f, 1.0f, 1.0f, white, white, 325.0f, cgs.media.whiteLaserShader ); FX_AddLine( start, end, 1.0f, 2.0f, -1.0f, 1.0f, 0.2f, white, white, 300.0f, cgs.media.whiteLaserShader ); VectorSubtract( end, start, dir ); length = VectorNormalize( dir ); FXCylinder *fx = FX_AddCylinder( start, dir, length, 0, 1, 3, 1, 3, 0.6f, 0.1f, 500 , cgs.media.protonAltBeamShader, 0.2f ); if( fx ) { fx->SetFlags( FXF_WRAP | FXF_STRETCH ); fx->SetSTScale( length / 56.0f ); } fx = FX_AddCylinder( start, dir, length, 0, 2, 5, 2, 5, 0.3f, 0.0, 600, cgs.media.protonAltBeamShader, 0.5f ); if( fx ) { fx->SetFlags( FXF_WRAP | FXF_STRETCH ); fx->SetSTScale( length / 128.0f ); } }
void FX_ProtonShot( vec3_t start, vec3_t end ) { float length, repeat; vec3_t dir; VectorSubtract( end, start, dir ); length = VectorNormalize( dir ); // thin inner line FX_AddLine( end, start, 1.0f, 2.0f, -3.0f, 1.0f, 0.0f, 350.0f, cgs.media.whiteLaserShader ); // thick outer glow FX_AddLine( end, start, 1.0f, 4.0f, 0.0f, 0.4f, 0.0f, 250.0f, cgs.media.whiteLaserShader ); // concentric rings FXCylinder *fx = FX_AddCylinder( start, dir, length, 0, 1.0f, 3.0f, 1.0f, 2.0f, 0.4f, 0.0f, 300, cgs.media.protonBeamShader, 0.5f ); FX_AddSprite( end, NULL, NULL, 5, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); FX_AddSprite( end, NULL, NULL, 3, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); FX_AddSprite( end, NULL, NULL, 2, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); FX_AddSprite( end, NULL, NULL, 1, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); if( fx ) { repeat = length / 12.0f; fx->SetFlags( FXF_WRAP | FXF_STRETCH | FXF_NON_LINEAR_FADE ); fx->SetSTScale( repeat ); } // FX_ProtonShockRing( start, end ); }
void FX_ConcAltShot( vec3_t start, vec3_t end ) { //"concussion/beam" FX_AddLine( -1, start, end, 0.1f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, WHITE, WHITE, 0.0f, 175, cgi_R_RegisterShader( "gfx/effects/blueLine" ), 0, FX_SIZE_LINEAR | FX_ALPHA_LINEAR ); vec3_t BRIGHT={0.75f,0.5f,1.0f}; // add some beef FX_AddLine( -1, start, end, 0.1f, 7.0f, 0.0f, 1.0f, 0.0f, 0.0f, BRIGHT, BRIGHT, 0.0f, 150, cgi_R_RegisterShader( "gfx/misc/whiteline2" ), 0, FX_SIZE_LINEAR | FX_ALPHA_LINEAR ); }
//--------------------------------------------------- void FX_AddLine( vec3_t start, vec3_t end, float stScale, float width, float dwidth, float sAlpha, float eAlpha, int life, qhandle_t shader, int flags ) { FX_AddLine( start, end, width, width, 0, sAlpha, eAlpha, FX_ALPHA_LINEAR, WHITE, WHITE, 0, life, shader, 0 ); }
//--------------------------------------------------- void FX_AddLine( vec3_t start, vec3_t end, float stScale, float width, float dwidth, float sAlpha, float eAlpha, vec3_t sRGB, vec3_t eRGB, int life, qhandle_t shader, int flags ) { FX_AddLine( -1, start, end, width, width, 0, sAlpha, eAlpha, FX_ALPHA_LINEAR, sRGB, eRGB, 0, life, shader, 0, flags ); }
/* --------------------------- FX_DisruptorAltShot --------------------------- */ void FX_DisruptorAltShot( vec3_t start, vec3_t end, qboolean fullCharge ) { FX_AddLine( start, end, 0.1f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, WHITE, WHITE, 0.0f, 175, cgi_R_RegisterShader( "gfx/effects/redLine" ), FX_SIZE_LINEAR | FX_ALPHA_LINEAR ); if ( fullCharge ) { vec3_t YELLER={0.8f,0.7f,0.0f}; // add some beef FX_AddLine( start, end, 0.1f, 7.0f, 0.0f, 1.0f, 0.0f, 0.0f, YELLER, YELLER, 0.0f, 150, cgi_R_RegisterShader( "gfx/misc/whiteline2" ), FX_SIZE_LINEAR | FX_ALPHA_LINEAR ); } }
/* ------------------------- FX_Disruptor ------------------------- */ void DisruptorShards(vec3_t org) { vec3_t normal, end; // Pick a random endpoint VectorSet( normal, crandom(), crandom(), crandom() ); VectorNormalize( normal ); end[0] = org[0] + ( normal[0] * ( 48 + crandom() * 16 )); end[1] = org[1] + ( normal[1] * ( 48 + crandom() * 16 )); end[2] = org[2] + ( normal[2] * ( 64 + crandom() * 24 )); // Draw a light shard, use a couple of different kinds so it doesn't look too homogeneous if( rand() & 1 ) { FX_AddLine( org, end, 1.0, random() * 0.5 + 0.5, 12.0, random() * 0.1 + 0.1, 0.0, 200 + random() * 350, cgs.media.orangeParticleShader ); } else { FX_AddLine( org, end, 1.0, random() * 0.5 + 0.5, 12.0, random() * 0.1 + 0.1, 0.0, 200 + random() * 350, cgs.media.yellowParticleShader ); } }
// Effect used when scav beams in--this wouldn't work well for a scav on the ground if they were to beam out void FX_Disruptor( vec3_t org, float length ) {//FIXME: make it move with owner? vec3_t org1, org2, normal={0,0,1}; int t; VectorMA( org, 48, normal, org1 ); VectorMA( org, -48, normal, org2 ); // This is the core FX_AddLine( org1, org2, 1.0, 0.1, 48.0, 1.0, 0.0, length, cgs.media.dkorangeParticleShader ); // Spawn a bunch to get the effect going for (t=0; t < 12; t++ ) { DisruptorShards( org); } // Keep spawning the light shards for a while. FX_AddSpawner( org, normal, NULL, NULL, qfalse, 20, 10, length*0.75, MakeDisruptorShard, 0); }
void FX_BlowBits( vec3_t start, vec3_t end, vec3_t dir, vec3_t user ) { vec3_t diff, org; float len; FXLine *fx; VectorSubtract( end, start, diff ); len = VectorNormalize( diff ) * ( 0.2 + random() * 0.3 ); VectorMA( start, len, diff, org ); fx = FX_AddLine( end, start, (int)(random() * 3.2f), 2.0f + random() * 2, 0, 0.5f, 0.1f, 150 + random() * 150, cgs.media.orangeTrailShader ); if ( fx == NULL ) return; fx->SetFlags( FXF_SHRINK ); FX_AddQuad( end, dir, NULL, NULL, 1.0f, 64.0f, 1.0, 0.0, random() * 360.0f, 0.0f, 0.0, 200, cgs.media.orangeRingShader ); // FX_AddQuad( end, dir, NULL, NULL, 20.0, -15.0, 0.6, 0.4, 0.0,0.0,0.0,450, cgs.media.borgEyeFlareShader ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void C_WaterExplosionEffect::CreateCore( void ) { if ( m_fFlags & TE_EXPLFLAG_NOFIREBALL ) return; // Get our lighting information for the water surface Vector color; float luminosity; FX_GetSplashLighting( m_vecWaterSurface + Vector( 0, 0, 8 ), &color, &luminosity ); float lifetime = random->RandomFloat( 0.8f, 1.0f ); // Ground splash FX_AddQuad( m_vecWaterSurface + Vector(0,0,2), Vector(0,0,1), 64, 64 * 4.0f, 0.85f, luminosity, 0.0f, 0.25f, random->RandomInt( 0, 360 ), random->RandomFloat( -4, 4 ), color, 2.0f, "effects/splashwake1", (FXQUAD_BIAS_SCALE|FXQUAD_BIAS_ALPHA) ); Vector vRight, vUp; VectorVectors( Vector(0,0,1) , vRight, vUp ); Vector start, end; float radius = 50.0f; unsigned int flags; // Base vertical shaft FXLineData_t lineData; start = m_vecWaterSurface; end = start + ( Vector( 0, 0, 1 ) * random->RandomFloat( radius, radius*1.5f ) ); if ( random->RandomInt( 0, 1 ) ) { flags |= FXSTATICLINE_FLIP_HORIZONTAL; } else { flags = 0; } lineData.m_flDieTime = lifetime * 0.5f; lineData.m_flStartAlpha= luminosity; lineData.m_flEndAlpha = 0.0f; lineData.m_flStartScale = radius*0.5f; lineData.m_flEndScale = radius*2; lineData.m_pMaterial = materials->FindMaterial( "effects/splash3", 0, 0 ); lineData.m_vecStart = start; lineData.m_vecStartVelocity = vec3_origin; lineData.m_vecEnd = end; lineData.m_vecEndVelocity = Vector(0,0,random->RandomFloat( 650, 750 )); FX_AddLine( lineData ); // Inner filler shaft start = m_vecWaterSurface; end = start + ( Vector(0,0,1) * random->RandomFloat( 32, 64 ) ); if ( random->RandomInt( 0, 1 ) ) { flags |= FXSTATICLINE_FLIP_HORIZONTAL; } else { flags = 0; } lineData.m_flDieTime = lifetime * 0.5f; lineData.m_flStartAlpha= luminosity; lineData.m_flEndAlpha = 0.0f; lineData.m_flStartScale = radius; lineData.m_flEndScale = radius*2; lineData.m_pMaterial = materials->FindMaterial( "effects/splash3", 0, 0 ); lineData.m_vecStart = start; lineData.m_vecStartVelocity = vec3_origin; lineData.m_vecEnd = end; lineData.m_vecEndVelocity = Vector(0,0,1) * random->RandomFloat( 64, 128 ); FX_AddLine( lineData ); }
//----------------------------------------------------------------------------- // Purpose: // Input : &data - //----------------------------------------------------------------------------- void AR2ExplosionCallback( const CEffectData &data ) { float lifetime = random->RandomFloat( 0.4f, 0.75f ); // Ground splash FX_AddQuad( data.m_vOrigin, data.m_vNormal, data.m_flRadius, data.m_flRadius * 4.0f, 0.85f, 1.0f, 0.0f, 0.25f, random->RandomInt( 0, 360 ), random->RandomFloat( -4, 4 ), Vector( 1.0f, 1.0f, 1.0f ), lifetime, "effects/combinemuzzle1", (FXQUAD_BIAS_SCALE|FXQUAD_BIAS_ALPHA) ); Vector vRight, vUp; VectorVectors( data.m_vNormal, vRight, vUp ); Vector start, end; float radius = data.m_flRadius * 0.15f; // Base vertical shaft FXLineData_t lineData; start = data.m_vOrigin; end = start + ( data.m_vNormal * random->RandomFloat( radius*2.0f, radius*4.0f ) ); lineData.m_flDieTime = lifetime; lineData.m_flStartAlpha= 1.0f; lineData.m_flEndAlpha = 0.0f; lineData.m_flStartScale = radius*4; lineData.m_flEndScale = radius*5; lineData.m_pMaterial = materials->FindMaterial( "effects/ar2ground2", 0, 0 ); lineData.m_vecStart = start; lineData.m_vecStartVelocity = vec3_origin; lineData.m_vecEnd = end; lineData.m_vecEndVelocity = data.m_vNormal * random->RandomFloat( 200, 350 ); FX_AddLine( lineData ); // Inner filler shaft start = data.m_vOrigin; end = start + ( data.m_vNormal * random->RandomFloat( 16, radius*0.25f ) ); lineData.m_flDieTime = lifetime - 0.1f; lineData.m_flStartAlpha= 1.0f; lineData.m_flEndAlpha = 0.0f; lineData.m_flStartScale = radius*2; lineData.m_flEndScale = radius*4; lineData.m_pMaterial = materials->FindMaterial( "effects/ar2ground2", 0, 0 ); lineData.m_vecStart = start; lineData.m_vecStartVelocity = vec3_origin; lineData.m_vecEnd = end; lineData.m_vecEndVelocity = data.m_vNormal * random->RandomFloat( 64, 128 ); FX_AddLine( lineData ); }
static void CGFX_AddLine( 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, int killTime, qhandle_t shader, int flags ) { FX_AddLine( start, end, size1, size2, sizeParm, alpha1, alpha2, alphaParm, sRGB, eRGB, rgbParm, killTime, shader, flags ); }
void FX_8472Teleport( vec3_t org, int parm ) { int i, t; vec3_t dir = {0,0,1}, start, end, vel, color; if ( parm ) { // Beaming out for ( i = 0; i < 32; i++ ) { // Pick a random direction.. VectorSet( dir, crandom(), crandom(), crandom() ); VectorNormalize( dir ); start[0] = org[0] + dir[0] * 26; start[1] = org[1] + dir[1] * 26; start[2] = org[2] + fabs(dir[2] * 10) - 18; // Now build the velocity vector vel[0] = dir[0] * 8; vel[1] = dir[1] * 8; vel[2] = dir[2] * 6; FX_AddSprite( start, vel, NULL, 24 + random() * 8, -18, 1.0, 0.0, crandom()*180,0, 1000, cgs.media.portalFlareShader, FXF_NON_LINEAR_FADE ); } cgi_S_StartSound( org, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.speciesBeamoutSound ); } else { // Beaming in VectorMA( org, 65, dir, start ); VectorMA( org, -40, dir, end ); FX_AddLine( start, end, 1.0f, 0.5f, 48.0f, 0.4f, 0.1f, 1500, cgs.media.speciesPortalShader, FXF_NON_LINEAR_FADE ); for ( i = -1; i <= 1; i++ ) { VectorCopy( org, start ); start[2] += 10.0f + i * 16.0f; for ( t = -1; t <= 1; t++ ) { // create a 3 x 3 grid of starting points for the effect VectorClear( vel ); VectorMA( vel, t * 16, cg.refdef.viewaxis[1], vel ); FX_AddSprite( start, vel, NULL, 56.0f, -10.0f, 0.3f, 0.0f, -90.0f, 0, 1800, cgs.media.portalFlareShader, FXF_NON_LINEAR_FADE ); } } cgi_S_StartSound( org, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.speciesBeaminSound ); } VectorSet( color, 1.0f, 1.0f, 0.7f ); CG_AddTempLight( org, 200, color, 1000 ); }
static void CGFX_AddLine( const vec3_t start, const vec3_t end, float size1, float size2, float sizeParm, float alpha1, float alpha2, float alphaParm, const vec3_t sRGB, const vec3_t eRGB, float rgbParm, int killTime, qhandle_t shader, int flags ) { FX_AddLine( const_cast<float *>(start), const_cast<float *>(end), size1, size2, sizeParm, alpha1, alpha2, alphaParm, const_cast<float *>(sRGB), const_cast<float *>(eRGB), rgbParm, killTime, shader, flags ); }