本文整理汇总了C++中ShouldToggle函数的典型用法代码示例。如果您正苦于以下问题:C++ ShouldToggle函数的具体用法?C++ ShouldToggle怎么用?C++ ShouldToggle使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ShouldToggle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __MAKE_VHOOK
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;
}
}
}
示例2: Use
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 );
}
}
}
示例3: ToggleUse
//=========================================================
// 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 );
}
示例4: __MAKE_VHOOK
/* <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;
}
}
示例5: TurretUse
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);
}
}
示例6: Use
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" );
}
}
}
示例7: PendulumUse
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;
}
}
示例8: Use
void CFuncWall::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( ShouldToggle( useType, m_nState ) )
{
m_nState = 1 - m_nState;
}
}
示例9: ControllerPostFrame
/* <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();
}
}
示例10: RotatingUse
//=========================================================
// 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();
}
}
}
示例11: Use
void CFuncShine :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if (ShouldToggle(useType))
{
if (pev->spawnflags & SF_SHINE_ACTIVE)
TurnOff();
else
TurnOn();
}
}
示例12: Use
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();
}
}
示例13: Use
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();
}
}
示例14: Use
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 );
}
示例15: IsOn
/* <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();
}
}