diff --git a/src/xrGame/Inventory.cpp b/src/xrGame/Inventory.cpp index afa482824bf..b2b946cf9a6 100644 --- a/src/xrGame/Inventory.cpp +++ b/src/xrGame/Inventory.cpp @@ -1075,9 +1075,12 @@ bool CInventory::Eat(PIItem pIItem) if (pItemToEat->CanDelete()) { - pIItem->SetDropManual(TRUE); - return false; + if (!pItemToEat->CanDelete()) + return false; + + pIItem->SetDropManual(true); } + return true; } diff --git a/src/xrGame/alife_trader_abstract.cpp b/src/xrGame/alife_trader_abstract.cpp index 754584a83f4..3d08af7b942 100644 --- a/src/xrGame/alife_trader_abstract.cpp +++ b/src/xrGame/alife_trader_abstract.cpp @@ -171,8 +171,14 @@ void add_online_impl(CSE_ALifeDynamicObject* object, const bool& update_registri //-Alundaio CSE_ALifeDynamicObject* l_tpALifeDynamicObject = ai().alife().objects().object(*I); + if (!l_tpALifeDynamicObject) + continue; + CSE_ALifeInventoryItem* l_tpALifeInventoryItem = smart_cast(l_tpALifeDynamicObject); - R_ASSERT2(l_tpALifeInventoryItem, "Non inventory item object has parent?!"); + if (!l_tpALifeInventoryItem) + continue; + + //R_ASSERT2(l_tpALifeInventoryItem, "Non inventory item object has parent?!"); l_tpALifeInventoryItem->base()->s_flags.or (M_SPAWN_UPDATE); CSE_Abstract* l_tpAbstract = smart_cast(l_tpALifeInventoryItem); object->alife().server().entity_Destroy(l_tpAbstract); diff --git a/src/xrGame/eatable_item.cpp b/src/xrGame/eatable_item.cpp index 677872e4948..5c45ad5c6b4 100644 --- a/src/xrGame/eatable_item.cpp +++ b/src/xrGame/eatable_item.cpp @@ -137,8 +137,6 @@ bool CEatableItem::UseBy(CEntityAlive* entity_alive) m_iRemainingUses = 0; SetCondition((float)m_iRemainingUses / (float)m_iMaxUses); - CurrentGameUI()->HideActorMenu(); - CurrentGameUI()->ShowActorMenu(); return true; } diff --git a/src/xrGame/ui/UIActorMenu.h b/src/xrGame/ui/UIActorMenu.h index cb3873ccecc..cf26dad6559 100644 --- a/src/xrGame/ui/UIActorMenu.h +++ b/src/xrGame/ui/UIActorMenu.h @@ -224,7 +224,11 @@ class CUIActorMenu : public CUIDialogWnd, public CUIWndCallback void BindDragDropListEvents(CUIDragDropListEx* lst); EDDListType GetListType(CUIDragDropListEx* l); - CUIDragDropListEx* GetListByType(EDDListType t); + +public: + CUIDragDropListEx* GetListByType(EDDListType t); //Alundaio: Make public + +protected: CUIDragDropListEx* GetSlotList(u16 slot_idx); bool CanSetItemToList(PIItem item, CUIDragDropListEx* l, u16& ret_slot); diff --git a/src/xrGame/ui/UIActorMenuInventory.cpp b/src/xrGame/ui/UIActorMenuInventory.cpp index 3d17e289cc2..0d10edcd6ce 100644 --- a/src/xrGame/ui/UIActorMenuInventory.cpp +++ b/src/xrGame/ui/UIActorMenuInventory.cpp @@ -718,6 +718,9 @@ bool CUIActorMenu::TryUseItem(CUICellItem* cell_itm) { return false; } + + cell_itm->UpdateConditionProgressBar(); //Alundaio + u16 recipient = m_pActorInvOwner->object_id(); if (item->parent_id() != recipient) { diff --git a/src/xrGame/ui/UIActorMenu_action.cpp b/src/xrGame/ui/UIActorMenu_action.cpp index eb88e7a9a4b..3790f9e3fb8 100644 --- a/src/xrGame/ui/UIActorMenu_action.cpp +++ b/src/xrGame/ui/UIActorMenu_action.cpp @@ -143,8 +143,8 @@ bool CUIActorMenu::OnItemDrop(CUICellItem* itm) OnItemDropped(CurrentIItem(), new_owner, old_owner); - UpdateItemsPlace(); UpdateConditionProgressBars(); + UpdateItemsPlace(); return true; } @@ -232,8 +232,8 @@ bool CUIActorMenu::OnItemDbClick(CUICellItem* itm) }; // switch - UpdateItemsPlace(); UpdateConditionProgressBars(); + UpdateItemsPlace(); return true; } diff --git a/src/xrGame/ui/UICellCustomItems.cpp b/src/xrGame/ui/UICellCustomItems.cpp index 315cf974fd9..98ebb7ae625 100644 --- a/src/xrGame/ui/UICellCustomItems.cpp +++ b/src/xrGame/ui/UICellCustomItems.cpp @@ -70,6 +70,7 @@ void CUIInventoryCellItem::SetIsHelper(bool is_helper) { object()->set_is_helper void CUIInventoryCellItem::Update() { inherited::Update(); + inherited:UpdateConditionProgressBar(); //Alundaio UpdateItemText(); u32 color = GetTextureColor(); diff --git a/src/xrGame/ui/UICellItem.cpp b/src/xrGame/ui/UICellItem.cpp index f399535d5ea..257581016ff 100644 --- a/src/xrGame/ui/UICellItem.cpp +++ b/src/xrGame/ui/UICellItem.cpp @@ -227,7 +227,7 @@ void CUICellItem::UpdateConditionProgressBar() m_pConditionState->ShowBackground(false); } - m_pConditionState->m_bUseColor = false; + m_pConditionState->m_bNoLerp = true; } } diff --git a/src/xrGame/ui/UIProgressBar.cpp b/src/xrGame/ui/UIProgressBar.cpp index 120617b14cd..4139218387d 100644 --- a/src/xrGame/ui/UIProgressBar.cpp +++ b/src/xrGame/ui/UIProgressBar.cpp @@ -10,6 +10,7 @@ CUIProgressBar::CUIProgressBar(void) m_bBackgroundPresent = false; m_bUseColor = false; + m_bNoLerp = false; //Alundaio AttachChild(&m_UIBackgroundItem); AttachChild(&m_UIProgressItem); @@ -53,6 +54,12 @@ void CUIProgressBar::UpdateProgressBar() if (m_bUseColor) { + if (m_bNoLerp) + { + m_UIProgressItem.SetTextureColor(m_maxColor.get()); + return; + } + Fcolor curr; curr.lerp(m_minColor, m_middleColor, m_maxColor, fCurrentLength); m_UIProgressItem.SetTextureColor(curr.get()); diff --git a/src/xrGame/ui/UIProgressBar.h b/src/xrGame/ui/UIProgressBar.h index f625cc694dd..630c139bef5 100644 --- a/src/xrGame/ui/UIProgressBar.h +++ b/src/xrGame/ui/UIProgressBar.h @@ -32,10 +32,12 @@ class CUIProgressBar : public CUIWindow public: bool m_bUseColor; + bool m_bNoLerp; //Alundaio: use only solid color with m_maxColor Fcolor m_minColor; Fcolor m_middleColor; Fcolor m_maxColor; float m_inertion; // + public: CUIStatic m_UIProgressItem; CUIStatic m_UIBackgroundItem;