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


C++ CClientWeapon::GetActivationType方法代码示例

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


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

示例1: GetSpecialMoveFX

CSpecialMoveFX* CSFXMgr::GetSpecialMoveFX(HOBJECT hObject)
{
	CSpecialMoveFX* pSpecialMoveFX = NULL;
	int cSpecialMoveFX  = m_dynSFXLists[SFX_SPECIALMOVE_ID].GetSize();

	for ( int iSpecialMoveFX = 0 ; iSpecialMoveFX < cSpecialMoveFX ; iSpecialMoveFX++ )
	{
		pSpecialMoveFX = (CSpecialMoveFX*)m_dynSFXLists[SFX_SPECIALMOVE_ID][iSpecialMoveFX];
		if (pSpecialMoveFX && pSpecialMoveFX->GetServerObj() == hObject)
		{
			return pSpecialMoveFX;
		}
	}

	CFinishingMoveFX* pFinishingMoveFX = NULL;
	int cFinishingMoveFX  = m_dynSFXLists[SFX_FINISHINGMOVE_ID].GetSize();

	for ( int iFinishingMoveFX = 0 ; iFinishingMoveFX < cFinishingMoveFX ; iFinishingMoveFX++ )
	{
		pFinishingMoveFX = (CFinishingMoveFX*)m_dynSFXLists[SFX_FINISHINGMOVE_ID][iFinishingMoveFX];
		if (pFinishingMoveFX && pFinishingMoveFX->GetServerObj() == hObject)
		{
			return pFinishingMoveFX;
		}
	}

	CEntryToolLockFX* pEntryToolLockFX = NULL;
	int cEntryToolLockFX  = m_dynSFXLists[SFX_ENTRYTOOLLOCK_ID].GetSize();

	for ( int iEntryToolLockFX = 0 ; iEntryToolLockFX < cEntryToolLockFX ; iEntryToolLockFX++ )
	{
		pEntryToolLockFX = (CEntryToolLockFX*)m_dynSFXLists[SFX_ENTRYTOOLLOCK_ID][iEntryToolLockFX];
		if (pEntryToolLockFX && pEntryToolLockFX->GetServerObj() == hObject)
		{
			return pEntryToolLockFX;
		}
	}

	// Check for evidence only if we're holding the proper tool
	CClientWeapon* pWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon();
	if (pWeapon)
	{
		uint8 nActivateType = pWeapon->GetActivationType();
		if (IS_ACTIVATE_FORENSIC(nActivateType))
		{
			CForensicObjectFX* pForensicObjectFX = NULL;
			int cForensicObjectFX  = m_dynSFXLists[SFX_FORENSICOBJECT_ID].GetSize();

			for ( int iForensicObjectFX = 0 ; iForensicObjectFX < cForensicObjectFX ; iForensicObjectFX++ )
			{
				pForensicObjectFX = (CForensicObjectFX*)m_dynSFXLists[SFX_FORENSICOBJECT_ID][iForensicObjectFX];
				if (pForensicObjectFX && pForensicObjectFX->GetServerObj() == hObject)
				{
					return pForensicObjectFX;
				}
			}
		}
	}

	return NULL;
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:61,代码来源:SFXMgr.cpp

示例2: Update

void CHUDActivateObject::Update()
{
	uint32 nNewType = AOT_INVALID;

	// Check Target
	HOBJECT hTarget = NULL;
	
	// Get type.
	// check for forensic objects
	/*	if( !hTarget )
	{
	hTarget = g_pPlayerMgr->GetForensicObjectDetector().GetObject();
	nNewType = AOT_SCAN;
	}
	*/

	// check for pickups
	if( !hTarget )
	{
		// don't show the pickup icon if we're holding a tool (since we can't swap tools).
		CClientWeapon* pWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon();
		bool bHoldingTool = (pWeapon && IS_ACTIVATE_FORENSIC(pWeapon->GetActivationType()));
		if (!bHoldingTool)
		{
			HOBJECT hPickupObject = g_pPlayerMgr->GetPickupObjectDetector().GetObject();
			if (hPickupObject)
			{
				// make sure we can actually get the pickup
				CPickupItemFX* pPickupItemFX = static_cast< CPickupItemFX* >( g_pGameClientShell->GetSFXMgr()->FindSpecialFX( SFX_PICKUPITEM_ID, hPickupObject ));
				if (pPickupItemFX && (pPickupItemFX->IsMustSwap() || pPickupItemFX->CanPickup()))
				{
					hTarget = hPickupObject;
					nNewType = AOT_PICKUP;
				}
			}
		}
	}

	// check for targetable objects
	if( !hTarget )
	{
		if( g_pPlayerMgr->GetTargetMgr()->GetTargetObject() && g_pPlayerMgr->GetTargetMgr()->IsTargetInRange() )      
		{
			CActivationData data = g_pPlayerMgr->GetTargetMgr( )->GetActivationData( );
			if( data.m_nType == MID_ACTIVATE_SURFACESND )
			{
				hTarget = data.m_hTarget;
				nNewType = AOT_INVALID;
			}
			else
			{
				HOBJECT hTest = data.m_hTarget;

				// See whether or not it's disabled
				const CActivateObjectHandler *pActivateObj = CActivateObjectHandler::FindActivateObject( hTest );
				if( pActivateObj )
				{
					hTarget = hTest;
					nNewType = AOT_GENERAL;
				}
				else if( hTest )
				{
					hTarget = hTest;
					nNewType = AOT_GENERAL;
				}
			}
		}
	}

	SetObject(hTarget, nNewType);

	// Update Effect
	if( m_fEffectTime > 0.0f )
	{
		float fScale = 1.0f - ( m_fEffectTime / m_fFadeTime );
		float fFrameTime = g_pLTClient->GetFrameTime();

		// Update the current effect time
		m_fEffectTime -= fFrameTime;

		if( m_fEffectTime <= 0.0f )
		{
			if( !m_iObjRef )
			{
				m_nType = AOT_INVALID;
				return;
			}
		}

		// Set the alpha fade for each graphic
		uint8 nAlpha;

		if( m_iObjRef )
			nAlpha = ( uint8 )( m_dwEffectAlpha * fScale );
		else
			nAlpha = ( uint8 )( m_dwEffectAlpha * ( 1.0 - fScale ) );

		DrawPrimSetAlpha( m_IconPoly,	nAlpha ); 
		DrawPrimSetAlpha( m_ObjectRect, nAlpha );
		DrawPrimSetAlpha( m_ButtonRect, nAlpha );
//.........这里部分代码省略.........
开发者ID:Arc0re,项目名称:lithtech,代码行数:101,代码来源:HUDActivateObject.cpp


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