Skip to content

Commit f12035d

Browse files
committed
UI tweaks
1 parent e82e0ea commit f12035d

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

Source/GUI/GUIListPanel.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,15 @@ void GUIListPanel::BuildDrawBitmap() {
329329

330330
// Draw the associated bitmap
331331
if (I->m_pBitmap) {
332-
if (bitmapWidth == thirdWidth) {
332+
if (I->m_Name.empty()) {
333+
// No text, just bitmap, so give it more room
334+
I->m_pBitmap->DrawTrans(m_DrawBitmap, ((thirdWidth * 1.3f) - (bitmapWidth / 2)) - itemX + 4, bitmapY, 0);
335+
} else if (bitmapWidth == thirdWidth) {
333336
// If it was deemed too large, draw it scaled
334337
I->m_pBitmap->DrawTransScaled(m_DrawBitmap, 3 - itemX, bitmapY, bitmapWidth, bitmapHeight);
335-
} else if (!I->m_Name.empty()) {
338+
} else {
336339
// There's text to compete for space with
337340
I->m_pBitmap->DrawTrans(m_DrawBitmap, ((thirdWidth / 2) - (bitmapWidth / 2)) - itemX + 2, bitmapY, 0);
338-
} else {
339-
// No text, just bitmap, so give it more room
340-
I->m_pBitmap->DrawTrans(m_DrawBitmap, ((thirdWidth) - (bitmapWidth / 2)) - itemX + 4, bitmapY, 0);
341341
}
342342
}
343343

@@ -991,10 +991,15 @@ GUIListPanel::Item* GUIListPanel::GetItem(int Index) {
991991
if (Index >= 0 && Index < m_Items.size()) {
992992
return m_Items.at(Index);
993993
}
994-
return 0;
994+
return nullptr;
995995
}
996996

997997
GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
998+
// If outside of X bounds, return nothing
999+
if (X < m_X || X >= m_X + m_Width) {
1000+
return nullptr;
1001+
}
1002+
9981003
int Height = m_Height;
9991004
if (m_HorzScroll->_GetVisible()) {
10001005
Height -= m_HorzScroll->GetHeight();
@@ -1004,6 +1009,7 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
10041009
if (m_VertScroll->_GetVisible()) {
10051010
y -= m_VertScroll->GetValue();
10061011
}
1012+
10071013
int Count = 0;
10081014
for (std::vector<Item*>::iterator it = m_Items.begin(); it != m_Items.end(); it++, Count++) {
10091015
Item* pItem = *it;
@@ -1019,7 +1025,8 @@ GUIListPanel::Item* GUIListPanel::GetItem(int X, int Y) {
10191025
break;
10201026
}
10211027
}
1022-
return 0;
1028+
1029+
return nullptr;
10231030
}
10241031

10251032
int GUIListPanel::GetItemHeight(Item* pItem) {

Source/Menus/BuyMenuGUI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,9 +871,9 @@ void BuyMenuGUI::Update() {
871871
}
872872

873873
// Check if any direction has been held for the starting amount of time to get into repeat mode
874-
if (m_RepeatStartTimer.IsPastRealMS(200)) {
874+
if (m_RepeatStartTimer.IsPastRealMS(350)) {
875875
// Check for the repeat interval
876-
if (m_RepeatTimer.IsPastRealMS(75)) {
876+
if (m_RepeatTimer.IsPastRealMS(125)) {
877877
if (m_pController->IsState(MOVE_RIGHT)) {
878878
pressRight = true;
879879
} else if (m_pController->IsState(MOVE_LEFT)) {
@@ -2218,7 +2218,7 @@ void BuyMenuGUI::AddPresetsToItemList() {
22182218
AllegroBitmap* pItemBitmap = nullptr;
22192219
float loadoutCost = 0;
22202220

2221-
const int maxBitmapWidth = 100;
2221+
const int maxBitmapWidth = 130;
22222222

22232223
int bitmapHeight = 0;
22242224
int bitmapWidth = 0;

0 commit comments

Comments
 (0)