//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvBeam::Spawn( void ) { if ( !m_iszSpriteName ) { SetThink( &CEnvBeam::SUB_Remove ); return; } BaseClass::Spawn(); m_noiseAmplitude = MIN(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude); // Check for tapering if ( HasSpawnFlags( SF_BEAM_TAPEROUT ) ) { SetWidth( m_boltWidth ); SetEndWidth( 0 ); } else { SetWidth( m_boltWidth ); SetEndWidth( GetWidth() ); // Note: EndWidth is not scaled } if ( ServerSide() ) { SetThink( &CEnvBeam::UpdateThink ); SetNextThink( gpGlobals->curtime ); SetFireTime( gpGlobals->curtime ); if ( GetEntityName() != NULL_STRING ) { if ( !(m_spawnflags & SF_BEAM_STARTON) ) { AddEffects( EF_NODRAW ); m_active = 0; SetNextThink( TICK_NEVER_THINK ); } else { m_active = 1; } } } else { m_active = 0; if ( !GetEntityName() || FBitSet(m_spawnflags, SF_BEAM_STARTON) ) { SetThink( &CEnvBeam::StrikeThink ); SetNextThink( gpGlobals->curtime + 1.0f ); } } }
void CE_CBeam::BeamInit( const char *pSpriteName, float width ) { SetColor( 255, 255, 255 ); SetBrightness( 255 ); SetNoise( 0 ); SetFrame( 0 ); SetScrollRate( 0 ); SetModelName( MAKE_STRING( pSpriteName ) ); SetRenderMode( kRenderTransTexture ); SetTexture( engine->PrecacheModel( pSpriteName ) ); SetWidth( width ); SetEndWidth( width ); SetFadeLength( 0 ); // No fade for (int i=0;i<MAX_BEAM_ENTS;i++) { Set_m_hAttachEntity(i,NULL); Set_m_nAttachIndex(i, 0); } m_nHaloIndex = 0; m_fHaloScale = BEAM_DEFAULT_HALO_SCALE; m_nBeamType = 0; m_nBeamFlags = 0; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvLaser::Spawn( void ) { if ( !GetModelName() ) { SetThink( &CEnvLaser::SUB_Remove ); return; } SetSolid( SOLID_NONE ); // Remove model & collisions SetThink( &CEnvLaser::StrikeThink ); SetEndWidth( GetWidth() ); // Note: EndWidth is not scaled PointsInit( GetLocalOrigin(), GetLocalOrigin() ); Precache( ); if ( !m_pSprite && m_iszSpriteName != NULL_STRING ) { m_pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteName), GetAbsOrigin(), TRUE ); } else { m_pSprite = NULL; } if ( m_pSprite ) { m_pSprite->SetParent( GetMoveParent() ); m_pSprite->SetTransparency( kRenderGlow, m_clrRender->r, m_clrRender->g, m_clrRender->b, m_clrRender->a, m_nRenderFX ); } if ( GetEntityName() != NULL_STRING && !(m_spawnflags & SF_BEAM_STARTON) ) { TurnOff(); } else { TurnOn(); } }
//----------------------------------------------------------------------------- // Purpose: Input handler for the beam width. Sets the end width based on the // beam width. // Input : Beam width in tenths of world units. //----------------------------------------------------------------------------- void CBeam::InputWidth( inputdata_t &inputdata ) { SetWidth( inputdata.value.Float() ); SetEndWidth( inputdata.value.Float() ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvBeam::Spawn( void ) { if ( !m_iszSpriteName ) { SetThink( &CEnvBeam::SUB_Remove ); return; } BaseClass::Spawn(); m_noiseAmplitude = MIN(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude); // Check for tapering if ( HasSpawnFlags( SF_BEAM_TAPEROUT ) ) { SetWidth( m_boltWidth ); SetEndWidth( 0 ); } else { SetWidth( m_boltWidth ); SetEndWidth( GetWidth() ); // Note: EndWidth is not scaled } // if a non-targetentity endpoint was specified, transform it into local relative space // so it can move along with the base if (!m_vEndPointWorld.IsZero()) { WorldToEntitySpace( m_vEndPointWorld, &m_vEndPointRelative ); } else { m_vEndPointRelative.Zero(); } if ( ServerSide() ) { SetThink( &CEnvBeam::UpdateThink ); SetNextThink( gpGlobals->curtime ); SetFireTime( gpGlobals->curtime ); if ( GetEntityName() != NULL_STRING ) { if ( !(m_spawnflags & SF_BEAM_STARTON) ) { AddEffects( EF_NODRAW ); m_active = 0; SetNextThink( TICK_NEVER_THINK ); } else { m_active = 1; } } } else { m_active = 0; if ( !GetEntityName() || FBitSet(m_spawnflags, SF_BEAM_STARTON) ) { SetThink( &CEnvBeam::StrikeThink ); SetNextThink( gpGlobals->curtime + 1.0f ); } } }