当前位置: 首页>>代码示例>>C++>>正文


C++ ShouldToggle函数代码示例

本文整理汇总了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;
		}
	}
}
开发者ID:Solexid,项目名称:ReGameDLL_CS,代码行数:30,代码来源:pathcorner.cpp

示例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 );
		}
	}
}
开发者ID:6779660,项目名称:halflife,代码行数:29,代码来源:pathcorner.cpp

示例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 );
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:28,代码来源:monstermaker.cpp

示例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;
	}
}
开发者ID:Arkshine,项目名称:ReGameDLL_CS,代码行数:8,代码来源:bmodels.cpp

示例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);
	}
}
开发者ID:suXinjke,项目名称:HalfPayne,代码行数:26,代码来源:turret.cpp

示例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" );
		}
	}
}
开发者ID:XashDev,项目名称:XashXT,代码行数:28,代码来源:bmodels.cpp

示例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;
	}
}
开发者ID:RichardRohac,项目名称:hl-amnesia-src,代码行数:33,代码来源:bmodels.cpp

示例8: Use

void CFuncWall::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if ( ShouldToggle( useType, m_nState ) )
	{
		m_nState = 1 - m_nState;
	}
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:7,代码来源:bmodels.cpp

示例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();
	}
}
开发者ID:Adidasman1,项目名称:ReGameDLL_CS,代码行数:34,代码来源:func_tank.cpp

示例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();
		}
	}
}
开发者ID:RichardRohac,项目名称:hl-amnesia-src,代码行数:62,代码来源:bmodels.cpp

示例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();
	}
}
开发者ID:JoelTroch,项目名称:am_src_rebirth,代码行数:10,代码来源:bmodels.cpp

示例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();
	}
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:10,代码来源:particle_emitter.cpp

示例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();
	}
}
开发者ID:SizzlingStats,项目名称:hl2sdk-ob-valve,代码行数:10,代码来源:lights.cpp

示例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 );
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:10,代码来源:buttons.cpp

示例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();
	}
}
开发者ID:Arkshine,项目名称:ReGameDLL_CS,代码行数:13,代码来源:bmodels.cpp


注:本文中的ShouldToggle函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。