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


C++ CHandle::AddFlag方法代码示例

本文整理汇总了C++中CHandle::AddFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ CHandle::AddFlag方法的具体用法?C++ CHandle::AddFlag怎么用?C++ CHandle::AddFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CHandle的用法示例。


在下文中一共展示了CHandle::AddFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InputActivate

//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CGameUI::InputActivate( inputdata_t &inputdata )
{
	// If already in use, ignore activatation by others
	if (( m_player.Get() != NULL ) && ( m_player.Get() != inputdata.pActivator ))
	{
		return;
	}

	if ( inputdata.pActivator && inputdata.pActivator->IsPlayer() )
	{
		m_player = (CBasePlayer *)inputdata.pActivator;
		m_playerOn.FireOutput( inputdata.pActivator, this, 0 );

		// Turn the hud off
		SetNextThink( gpGlobals->curtime );

		// Disable player motion
		if (FBitSet(m_spawnflags, SF_GAMEUI_FREEZE_PLAYER))
		{
			m_player->AddFlag( FL_ATCONTROLS );
		}

		if (FBitSet(m_spawnflags, SF_GAMEUI_HIDE_WEAPON))
		{
			m_player->m_Local.m_iHideHUD |= HIDEHUD_WEAPONS;

			if ( m_player->GetActiveWeapon() )
			{
				m_hSaveWeapon = m_player->GetActiveWeapon();

				m_player->GetActiveWeapon()->Holster();
				m_player->ClearActiveWeapon();
				m_player->HideViewModels();
			}
		}
	}

	m_bForceUpdate = true;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:42,代码来源:game_ui.cpp

示例2: InputActivate

//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CGameUI::InputActivate( inputdata_t &inputdata )
{
	CBasePlayer *pPlayer;

	// Determine if we're specifying this as an override parameter
	if ( inputdata.value.StringID() != NULL_STRING )
	{
		CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, inputdata.value.String(), this, inputdata.pActivator, inputdata.pCaller );
		if ( pEntity == NULL || pEntity->IsPlayer() == false )
		{
			Warning( "%s InputActivate: entity %s not found or is not a player!\n", STRING(GetEntityName()), inputdata.value.String() );
			return;
		}

		pPlayer = ToBasePlayer( pEntity );
	}
	else
	{
		// Otherwise try to use the activator
		if ( inputdata.pActivator == NULL || inputdata.pActivator->IsPlayer() == false )
		{
			Warning( "%s InputActivate: invalid or missing !activator!\n", STRING(GetEntityName()), inputdata.value.String() );
			return;
		}

		pPlayer = ToBasePlayer( inputdata.pActivator );
	}

	// If another player is already using these controls3, ignore this activation
	if ( m_player.Get() != NULL && pPlayer != m_player.Get() )
	{
		// TODO: We could allow this by calling Deactivate() at this point and continuing on -- jdw
		return;
	}

	// Setup our internal data
	m_player = pPlayer;
	m_playerOn.FireOutput( pPlayer, this, 0 );

	// Turn the hud off
	SetNextThink( gpGlobals->curtime );

	// Disable player's motion
	if ( FBitSet( m_spawnflags, SF_GAMEUI_FREEZE_PLAYER ) )
	{
		m_player->AddFlag( FL_ATCONTROLS );
	}

	// Store off and hide the currently held weapon
	if ( FBitSet( m_spawnflags, SF_GAMEUI_HIDE_WEAPON ) )
	{
		m_player->m_Local.m_iHideHUD |= HIDEHUD_WEAPONSELECTION;

		if ( m_player->GetActiveWeapon() )
		{
			m_hSaveWeapon = m_player->GetActiveWeapon();

			m_player->GetActiveWeapon()->Holster();
			m_player->ClearActiveWeapon();
			m_player->HideViewModels();
		}
	}

	// We must update our state
	m_bForceUpdate = true;
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:69,代码来源:game_ui.cpp


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