void CPathTrack::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int on; // Use toggles between two paths if (m_paltpath) { on = !(pev->spawnflags & SF_PATH_ALTERNATE); if (ShouldToggle(useType, on)) { if (on) pev->spawnflags |= SF_PATH_ALTERNATE; else pev->spawnflags &= ~SF_PATH_ALTERNATE; } } else // Use toggles between enabled/disabled { on = !(pev->spawnflags & SF_PATH_DISABLED); if (ShouldToggle(useType, on)) { if (on) pev->spawnflags |= SF_PATH_DISABLED; else pev->spawnflags &= ~SF_PATH_DISABLED; } } }
void CPathTrack :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { int on; // Use toggles between two paths if ( m_paltpath ) { on = !FBitSet( pev->spawnflags, SF_PATH_ALTERNATE ); if ( ShouldToggle( useType, on ) ) { if ( on ) SetBits( pev->spawnflags, SF_PATH_ALTERNATE ); else ClearBits( pev->spawnflags, SF_PATH_ALTERNATE ); } } else // Use toggles between enabled/disabled { on = !FBitSet( pev->spawnflags, SF_PATH_DISABLED ); if ( ShouldToggle( useType, on ) ) { if ( on ) SetBits( pev->spawnflags, SF_PATH_DISABLED ); else ClearBits( pev->spawnflags, SF_PATH_DISABLED ); } } }
//========================================================= // ToggleUse - activates/deactivates the monster maker //========================================================= void CMonsterMaker :: ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if (pActivator){ pev->vuser1= pActivator->pev->origin; //AJH for *locus position etc pev->vuser2= pActivator->pev->angles; pev->vuser3= pActivator->pev->velocity; } if ( !ShouldToggle( useType, m_fActive ) ) return; if ( m_fActive ) { m_fActive = FALSE; SetThink ( NULL ); } else { m_fActive = TRUE; SetThink(&CMonsterMaker :: MakerThink ); } SetNextThink( 0 ); }
/* <1d873> ../cstrike/dlls/bmodels.cpp:77 */ void CFuncWall::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (ShouldToggle(useType, (int)(pev->frame))) { pev->frame = 1.0 - pev->frame; } }
void CBaseTurret::TurretUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !ShouldToggle( useType, m_iOn ) ) return; if (m_iOn) { m_hEnemy = NULL; pev->nextthink = gpGlobals->time + 0.1; m_iAutoStart = FALSE;// switching off a turret disables autostart //!!!! this should spin down first!!BUGBUG SetThink(&CBaseTurret::Retire); } else { pev->nextthink = gpGlobals->time + 0.1; // turn on delay // if the turret is flagged as an autoactivate turret, re-enable it's ability open self. if ( pev->spawnflags & SF_MONSTER_TURRET_AUTOACTIVATE ) { m_iAutoStart = TRUE; } SetThink(&CBaseTurret::Deploy); } }
void CFuncWall :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( IsLockedByMaster( pActivator )) return; if( ShouldToggle( useType )) { if( GetState() == STATE_ON ) TurnOff(); else TurnOn(); // LRC (support generic switchable texlight) if( m_iStyle >= 32 ) { if( pev->frame ) LIGHT_STYLE( m_iStyle, "z" ); else LIGHT_STYLE( m_iStyle, "a" ); } else if( m_iStyle <= -32 ) { if( pev->frame ) LIGHT_STYLE( -m_iStyle, "a" ); else LIGHT_STYLE( -m_iStyle, "z" ); } } }
void CFuncConveyor :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( IsLockedByMaster( pActivator )) return; if( ShouldToggle( useType )) { if( useType == USE_SET ) { if( value != 0 ) { pev->impulse = value < 0 ? true : false; value = fabs( value ); pev->dmg = bound( 0.1, value, 1 ) * m_flMaxSpeed; } else UpdateSpeed( 0 ); // stop return; } else if( useType == USE_RESET ) { // restore last speed UpdateSpeed( pev->dmg ); return; } pev->impulse = !pev->impulse; UpdateSpeed( m_flMaxSpeed ); } }
void CPendulum :: PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if (!ShouldToggle(useType)) return; if ( pev->speed ) // Pendulum is moving, stop it and auto-return if necessary { if ( FBitSet( pev->spawnflags, SF_PENDULUM_AUTO_RETURN ) ) { float delta; delta = CBaseToggle :: AxisDelta( pev->spawnflags, pev->angles, m_start ); UTIL_SetAvelocity(this, m_maxSpeed * pev->movedir); //LRC //pev->avelocity = m_maxSpeed * pev->movedir; SetNextThink(delta / m_maxSpeed); SetThink(&CPendulum ::StopThink); } else { pev->speed = 0; // Dead stop DontThink(); UTIL_SetAvelocity(this, g_vecZero); //LRC //pev->avelocity = g_vecZero; } } else { SetNextThink(0.1); // start the pendulum moving SetThink(&CPendulum ::SwingThink); m_time = gpGlobals->time; // Save time to calculate dt m_dampSpeed = m_maxSpeed; } }
void CFuncWall::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( ShouldToggle( useType, m_nState ) ) { m_nState = 1 - m_nState; } }
/* <8ee12> ../cstrike/dlls/func_tank.cpp:424 */ void CFuncTank::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { // player controlled turret if (pev->spawnflags & SF_TANK_CANCONTROL) { if (pActivator->Classify() != CLASS_PLAYER) return; if (value == 2 && useType == USE_SET) { ControllerPostFrame(); } else if (!m_pController && useType != USE_OFF) { ((CBasePlayer*)pActivator)->m_pTank = this; StartControl((CBasePlayer*)pActivator); } else { StopControl(); } } else { if (!ShouldToggle(useType, IsActive())) return; if (IsActive()) TankDeactivate(); else TankActivate(); } }
//========================================================= // Rotating Use - when a rotating brush is triggered //========================================================= void CFuncRotating :: RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if (!ShouldToggle(useType)) return; // is this a brush that should accelerate and decelerate when turned on/off (fan)? if ( FBitSet ( pev->spawnflags, SF_BRUSH_ACCDCC ) ) { // fan is spinning, so stop it. if ( m_fCurSpeed != 0 ) // if ( pev->avelocity != g_vecZero ) { m_iState = STATE_TURN_OFF; SetThink(&CFuncRotating :: SpinDown ); //EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, (char *)STRING(pev->noiseStop), // m_flVolume, m_flAttenuation, 0, m_pitch); SetNextThink( 0.1 ); } else// fan is not moving, so start it { m_iState = STATE_TURN_ON; SetThink(&CFuncRotating :: SpinUp ); EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning), 0.01, m_flAttenuation, 0, FANPITCHMIN); SetNextThink( 0.1 ); } } else // if ( !FBitSet ( pev->spawnflags, SF_BRUSH_ACCDCC ) )//this is a normal start/stop brush. { if ( m_fCurSpeed != 0 ) //LRC // if ( pev->avelocity != g_vecZero ) { m_iState = STATE_OFF; // play stopping sound here SetThink(&CFuncRotating :: SpinDown ); // EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, (char *)STRING(pev->noiseStop), // m_flVolume, m_flAttenuation, 0, m_pitch); SetNextThink( 0.1 ); // pev->avelocity = g_vecZero; } else { m_iState = STATE_ON; EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning), m_flVolume, m_flAttenuation, 0, FANPITCHMAX); //LRC m_fCurSpeed = pev->speed; UTIL_SetAvelocity(this, pev->movedir * pev->speed); // pev->avelocity = pev->movedir * pev->speed; SetThink(&CFuncRotating :: Rotate ); Rotate(); } } }
void CFuncShine :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if (ShouldToggle(useType)) { if (pev->spawnflags & SF_SHINE_ACTIVE) TurnOff(); else TurnOn(); } }
void CParticleEmitter :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if (ShouldToggle(useType, pev->body)) { if (pev->spawnflags & SF_START_ON) TurnOff(); else TurnOn(); } }
void CLight::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if (m_iStyle >= 32) { if ( !ShouldToggle( useType, !FBitSet(m_spawnflags, SF_LIGHT_START_OFF) ) ) return; Toggle(); } }
void CButtonTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !ShouldToggle( useType, (int)pev->frame ) ) return; pev->frame = 1-pev->frame; if ( pev->frame ) SUB_UseTargets( pActivator, USE_ON, 0 ); else SUB_UseTargets( pActivator, USE_OFF, 0 ); }
/* <1e101> ../cstrike/dlls/bmodels.cpp:130 */ void CFuncWallToggle::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int status = IsOn(); if (ShouldToggle(useType, status)) { if (status) TurnOff(); else TurnOn(); } }
void CFuncWallToggle::InputToggle( inputdata_t &inputdata ) { int status = IsOn(); if ( ShouldToggle( USE_TOGGLE, status ) ) { if ( status ) TurnOff(); else TurnOn(); } }
void CFuncWallDetail :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { int status = IsOn(); if ( ShouldToggle( useType, status ) ) { if ( status ) TurnOff(); else TurnOn(); } }
void CFuncWallToggle :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { // int status = IsOn(); BOOL status = (GetState() == STATE_ON); if ( ShouldToggle( useType, status ) ) { if ( status ) TurnOff(); else TurnOn(); } }
void CIchthyosaur::CombatUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !ShouldToggle( useType, m_bOnAttack ) ) return; if (m_bOnAttack) { m_bOnAttack = 0; } else { m_bOnAttack = 1; } }
void CButtonTarget::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!ShouldToggle(useType, int(pev->frame))) return; pev->frame = 1 - pev->frame; if (pev->frame) { SUB_UseTargets(pActivator, USE_ON, 0); } else SUB_UseTargets(pActivator, USE_OFF, 0); }
void CSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { const bool on = pev->effects != EF_NODRAW; if( ShouldToggle( useType, on ) ) { if( on ) { TurnOff(); } else { TurnOn(); } } }
// DVS TODO: Obsolete Use handler void CSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { int on = !IsEffectActive( EF_NODRAW ); if ( ShouldToggle( useType, on ) ) { if ( on ) { TurnOff(); } else { TurnOn(); } } }
void CLaser::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { int active = IsOn(); if(!ShouldToggle(useType, active)) return; if(active) { TurnOff(); } else { TurnOn(); } }
void CBubbling::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( ShouldToggle( useType, m_state ) ) m_state = !m_state; if ( m_state ) { SetThink( FizzThink ); pev->nextthink = gpGlobals->time + 0.1; } else { SetThink( NULL ); pev->nextthink = 0; } }
//========================================================= // ToggleUse - activates/deactivates the monster maker //========================================================= void CMonsterMaker :: ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !ShouldToggle( useType, m_fActive ) ) return; if ( m_fActive ) { m_fActive = FALSE; SetThink ( NULL ); } else { m_fActive = TRUE; SetThink(&CMonsterMaker :: MakerThink ); } SetNextThink( 0 ); }
//========================================================= // ToggleUse - activates/deactivates the monster maker //========================================================= void CMonsterMaker :: ToggleUse ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( !ShouldToggle( useType, m_fActive ) ) return; if ( m_fActive ) { m_fActive = false; SetThink ( NULL ); } else { m_fActive = true; SetThink ( &CMonsterMaker::MakerThink ); } pev->nextthink = gpGlobals->time; }
void CEnvSpark :: SparkUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { int active = (GetState() == STATE_ON); if ( !ShouldToggle( useType, active ) ) return; if ( active ) { m_iState = STATE_OFF; SetThink( NULL ); } else { SetThink( &CEnvSpark::SparkThink ); SetNextThink( 0.1f + RANDOM_FLOAT( 0.0f, m_flDelay )); } }
void CButtonTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if( !ShouldToggle( useType )) return; pev->frame = !pev->frame; if( pev->frame ) { m_iState = STATE_ON; SUB_UseTargets( pActivator, USE_ON, 0 ); } else { m_iState = STATE_OFF; SUB_UseTargets( pActivator, USE_OFF, 0 ); } }
void CFuncTank::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { if ( m_spawnflags & SF_TANK_CANCONTROL ) { // player controlled turret CBasePlayer *pPlayer = ToBasePlayer( pActivator ); if ( !pPlayer ) return; if ( value == 2 && useType == USE_SET ) { ControllerPostFrame(); } else if ( !m_pController && useType != USE_OFF ) { // The player must be within the func_tank controls Assert( m_hControlVolume ); if ( !m_hControlVolume->IsTouching( pPlayer ) ) return; pPlayer->SetUseEntity( this ); StartControl( pPlayer ); } else { StopControl(); } } else { if ( !ShouldToggle( useType, IsActive() ) ) return; if ( IsActive() ) { TankDeactivate(); } else { TankActivate(); } } }