Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/game/client/econ/base_loadout_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ CItemModelPanel *CBaseLoadoutPanel::FindBestPanelNavigationForDirection( const C
for ( int j = 0; j < m_pItemModelPanels.Count(); j++ )
{
CItemModelPanel *pTempPanel = m_pItemModelPanels[ j ];
if ( !pTempPanel || pTempPanel == pCurrentPanel )
if ( !pTempPanel || pTempPanel == pCurrentPanel || !pTempPanel->IsVisible() )
continue;

// Get temp center position
Expand Down Expand Up @@ -399,7 +399,7 @@ void CBaseLoadoutPanel::LinkModelPanelControllerNavigation( bool bForceRelink )
if ( pBestPanel )
{
pCurrentPanel->SetNavUp( pBestPanel->GetName() );
pBestPanel->SetNavDown( pCurrentPanel->GetName() );
//pBestPanel->SetNavDown( pCurrentPanel->GetName() );
}
}

Expand All @@ -409,7 +409,7 @@ void CBaseLoadoutPanel::LinkModelPanelControllerNavigation( bool bForceRelink )
if ( pBestPanel )
{
pCurrentPanel->SetNavDown( pBestPanel->GetName() );
pBestPanel->SetNavUp( pCurrentPanel->GetName() );
//pBestPanel->SetNavUp( pCurrentPanel->GetName() );
}
}

Expand All @@ -419,7 +419,7 @@ void CBaseLoadoutPanel::LinkModelPanelControllerNavigation( bool bForceRelink )
if ( pBestPanel )
{
pCurrentPanel->SetNavLeft( pBestPanel->GetName() );
pBestPanel->SetNavRight( pCurrentPanel->GetName() );
//pBestPanel->SetNavRight( pCurrentPanel->GetName() );
}
}

Expand All @@ -429,7 +429,7 @@ void CBaseLoadoutPanel::LinkModelPanelControllerNavigation( bool bForceRelink )
if ( pBestPanel )
{
pCurrentPanel->SetNavRight( pBestPanel->GetName() );
pBestPanel->SetNavLeft( pCurrentPanel->GetName() );
//pBestPanel->SetNavLeft( pCurrentPanel->GetName() );
}
}
}
Expand Down
41 changes: 40 additions & 1 deletion src/game/client/tf/vgui/class_loadout_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,21 @@ void CClassLoadoutPanel::PerformLayout( void )
}

LinkModelPanelControllerNavigation( true );

// fix for controllers: refocusing stuff, fixes double selections, all that stuff
if ( ::input->IsSteamControllerActive() && GetFirstSelectedItemIndex( true ) == -1 )
{
FOR_EACH_VEC( m_pItemModelPanels, i )
{
bool bPrevSelected = ( i == m_iCurrentSlotIndex ) && m_pItemModelPanels[i]->IsVisible();
m_pItemModelPanels[i]->SetSelected(bPrevSelected);
if ( bPrevSelected )
{
SetBorderForItem( m_pItemModelPanels[i], false );
m_pItemModelPanels[i]->RequestFocus();
}
}
}
}


Expand Down Expand Up @@ -686,6 +701,14 @@ void CClassLoadoutPanel::OnKeyCodePressed( vgui::KeyCode code )
OnCommand( VarArgs("change%d", nSelected ) );
}
}
else if ( nButtonCode == KEY_XBUTTON_X || code == STEAMCONTROLLER_X )
{
if ( m_pSelectionPanel == NULL )
{
!m_bInTauntLoadoutMode ? OnCommand("tauntloadout") : OnCommand("characterloadout");
}
return;
}
else
{
BaseClass::OnKeyCodePressed( code );
Expand Down Expand Up @@ -738,7 +761,7 @@ void CClassLoadoutPanel::OnShowPanel( bool bVisible, bool bReturningFromArmory )
m_pSelectionPanel = NULL;
}

m_iCurrentSlotIndex = TF_WPN_TYPE_PRIMARY;
m_iCurrentClassIndex == TF_CLASS_SPY ? m_iCurrentSlotIndex = TF_WPN_TYPE_SECONDARY : m_iCurrentSlotIndex = TF_WPN_TYPE_PRIMARY;
if( m_pItemModelPanels.Count() && m_pItemModelPanels[0] )
{
m_pItemModelPanels[0]->SetSelected( true );
Expand Down Expand Up @@ -971,6 +994,13 @@ void CClassLoadoutPanel::OnSelectionReturned( KeyValues *data )
}

pSelection->RequestFocus();

// with a controller we actually want to keep the weapon highlighted
if ( ::input->IsSteamControllerActive() )
{
m_pItemModelPanels[m_iCurrentSlotIndex]->SetSelected( true );
SetBorderForItem( m_pItemModelPanels[m_iCurrentSlotIndex], false );
}
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1153,11 +1183,13 @@ void CClassLoadoutPanel::SetLoadoutPage( classloadoutpage_t loadoutPage )
case CHARACTER_LOADOUT_PAGE:
{
m_bInTauntLoadoutMode = false;
m_iCurrentClassIndex == TF_CLASS_SPY ? m_iCurrentSlotIndex = TF_WPN_TYPE_SECONDARY : m_iCurrentSlotIndex = TF_WPN_TYPE_PRIMARY;
}
break;
case TAUNT_LOADOUT_PAGE:
{
m_bInTauntLoadoutMode = true;
m_iCurrentSlotIndex = LOADOUT_POSITION_TAUNT;
}
break;
default:
Expand All @@ -1166,6 +1198,13 @@ void CClassLoadoutPanel::SetLoadoutPage( classloadoutpage_t loadoutPage )
Assert( 0 );
}
}

FOR_EACH_VEC( m_pItemModelPanels, i )
{
m_pItemModelPanels[i]->SetSelected( false );
SetBorderForItem( m_pItemModelPanels[i], false );
}

InvalidateLayout();
}

Expand Down