int32_t initClassd(const int32_t mode, const classdInitParams_t *c) { int32_t rc = 0; pthread_mutex_lock(&classdMutex); if ( classdInited == TRUE ){ pthread_mutex_unlock(&classdMutex); return RESULT_FAILURE; } onReceiveCallBack = (onreceiveCb_t)c->ci_onReceiveCb; onCriticalErrorCallBack = (onCriticalErrorCb_t)c->ci_onCritErrorCb; onSendCompleteCallback = (onSendCompleteCb_t)c->ci_onSendCompleteCb; onConnectCallback = (onConnectCb_t )c->ci_onConnectCb; onDisconnectCallback = (onDisconnectCb_t)c->ci_onDisconnectCb; if ( mode == MODE_CLIENT ){ classdMode = mode; rc = ClientSide(c); } else if ( mode == MODE_SERVER ){ classdMode = mode; rc = ServerSide(c); } else { _DEBUG("%s: Invalid mode('%d') specified for classd", __FUNCTION__, mode); return 1; } if( rc == 0 ) classdInited = TRUE; pthread_mutex_unlock(&classdMutex); return 0; }
//----------------------------------------------------------------------------- // 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 ); } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvBeam::TurnOff( void ) { m_active = 0; if ( ServerSide() ) { AddEffects( EF_NODRAW ); } SetNextThink( TICK_NEVER_THINK ); SetThink( NULL ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvBeam::Activate( void ) { // Get a handle to my filter entity if there is one if (m_iFilterName != NULL_STRING) { m_hFilter = dynamic_cast<CBaseFilter *>(gEntList.FindEntityByName( NULL, m_iFilterName )); } BaseClass::Activate(); if ( ServerSide() ) BeamUpdateVars(); }
void CLightning::Spawn( void ) { if ( FStringNull( m_iszSpriteName ) ) { SetThink( SUB_Remove ); return; } pev->solid = SOLID_NOT; // Remove model & collisions Precache( ); pev->dmgtime = gpGlobals->time; if ( ServerSide() ) { SetThink( NULL ); if ( pev->dmg > 0 ) { SetThink( DamageThink ); pev->nextthink = gpGlobals->time + 0.1; } if ( pev->targetname ) { if ( !(pev->spawnflags & SF_BEAM_STARTON) ) { pev->effects = EF_NODRAW; m_active = 0; pev->nextthink = 0; } else m_active = 1; SetUse( ToggleUse ); } } else { m_active = 0; if ( !FStringNull(pev->targetname) ) { SetUse( StrikeUse ); } if ( FStringNull(pev->targetname) || FBitSet(pev->spawnflags, SF_BEAM_STARTON) ) { SetThink( StrikeThink ); pev->nextthink = gpGlobals->time + 1.0; } } }
//----------------------------------------------------------------------------- // Purpose: Turns the lightning on. If it is set for interval refiring, it will // begin doing so. If it is set to be continually on, it will do so. //----------------------------------------------------------------------------- void CEnvBeam::TurnOn( void ) { m_active = 1; if ( ServerSide() ) { RemoveEffects( EF_NODRAW ); DoSparks( GetAbsStartPos(), GetAbsEndPos() ); SetThink( &CEnvBeam::UpdateThink ); SetNextThink( gpGlobals->curtime ); SetFireTime( gpGlobals->curtime ); } else { SetThink( &CEnvBeam::StrikeThink ); SetNextThink( gpGlobals->curtime ); } }
void CLightning::Activate( void ) { if ( ServerSide() ) BeamUpdateVars(); }
//----------------------------------------------------------------------------- // 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 ); } } }