void CBeam::HoseInit( const Vector &start, const Vector &direction ) { SetType( BEAM_HOSE ); SetStartPos( start ); SetEndPos( direction ); SetStartAttachment( 0 ); SetEndAttachment( 0 ); RelinkBeam(); }
void CLaser::FireAtPoint( TraceResult &tr ) { SetEndPos( tr.vecEndPos ); if ( m_pSprite ) UTIL_SetOrigin( m_pSprite->pev, tr.vecEndPos ); BeamDamage( &tr ); DoSparks( GetStartPos(), tr.vecEndPos ); }
void CBeam::PointsInit( const Vector &start, const Vector &end ) { SetType( BEAM_POINTS ); SetStartPos( start ); SetEndPos( end ); SetStartAttachment( 0 ); SetEndAttachment( 0 ); RelinkBeam(); }
void CLightning::BeamUpdateVars( void ) { int beamType; int pointStart, pointEnd; edict_t *pStart = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(m_iszStartEntity) ); edict_t *pEnd = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(m_iszEndEntity) ); pointStart = IsPointEntity( CBaseEntity::Instance(pStart) ); pointEnd = IsPointEntity( CBaseEntity::Instance(pEnd) ); pev->skin = 0; pev->sequence = 0; pev->rendermode = 0; pev->flags |= FL_CUSTOMENTITY; pev->model = m_iszSpriteName; SetTexture( m_spriteTexture ); beamType = BEAM_ENTS; if ( pointStart || pointEnd ) { if ( !pointStart ) // One point entity must be in pStart { edict_t *pTemp; // Swap start & end pTemp = pStart; pStart = pEnd; pEnd = pTemp; int swap = pointStart; pointStart = pointEnd; pointEnd = swap; } if ( !pointEnd ) beamType = BEAM_ENTPOINT; else beamType = BEAM_POINTS; } SetType( beamType ); if ( beamType == BEAM_POINTS || beamType == BEAM_ENTPOINT || beamType == BEAM_HOSE ) { SetStartPos( pStart->v.origin ); if ( beamType == BEAM_POINTS || beamType == BEAM_HOSE ) SetEndPos( pEnd->v.origin ); else SetEndEntity( ENTINDEX(pEnd) ); } else { SetStartEntity( ENTINDEX(pStart) ); SetEndEntity( ENTINDEX(pEnd) ); } RelinkBeam(); SetWidth( m_boltWidth ); SetNoise( m_noiseAmplitude ); SetFrame( m_frameStart ); SetScrollRate( m_speed ); if ( pev->spawnflags & SF_BEAM_SHADEIN ) SetFlags( BEAM_FSHADEIN ); else if ( pev->spawnflags & SF_BEAM_SHADEOUT ) SetFlags( BEAM_FSHADEOUT ); }