void CFolderWeaponControls::UpdateSelection()
{
	CLTGUICtrl *pCtrl = GetSelectedControl();
	if (!pCtrl) return;

	int nComm = pCtrl->GetParam1();
	if (!nComm) return;

	uint8 nWeaponId = g_pWeaponMgr->GetWeaponId(m_nActions[nComm-1]);
	
	if (nWeaponId != nLastId)
	{
		WEAPON* pWeapon = g_pWeaponMgr->GetWeapon(nWeaponId);
		if (pWeapon)
		{

			SAFE_STRCPY(m_szModel, pWeapon->szInterfaceModel);
			SAFE_STRCPY(m_szSkin, pWeapon->szInterfaceSkin);
			VEC_COPY(m_vOffset, pWeapon->vInterfaceOffset);
			m_fScale = pWeapon->fInterfaceScale;
			CreateModelSFX();
		}
		nLastId = nWeaponId;
	}

}
Beispiel #2
0
LTBOOL CFolderIntel::UpdateSelection()
{
	LTBOOL bChanged = CBaseSelectionFolder::UpdateSelection();
	if (bChanged)
	{
		CLTGUICtrl *pCtrl = GetControl(m_nLastListItem);
		if (!pCtrl) return LTFALSE;
		int nIndex = pCtrl->GetParam1();
		if (!nIndex) return LTFALSE;



		IntelItem *pItem = m_intelArray[nIndex-1];
		HSTRING hStr = g_pLTClient->FormatString(pItem->nID);
		m_pDescription->SetString(hStr);
        g_pLTClient->FreeString(hStr);

		CScaleFX* pScaleFX = g_pFXButeMgr->GetScaleFX(pItem->nType);
		SAFE_STRCPY(m_szModel, pScaleFX->szFile);
		SAFE_STRCPY(m_szSkin, pScaleFX->szSkin);
		m_vScale = pScaleFX->vInitialScale;
		m_bChromakey = pScaleFX->bChromakey;
		
		if (pScaleFX->fDirOffset > 0.0f)
		{
			LTFLOAT fScaleMult = (100.0f/pScaleFX->fDirOffset);
			VEC_MULSCALAR(m_vScale, m_vScale, fScaleMult);
		}
		CreateModelSFX();

	}
	return bChanged;	

}