LTBOOL	CFolderWeaponControls::OnRButtonUp(int x, int y)
{
	// Get the control that the click was on
	int nControlIndex=0;
	if (GetControlUnderPoint(x, y, &nControlIndex))
	{
		CLTGUICtrl* pCtrl = GetControl(nControlIndex);
		if (pCtrl && pCtrl->GetParam1())
		{
			CLTGUIColumnTextCtrl *pColumn=(CLTGUIColumnTextCtrl *)pCtrl;
			int nAct = pCtrl->GetParam1()-1;
			m_nActions[nAct] = GetPreviousCommand(m_nActions[nAct]);

			int nWeaponId = g_pWeaponMgr->GetWeaponId(m_nActions[nAct]);
			WEAPON *pWeapon = g_pWeaponMgr->GetWeapon(nWeaponId);
			if (pWeapon)
				pColumn->SetString(1,pWeapon->nNameId);
			else
				pColumn->SetString(1,IDS_CONTROL_UNASSIGNED);
			UpdateSelection();
			return LTTRUE;
		}
	}
	return CBaseFolder::OnRButtonUp(x, y);
}
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;
	}

}
示例#3
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;	

}
LTBOOL	CFolderWeaponControls::OnRight()
{
	CLTGUICtrl *pCtrl = GetSelectedControl();
	if (pCtrl && pCtrl->GetParam1())
	{
		CLTGUIColumnTextCtrl *pColumn=(CLTGUIColumnTextCtrl *)pCtrl;
		int nAct = pCtrl->GetParam1()-1;
		m_nActions[nAct] = GetNextCommand(m_nActions[nAct]);

		int nWeaponId = g_pWeaponMgr->GetWeaponId(m_nActions[nAct]);
		WEAPON *pWeapon = g_pWeaponMgr->GetWeapon(nWeaponId);
		if (pWeapon)
			pColumn->SetString(1,pWeapon->nNameId);
		else
			pColumn->SetString(1,IDS_CONTROL_UNASSIGNED);
		return LTTRUE;
	}
	return CBaseFolder::OnRight();
}
示例#5
0
// Handle a keypress
LTBOOL CScreenConfigure::HandleKeyDown(int key, int rep)
{

    LTBOOL handled = LTFALSE;

	switch (key)
	{
	case VK_DELETE:
		{
			// Unassign the key
			if (!m_bWaitingForKey && !m_fInputPauseTimeLeft)
			{

				CLTGUICtrl *pCtrl = m_pList[m_nType]->GetSelectedControl();
				int nCommand = pCtrl->GetParam1();
				CBindingData* pData = m_pProfile->FindBinding(nCommand);

				UnBind( pData->nDeviceObjectId[0], NULL, DEVICETYPE_KEYBOARD);
				UnBind( 0, pData->strTriggerName[1], DEVICETYPE_MOUSE);

				if (g_pGameClientShell->HasGamepad())
					UnBind( 0, pData->strTriggerName[2], DEVICETYPE_GAMEPAD);
				else if (g_pGameClientShell->HasJoystick())
					UnBind(0, pData->strTriggerName[2], DEVICETYPE_JOYSTICK);
				else
					UnBind(0, pData->strTriggerName[2], DEVICETYPE_UNKNOWN);

				SetControlText(pCtrl);

				handled = LTTRUE;
			}
			break;
		}
	}
	// Check to see if the base class is handling this key
	if (m_bWaitingForKey || m_fInputPauseTimeLeft)
		return handled;

	if (!handled)
	{
		handled = CBaseScreen::HandleKeyDown(key, rep);
	}

	// Handled the key
	return handled;
}