//----------------------------------------------------------------------------- // Purpose: // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CCrossbowBolt::CreateSprites( void ) { // Start up the eye glow m_pGlowSprite = CSprite::SpriteCreate( "sprites/light_glow02_noz.vmt", GetLocalOrigin(), false ); if ( m_pGlowSprite != NULL ) { m_pGlowSprite->FollowEntity( this ); m_pGlowSprite->SetTransparency( kRenderGlow, 255, 255, 255, 128, kRenderFxNoDissipation ); m_pGlowSprite->SetScale( 0.2f ); m_pGlowSprite->TurnOff(); } m_pGlowTrail = CSpriteTrail::SpriteTrailCreate("sprites/light_glow02_noz.vmt", GetLocalOrigin(), false); if (m_pGlowTrail != NULL) { m_pGlowTrail->FollowEntity(this); m_pGlowTrail->SetTransparency(kRenderGlow, 255, 255, 255, 128, kRenderFxNoDissipation); m_pGlowTrail->SetScale(0.2f); m_pGlowTrail->TurnOff(); } return true; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CGrenadeFrag::CreateEffects( void ) { // Start up the eye glow m_pMainGlow = CSprite::SpriteCreate( "sprites/redglow1.vmt", GetLocalOrigin(), false ); int nAttachment = LookupAttachment( "fuse" ); if ( m_pMainGlow != NULL ) { m_pMainGlow->FollowEntity( this ); m_pMainGlow->SetAttachment( this, nAttachment ); m_pMainGlow->SetTransparency( kRenderGlow, 255, 255, 255, 200, kRenderFxNoDissipation ); m_pMainGlow->SetScale( 0.2f ); m_pMainGlow->SetGlowProxySize( 4.0f ); } // Start up the eye trail m_pGlowTrail = CSpriteTrail::SpriteTrailCreate( "sprites/bluelaser1.vmt", GetLocalOrigin(), false ); if ( m_pGlowTrail != NULL ) { m_pGlowTrail->FollowEntity( this ); m_pGlowTrail->SetAttachment( this, nAttachment ); m_pGlowTrail->SetTransparency( kRenderTransAdd, 255, 0, 0, 255, kRenderFxNone ); m_pGlowTrail->SetStartWidth( 8.0f ); m_pGlowTrail->SetEndWidth( 1.0f ); m_pGlowTrail->SetLifeTime( 0.5f ); } }
//----------------------------------------------------------------------------- // Landed! //----------------------------------------------------------------------------- void CEnvHeadcrabCanister::Landed( void ) { EmitSound( "HeadcrabCanister.AfterLanding" ); // Lock us now that we've stopped SetLanded(); // Hook the follow trail to the lead of the canister (which should be buried) // to hide problems with the edge of the follow trail if (m_hTrail) { m_hTrail->SetAttachment( this, LookupAttachment("trail") ); } // Start smoke, unless we don't want it if ( !HasSpawnFlags( SF_NO_SMOKE ) ) { // Create the smoke trail to obscure the headcrabs m_hSmokeTrail = SmokeTrail::CreateSmokeTrail(); m_hSmokeTrail->FollowEntity( this, "smoke" ); m_hSmokeTrail->m_SpawnRate = 8; m_hSmokeTrail->m_ParticleLifetime = 2.0f; m_hSmokeTrail->m_StartColor.Init( 0.7f, 0.7f, 0.7f ); m_hSmokeTrail->m_EndColor.Init( 0.6, 0.6, 0.6 ); m_hSmokeTrail->m_StartSize = 32; m_hSmokeTrail->m_EndSize = 64; m_hSmokeTrail->m_SpawnRadius= 8; m_hSmokeTrail->m_MinSpeed = 0; m_hSmokeTrail->m_MaxSpeed = 8; m_hSmokeTrail->m_MinDirectedSpeed = 32; m_hSmokeTrail->m_MaxDirectedSpeed = 64; m_hSmokeTrail->m_Opacity = 0.35f; m_hSmokeTrail->SetLifetime( m_flSmokeLifetime ); } SetThink( NULL ); if ( !HasSpawnFlags( SF_WAIT_FOR_INPUT_TO_OPEN ) ) { if ( HasSpawnFlags( SF_START_IMPACTED ) ) { CanisterFinishedOpening( ); } else { OpenCanister(); } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CFlechette::Spawn( void ) { Precache( ); SetModel( BOLT_MODEL ); SetMoveType( MOVETYPE_FLY, MOVECOLLIDE_FLY_CUSTOM ); UTIL_SetSize( this, -Vector(1,1,1), Vector(1,1,1) ); SetSolid( SOLID_BBOX ); // Make sure we're updated if we're underwater UpdateWaterState(); SetTouch( &CFlechette::BoltTouch ); SetThink( &CFlechette::BubbleThink ); SetNextThink( gpGlobals->curtime + 0.1f ); CBasePlayer *pPlayer = ToBasePlayer(GetOwnerEntity()); if(pPlayer != NULL && HL2MPRules()->IsTeamplay()) { if(pPlayer->GetTeamNumber() == TEAM_PINK) m_nSkin = 1; else if(pPlayer->GetTeamNumber() == TEAM_GREEN) m_nSkin = 2; else m_nSkin = 0; } m_pGlowTrail = CSpriteTrail::SpriteTrailCreate( "sprites/grenade/grenade_laser.vmt", GetLocalOrigin(), false ); if ( m_pGlowTrail != NULL ) { m_pGlowTrail->FollowEntity( this ); if(m_nSkin == 1) m_pGlowTrail->SetTransparency( kRenderTransAdd, 255, 50, 255, 70, kRenderFxNone ); else if(m_nSkin == 2) m_pGlowTrail->SetTransparency( kRenderTransAdd, 0, 255, 0, 70, kRenderFxNone ); else m_pGlowTrail->SetTransparency( kRenderTransAdd, 255, 255, 255, 70, kRenderFxNone ); m_pGlowTrail->SetStartWidth( 3.0f ); m_pGlowTrail->SetEndWidth( 0.5f ); m_pGlowTrail->SetLifeTime( 0.4f ); } }
//----------------------------------------------------------------------------- // Fling the buster with the physcannon either via punt or launch. //----------------------------------------------------------------------------- void CWeaponStriderBuster::Launch( CBasePlayer *pPhysGunUser ) { if ( !HasSpawnFlags( SF_DONT_WEAPON_MANAGE ) ) { WeaponManager_RemoveManaged( this ); } m_bLaunched = true; // Notify all nearby hunters that we were launched. Hunter_StriderBusterLaunched( this ); // Start up the eye glow m_hMainGlow = CSprite::SpriteCreate( "sprites/blueglow1.vmt", GetLocalOrigin(), false ); if ( m_hMainGlow != NULL ) { m_hMainGlow->FollowEntity( this ); m_hMainGlow->SetTransparency( kRenderGlow, 255, 255, 255, 140, kRenderFxNoDissipation ); m_hMainGlow->SetScale( 2.0f ); m_hMainGlow->SetGlowProxySize( 8.0f ); } if ( !m_bNoseDiving ) { DispatchParticleEffect( "striderbuster_trail", PATTACH_ABSORIGIN_FOLLOW, this ); } else { DispatchParticleEffect( "striderbuster_shotdown_trail", PATTACH_ABSORIGIN_FOLLOW, this ); } // We get our touch function from the physics system SetTouch ( &CWeaponStriderBuster::BusterTouch ); SetThink( &CWeaponStriderBuster::BusterFlyThink ); SetNextThink( gpGlobals->curtime ); gamestats->Event_WeaponFired( pPhysGunUser, true, GetClassname() ); }