Skip to content
Merged
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
11 changes: 7 additions & 4 deletions src/game/client/econ/base_loadout_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "vgui_controls/ComboBox.h"
#include "vgui/IInput.h"
#include "econ_ui.h"
#include "c_tf_player.h"

// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
Expand Down Expand Up @@ -265,8 +266,9 @@ void CBaseLoadoutPanel::ShowPanel( int iClass, bool bBackpack, bool bReturningFr
UpdateModelPanels();

// make the first slot be selected so controller input will work
static ConVarRef joystick( "joystick" );
if( joystick.IsValid() && joystick.GetBool() && m_pItemModelPanels.Count() && m_pItemModelPanels[0] )
//static ConVarRef joystick( "joystick" );
bool bSteamController = ::input->IsSteamControllerActive();
if( bSteamController && m_pItemModelPanels.Count() && m_pItemModelPanels[0] )
{
m_pItemModelPanels[0]->SetSelected( true );
m_pItemModelPanels[0]->RequestFocus();
Expand Down Expand Up @@ -678,6 +680,7 @@ bool CBaseLoadoutPanel::HandleItemSelectionKeyPressed( vgui::KeyCode code )
if ( nButtonCode == KEY_XBUTTON_UP ||
nButtonCode == KEY_XSTICK1_UP ||
nButtonCode == KEY_XSTICK2_UP ||
nButtonCode == STEAMCONTROLLER_DPAD_UP ||
nButtonCode == KEY_UP )
{
SelectAdjacentItem( 0, -1 );
Expand Down Expand Up @@ -730,7 +733,7 @@ bool CBaseLoadoutPanel::HandleItemSelectionKeyPressed( vgui::KeyCode code )
}
return true;
}
else if ( nButtonCode == KEY_XBUTTON_Y )
else if ( nButtonCode == KEY_XBUTTON_Y || nButtonCode == STEAMCONTROLLER_Y )
{
m_bTooltipKeyPressed = true;
CItemModelPanel *pSelection = GetFirstSelectedItemModelPanel( false );
Expand All @@ -754,7 +757,7 @@ bool CBaseLoadoutPanel::HandleItemSelectionKeyPressed( vgui::KeyCode code )
bool CBaseLoadoutPanel::HandleItemSelectionKeyReleased( vgui::KeyCode code )
{
ButtonCode_t nButtonCode = GetBaseButtonCode( code );
if( nButtonCode == KEY_XBUTTON_Y )
if( nButtonCode == KEY_XBUTTON_Y || nButtonCode == STEAMCONTROLLER_Y )
{
m_bTooltipKeyPressed = false;
m_pMouseOverTooltip->HideTooltip();
Expand Down
4 changes: 3 additions & 1 deletion src/game/client/econ/econ_controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1910,14 +1910,15 @@ void CExplanationPopup::OnKeyCodePressed( vgui::KeyCode code )
ButtonCode_t nButtonCode = GetBaseButtonCode( code );

// swallow all keys
if ( nButtonCode == KEY_XBUTTON_B )
if ( nButtonCode == KEY_XBUTTON_B || nButtonCode == STEAMCONTROLLER_B )
{
OnCommand( "close" );
return;
}
else if ( nButtonCode == KEY_XBUTTON_LEFT ||
nButtonCode == KEY_XSTICK1_LEFT ||
nButtonCode == KEY_XSTICK2_LEFT ||
nButtonCode == STEAMCONTROLLER_DPAD_LEFT ||
code == KEY_LEFT )
{
OnCommand( "prevexplanation" );
Expand All @@ -1926,6 +1927,7 @@ void CExplanationPopup::OnKeyCodePressed( vgui::KeyCode code )
else if ( nButtonCode == KEY_XBUTTON_RIGHT ||
nButtonCode == KEY_XSTICK1_RIGHT ||
nButtonCode == KEY_XSTICK2_RIGHT ||
nButtonCode == STEAMCONTROLLER_DPAD_RIGHT ||
code == KEY_RIGHT )
{
OnCommand( "nextexplanation" );
Expand Down
4 changes: 3 additions & 1 deletion src/game/client/econ/item_pickup_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,15 @@ void CItemPickupPanel::OnKeyCodePressed( vgui::KeyCode code )
else if ( nButtonCode == KEY_XBUTTON_RIGHT ||
nButtonCode == KEY_XSTICK1_RIGHT ||
nButtonCode == KEY_XSTICK2_RIGHT ||
nButtonCode == STEAMCONTROLLER_DPAD_RIGHT ||
nButtonCode == KEY_RIGHT )
{
OnCommand( "nextitem" );
}
else if ( nButtonCode == KEY_XBUTTON_LEFT ||
nButtonCode == KEY_XSTICK1_LEFT ||
nButtonCode == KEY_XSTICK2_LEFT ||
nButtonCode == STEAMCONTROLLER_DPAD_LEFT ||
nButtonCode == KEY_LEFT )
{
OnCommand( "previtem" );
Expand Down Expand Up @@ -848,7 +850,7 @@ void CItemDiscardPanel::OnKeyCodePressed( vgui::KeyCode code )
{
ButtonCode_t nButtonCode = GetBaseButtonCode( code );

if( nButtonCode == KEY_XBUTTON_B )
if( nButtonCode == KEY_XBUTTON_B || nButtonCode == STEAMCONTROLLER_B )
{
OnCommand( "vguicancel" );
}
Expand Down
12 changes: 7 additions & 5 deletions src/game/client/econ/item_selection_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,10 @@ void CItemSelectionPanel::OnKeyCodePressed( vgui::KeyCode code )
NotifySelectionReturned( pItemPanel );
}
}
else if( nButtonCode == KEY_XBUTTON_B )
else if( nButtonCode == KEY_XBUTTON_B || nButtonCode == STEAMCONTROLLER_B )
{
PostMessageSelectionReturned( INVALID_ITEM_ID );
//match the same behaviour as pressing ESC
PostMessageSelectionReturned( 0 );
OnClose();
}
else
Expand Down Expand Up @@ -1085,8 +1086,9 @@ void CEquipSlotItemSelectionPanel::UpdateModelPanelsForSelection( void )
int nPageStart = GetCurrentPage() * GetNumSlotsPerPage();
nOldSelection += nPageStart;

static ConVarRef joystick( "joystick" );
if ( joystick.IsValid() && joystick.GetBool() )
//static ConVarRef joystick( "joystick" );
bool bSteamController = ::input->IsSteamControllerActive();
if ( bSteamController )
{
if( nOldSelection == -1 || nOldSelection >= vecDisplayItems.Count() )
nOldSelection = nPageStart;
Expand All @@ -1102,7 +1104,7 @@ void CEquipSlotItemSelectionPanel::UpdateModelPanelsForSelection( void )
m_pItemModelPanels[i]->SetShowGreyedOutTooltip( true );
m_pItemModelPanels[i]->SetGreyedOut( NULL );
m_pItemModelPanels[i]->SetNoItemText( "#SelectNoItemSlot" );
bool bSelected = joystick.IsValid() && joystick.GetBool() && iItemIndex == nOldSelection;
bool bSelected = bSteamController && iItemIndex == nOldSelection;
m_pItemModelPanels[i]->SetSelected( bSelected );
m_pItemModelPanels[i]->SetShowQuantity( true );
m_pItemModelPanels[i]->SetForceShowEquipped( false );
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/tf/vgui/character_info_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void CCharacterInfoPanel::OnKeyCodePressed(vgui::KeyCode code)
{
ButtonCode_t nButtonCode = GetBaseButtonCode( code );

if ( nButtonCode == KEY_XBUTTON_B )
if ( nButtonCode == KEY_XBUTTON_B || nButtonCode == STEAMCONTROLLER_B )
{
if ( !m_bPreventClosure )
{
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/tf/vgui/charinfo_loadout_subpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ void CCharInfoLoadoutSubPanel::OnKeyCodePressed(vgui::KeyCode code)
{
// let escape and B (aka "go back") through so we
// can actually get out of the loadout screen
if ( nButtonCode == KEY_XBUTTON_B )
if ( nButtonCode == KEY_XBUTTON_B || nButtonCode == STEAMCONTROLLER_B )
{
BaseClass::OnKeyCodePressed( code );
}
Expand Down