From e3108c9195c4083e8225b1995c098fac915ad26c Mon Sep 17 00:00:00 2001 From: Hozar2002 Date: Fri, 2 Aug 2024 00:44:02 +0300 Subject: [PATCH] Implement stash all button in dead-body inventory For #58 --- gamedata/configs/ui/actor_menu.xml | 12 ++++++++++ gamedata/configs/ui/actor_menu_16.xml | 26 +++++++++++++++------ src/xrGame/ui/UIActorMenu.h | 2 ++ src/xrGame/ui/UIActorMenuDeadBodySearch.cpp | 15 ++++++++++++ src/xrGame/ui/UIActorMenuInitialize.cpp | 3 +++ 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/gamedata/configs/ui/actor_menu.xml b/gamedata/configs/ui/actor_menu.xml index ed2ab27914..dd8b35bb36 100644 --- a/gamedata/configs/ui/actor_menu.xml +++ b/gamedata/configs/ui/actor_menu.xml @@ -327,6 +327,18 @@ + + putall_button + ui_inGame2_big_inventory_button + ui_st_put_all + + + + + + + + exit_button ui_inGame2_big_inventory_button diff --git a/gamedata/configs/ui/actor_menu_16.xml b/gamedata/configs/ui/actor_menu_16.xml index a8d975cb54..8449578720 100644 --- a/gamedata/configs/ui/actor_menu_16.xml +++ b/gamedata/configs/ui/actor_menu_16.xml @@ -265,7 +265,7 @@ - @@ -273,23 +273,23 @@ cell_width="33" cell_height="41" rows_num="1" cols_num="5" cell_sp_x="19" cell_sp_y="0" a="0"/> - - - - - @@ -321,7 +321,7 @@ - + takeall_button ui_inGame2_big_inventory_button ui_st_take_all @@ -333,6 +333,18 @@ + + putall_button + ui_inGame2_big_inventory_button + ui_st_put_all + + + + + + + + exit_button ui_inGame2_big_inventory_button diff --git a/src/xrGame/ui/UIActorMenu.h b/src/xrGame/ui/UIActorMenu.h index 7860cd8428..cbdfac2ca7 100644 --- a/src/xrGame/ui/UIActorMenu.h +++ b/src/xrGame/ui/UIActorMenu.h @@ -164,6 +164,7 @@ class CUIActorMenu : public CUIDialogWnd, CUI3tButton* m_trade_buy_button; CUI3tButton* m_trade_sell_button; CUI3tButton* m_takeall_button; + CUI3tButton* m_putall_button; CUI3tButton* m_exit_button; // CUIStatic* m_clock_value; @@ -334,6 +335,7 @@ class CUIActorMenu : public CUIDialogWnd, void OnBtnPerformTradeSell (CUIWindow* w, void* d); void OnBtnExitClicked (CUIWindow* w, void* d); void TakeAllFromPartner (CUIWindow* w, void* d); + void PutAllToPartner (CUIWindow* w, void* d); void TakeAllFromInventoryBox (); void UpdateConditionProgressBars (); diff --git a/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp b/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp index 953df27df9..3ee9428697 100644 --- a/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp +++ b/src/xrGame/ui/UIActorMenuDeadBodySearch.cpp @@ -57,6 +57,7 @@ void CUIActorMenu::InitDeadBodySearchMode() m_PartnerBottomInfo->Show (true); m_PartnerWeight->Show (true); m_takeall_button->Show (true); + m_putall_button->Show (true); if ( m_pPartnerInvOwner ) { @@ -125,6 +126,7 @@ void CUIActorMenu::DeInitDeadBodySearchMode() m_PartnerBottomInfo->Show (false); m_PartnerWeight->Show (false); m_takeall_button->Show (false); + m_putall_button->Show (false); if ( m_pInvBox ) { @@ -201,6 +203,19 @@ void CUIActorMenu::UpdateDeadBodyBag() m_PartnerBottomInfo->SetWndPos( pos ); } +void CUIActorMenu::PutAllToPartner(CUIWindow* w, void* d) +{ + u32 Iter = 0; + while (Iter < m_pInventoryBagList->ItemsCount()) + { + CUICellItem* ci = m_pInventoryBagList->GetItemIdx(Iter); + if (!ToDeadBodyBag(ci, false)) + { + ++Iter; + } + } +} + void CUIActorMenu::TakeAllFromPartner(CUIWindow* w, void* d) { VERIFY( m_pActorInvOwner ); diff --git a/src/xrGame/ui/UIActorMenuInitialize.cpp b/src/xrGame/ui/UIActorMenuInitialize.cpp index 11e070c926..51f3a1f19e 100644 --- a/src/xrGame/ui/UIActorMenuInitialize.cpp +++ b/src/xrGame/ui/UIActorMenuInitialize.cpp @@ -242,6 +242,7 @@ void CUIActorMenu::Construct() m_trade_buy_button = UIHelper::Create3tButton(uiXml, "trade_buy_button", this); m_trade_sell_button = UIHelper::Create3tButton(uiXml, "trade_sell_button", this); m_takeall_button = UIHelper::Create3tButton(uiXml, "takeall_button", this); + m_putall_button = UIHelper::Create3tButton(uiXml, "putall_button", this); m_exit_button = UIHelper::Create3tButton(uiXml, "exit_button", this); // m_clock_value = UIHelper::CreateStatic(uiXml, "clock_value", this); @@ -391,6 +392,7 @@ void CUIActorMenu::InitCallbacks() Register (m_trade_buy_button); Register (m_trade_sell_button); Register (m_takeall_button); + Register (m_putall_button); Register (m_exit_button); Register (m_UIPropertiesBox); VERIFY (m_pUpgradeWnd); @@ -399,6 +401,7 @@ void CUIActorMenu::InitCallbacks() AddCallback(m_trade_buy_button,BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::OnBtnPerformTradeBuy)); AddCallback(m_trade_sell_button,BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::OnBtnPerformTradeSell)); AddCallback(m_takeall_button, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::TakeAllFromPartner)); + AddCallback(m_putall_button, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::PutAllToPartner)); AddCallback(m_exit_button, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::OnBtnExitClicked)); AddCallback(m_UIPropertiesBox, PROPERTY_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::ProcessPropertiesBoxClicked)); AddCallback(m_pUpgradeWnd->m_btn_repair, BUTTON_CLICKED, CUIWndCallback::void_function(this, &CUIActorMenu::TryRepairItem));