Skip to content

Commit

Permalink
Update highlight system
Browse files Browse the repository at this point in the history
  • Loading branch information
St4lker0k765 authored and Drombeys committed Dec 10, 2024
1 parent ff5426f commit d7737d8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/xrGame/inventory_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ void CInventoryItem::Load(LPCSTR section)
// Added by Axel, to enable optional condition use on any item
m_flags.set(FUsingCondition, READ_IF_EXISTS(pSettings, r_bool, section, "use_condition", false));

m_highlight_equipped = !!READ_IF_EXISTS(pSettings, r_bool, section, "highlight_equipped", FALSE);

if ( BaseSlot() != NO_ACTIVE_SLOT || Belt())
{
m_flags.set (FRuckDefault, pSettings->r_bool(section, "default_to_ruck" ));
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/inventory_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ class CInventoryItem :
shared_str m_name;
shared_str m_nameShort;
shared_str m_nameComplex;
bool m_highlight_equipped;
shared_str m_custom_text;
Fvector2 m_custom_text_offset;
CGameFont* m_custom_text_font;
Expand Down
16 changes: 16 additions & 0 deletions src/xrGame/ui/UIActorMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,20 @@ void CUIActorMenu::UpdateConditionProgressBars()
if (m_pInvSlotProgress[i])
m_pInvSlotProgress[i]->SetProgressPos(itm ? iCeil(itm->GetCondition() * 10.f) / 10.f : 0);
}

//Highlight 'equipped' items in actor bag
CUIDragDropListEx* slot_list = m_pInventoryBagList;
u32 const cnt = slot_list->ItemsCount();
for (u32 i = 0; i < cnt; ++i)
{
CUICellItem* ci = slot_list->GetItemIdx(i);
PIItem item = (PIItem)ci->m_pData;
if (!item)
continue;

if (item->m_highlight_equipped && item->m_pInventory && item->m_pInventory->ItemFromSlot(item->BaseSlot()) == item)
ci->m_select_equipped = true;
else
ci->m_select_equipped = false;
}
}
1 change: 1 addition & 0 deletions src/xrGame/ui/UICellItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ CUICellItem::CUICellItem()
m_b_destroy_childs = true;
m_selected = false;
m_select_armament = false;
m_select_equipped = false;
m_cur_mark = false;
m_has_upgrade = false;
m_with_custom_text = false;
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/ui/UICellItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class CUICellItem :public CUIStatic
bool m_b_destroy_childs;
bool m_selected;
bool m_select_armament;
bool m_select_equipped;
bool m_cur_mark;
bool m_has_upgrade;
bool m_with_custom_text;
Expand Down
12 changes: 2 additions & 10 deletions src/xrGame/ui/UIDragDropListEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,17 +962,9 @@ void CUICellContainer::Draw()
{
select_mode = 3;
}
else
else if (ui_cell.m_item->m_select_equipped)
{
//Alundaio: Highlight equipped items
PIItem iitem = (PIItem)ui_cell.m_item->m_pData;
if (iitem)
{
u16 slot = iitem->BaseSlot();
if (iitem->m_pInventory && iitem->m_pInventory->ItemFromSlot(slot) == iitem)
select_mode = 3;
}
//-Alundaio:
select_mode = 2;
}
}

Expand Down

0 comments on commit d7737d8

Please sign in to comment.