@@ -854,6 +854,7 @@ void BuyMenuGUI::Update() {
854
854
// ///////////////////////////////////////////
855
855
// Repeating input logic
856
856
857
+ bool isKeyboardControlled = !m_pController->IsMouseControlled () && !m_pController->IsGamepadControlled ();
857
858
bool pressLeft = m_pController->IsState (PRESS_LEFT);
858
859
bool pressRight = m_pController->IsState (PRESS_RIGHT);
859
860
bool pressUp = m_pController->IsState (PRESS_UP);
@@ -1028,7 +1029,6 @@ void BuyMenuGUI::Update() {
1028
1029
if (m_FocusChange) {
1029
1030
// Set the correct special Sets category so the sets buttons show up
1030
1031
m_MenuCategory = LOADOUTS;
1031
- CategoryChange ();
1032
1032
m_pSaveButton->SetFocus ();
1033
1033
m_FocusChange = 0 ;
1034
1034
}
@@ -1120,6 +1120,7 @@ void BuyMenuGUI::Update() {
1120
1120
m_IsDragging = true ;
1121
1121
std::swap ((*m_pShopList->GetItemList ())[m_DraggedItemIndex], (*m_pShopList->GetItemList ())[m_DraggedItemIndex + 1 ]);
1122
1122
std::swap ((*m_pShopList->GetItemList ())[m_DraggedItemIndex]->m_ID , (*m_pShopList->GetItemList ())[m_DraggedItemIndex + 1 ]->m_ID );
1123
+ std::swap ((*m_pShopList->GetItemList ())[m_DraggedItemIndex]->m_ExtraIndex , (*m_pShopList->GetItemList ())[m_DraggedItemIndex + 1 ]->m_ExtraIndex );
1123
1124
std::swap (m_Loadouts[m_DraggedItemIndex], m_Loadouts[m_DraggedItemIndex + 1 ]);
1124
1125
m_ListItemIndex = ++m_DraggedItemIndex;
1125
1126
m_SelectedLoadoutIndex = -1 ;
@@ -1129,6 +1130,7 @@ void BuyMenuGUI::Update() {
1129
1130
m_IsDragging = true ;
1130
1131
std::swap ((*m_pShopList->GetItemList ())[m_DraggedItemIndex], (*m_pShopList->GetItemList ())[m_DraggedItemIndex - 1 ]);
1131
1132
std::swap ((*m_pShopList->GetItemList ())[m_DraggedItemIndex]->m_ID , (*m_pShopList->GetItemList ())[m_DraggedItemIndex - 1 ]->m_ID );
1133
+ std::swap ((*m_pShopList->GetItemList ())[m_DraggedItemIndex]->m_ExtraIndex , (*m_pShopList->GetItemList ())[m_DraggedItemIndex - 1 ]->m_ExtraIndex );
1132
1134
std::swap (m_Loadouts[m_DraggedItemIndex], m_Loadouts[m_DraggedItemIndex - 1 ]);
1133
1135
m_ListItemIndex = --m_DraggedItemIndex;
1134
1136
m_SelectedLoadoutIndex = -1 ;
@@ -1281,12 +1283,14 @@ void BuyMenuGUI::Update() {
1281
1283
}
1282
1284
1283
1285
// User selected to add an item to cart list!
1284
- if (m_pController->IsState (RELEASE_FACEBUTTON) && !m_IsDragging) {
1286
+ if (isKeyboardControlled ? ( m_pController->IsState (PRESS_FACEBUTTON) && !m_pController-> IsState (AIM_SHARP)) : (m_pController-> IsState ( RELEASE_FACEBUTTON) && !m_IsDragging) ) {
1285
1287
// User pressed on a loadout set, so load it into the menu
1286
1288
if (pItem && m_MenuCategory == LOADOUTS) {
1287
1289
// Beep if there's an error
1288
1290
if (!DeployLoadout (m_ListItemIndex)) {
1289
1291
g_GUISound.UserErrorSound ()->Play (m_pController->GetPlayer ());
1292
+ } else {
1293
+ g_GUISound.ItemChangeSound ()->Play (m_pController->GetPlayer ());
1290
1294
}
1291
1295
}
1292
1296
// User pressed on a module group item; toggle its expansion!
@@ -1336,15 +1340,13 @@ void BuyMenuGUI::Update() {
1336
1340
UpdateTotalMassLabel (dynamic_cast <const ACraft*>(m_pSelectedCraft), m_pCraftMassLabel);
1337
1341
}
1338
1342
1339
- if (m_MenuCategory == LOADOUTS) {
1340
- bool isKeyboardControlled = !m_pController->IsMouseControlled () && !m_pController->IsGamepadControlled ();
1341
- if (isKeyboardControlled ? m_pController->IsState (AIM_SHARP) : m_pController->IsState (PRESS_FACEBUTTON)) {
1342
- m_DraggedItemIndex = m_pCartList->GetSelectedIndex ();
1343
- } else if (m_pController->IsState (RELEASE_FACEBUTTON)) {
1344
- m_DraggedItemIndex = -1 ;
1345
- m_IsDragging = false ;
1343
+ if (isKeyboardControlled ? m_pController->IsState (AIM_SHARP) : m_pController->IsState (PRESS_FACEBUTTON)) {
1344
+ m_DraggedItemIndex = m_pShopList->GetSelectedIndex ();
1345
+ } else if (m_pController->IsState (RELEASE_FACEBUTTON)) {
1346
+ if (m_MenuCategory == LOADOUTS) {
1347
+ // Might've reordered the loadout list, so we need to save the new order
1348
+ SaveAllLoadoutsToFile ();
1346
1349
}
1347
- } else {
1348
1350
m_DraggedItemIndex = -1 ;
1349
1351
m_IsDragging = false ;
1350
1352
}
@@ -1456,7 +1458,6 @@ void BuyMenuGUI::Update() {
1456
1458
}
1457
1459
1458
1460
// Fire button removes items from the order list, including equipment on AHumans
1459
- bool isKeyboardControlled = !m_pController->IsMouseControlled () && !m_pController->IsGamepadControlled ();
1460
1461
if (isKeyboardControlled ? (m_pController->IsState (PRESS_FACEBUTTON) && !m_pController->IsState (AIM_SHARP)) : (m_pController->IsState (RELEASE_FACEBUTTON) && !m_IsDragging)) {
1461
1462
if (g_UInputMan.FlagShiftState ()) {
1462
1463
ClearCartList ();
@@ -1902,7 +1903,8 @@ void BuyMenuGUI::Update() {
1902
1903
m_pDeleteButton->SetEnabled (m_SelectedLoadoutIndex != -1 );
1903
1904
if (m_SelectedLoadoutIndex != -1 ) {
1904
1905
// Always highlight the currently selected loadout as if it's focused
1905
- m_pShopList->SetSelectedIndex (m_SelectedLoadoutIndex);
1906
+ // TODO- need something better than this, like a dedicated highlight control
1907
+ // m_pShopList->SetSelectedIndex(m_SelectedLoadoutIndex);
1906
1908
}
1907
1909
}
1908
1910
}
@@ -2271,6 +2273,7 @@ void BuyMenuGUI::AddPresetsToItemList() {
2271
2273
m_SelectedLoadoutIndex = -1 ;
2272
2274
2273
2275
// Go through all the presets, making intelligible list items from then for the GUI item list
2276
+ m_pShopList->ClearList ();
2274
2277
for (int i = 0 ; i < m_Loadouts.size (); ++i) {
2275
2278
Loadout& loadout = m_Loadouts[i];
2276
2279
0 commit comments