Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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 );
	}
	else
	{
		if( !m_iObjRef )
		{
			m_nType = AOT_INVALID;
			return;
		}
	}
}