Skip to content

Commit 66d5f19

Browse files
authored
Merge pull request #204 from cortex-command-community/pictorial-loadouts
Pictorial Loadouts
2 parents b410c9c + 6242a4d commit 66d5f19

File tree

4 files changed

+316
-151
lines changed

4 files changed

+316
-151
lines changed

Data/Base.rte/GUIs/BuyMenuGUI.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Anchor = Left, Top
211211
Text = Shields
212212
Checked = False
213213

214-
[SetsTab]
214+
[LoadoutsTab]
215215
ControlType = TAB
216216
Parent = BuyGUIBox
217217
X = 2
@@ -220,9 +220,9 @@ Width = 57
220220
Height = 17
221221
Visible = True
222222
Enabled = True
223-
Name = SetsTab
223+
Name = LoadoutsTab
224224
Anchor = Left, Top
225-
Text = Presets
225+
Text = Loadouts
226226
Checked = False
227227

228228
[CargoLabel]
@@ -439,7 +439,7 @@ Name = SaveButton
439439
Anchor = Left, Top
440440
Text = Save
441441

442-
[ClearButton]
442+
[DeleteButton]
443443
ControlType = BUTTON
444444
Parent = BuyGUIBox
445445
X = 4
@@ -448,6 +448,6 @@ Width = 48
448448
Height = 18
449449
Visible = True
450450
Enabled = True
451-
Name = ClearButton
451+
Name = DeleteButton
452452
Anchor = Left, Top
453-
Text = Clear
453+
Text = Delete

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 / 2) - (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) {

0 commit comments

Comments
 (0)