654 lines
19 KiB
C++
654 lines
19 KiB
C++
#include "CAndromedaMenu.hpp"
|
|
|
|
#include <cstdio>
|
|
|
|
#include <ImGui/imgui.h>
|
|
#include <ImGui/imgui_internal.h>
|
|
|
|
#include <AndromedaClient/Settings/Settings.hpp>
|
|
#include <AndromedaClient/CAndromedaGUI.hpp>
|
|
#include <AndromedaClient/Features/CInventoryChanger/CInventoryItemsManager.hpp>
|
|
|
|
static CAndromedaMenu g_CAndromedaMenu{};
|
|
|
|
namespace
|
|
{
|
|
auto AccentU32( const ImVec4& Accent ) -> ImU32
|
|
{
|
|
return ImGui::ColorConvertFloat4ToU32( Accent );
|
|
}
|
|
|
|
// Public-API toggle switch, drawn as a rounded pill.
|
|
bool ToggleSwitch( const char* szID , bool* pbValue , const ImVec4& Accent )
|
|
{
|
|
const float Height = ImGui::GetFrameHeight();
|
|
const float Width = Height * 1.9f;
|
|
|
|
const ImVec2 Pos = ImGui::GetCursorScreenPos();
|
|
|
|
const bool bClicked = ImGui::InvisibleButton( szID , ImVec2( Width , Height ) );
|
|
|
|
ImDrawList* pDraw = ImGui::GetWindowDrawList();
|
|
|
|
const ImU32 Track = *pbValue ? AccentU32( Accent ) : IM_COL32( 255 , 255 , 255 , 22 );
|
|
|
|
pDraw->AddRectFilled( Pos , Pos + ImVec2( Width , Height ) , Track , Height * 0.5f );
|
|
|
|
const float KnobSize = Height - 6.f;
|
|
const float KnobX = *pbValue ? ( Pos.x + Width - KnobSize - 3.f ) : ( Pos.x + 3.f );
|
|
|
|
pDraw->AddCircleFilled( ImVec2( KnobX + KnobSize * 0.5f , Pos.y + Height * 0.5f ) , KnobSize * 0.5f , IM_COL32( 255 , 255 , 255 , 235 ) );
|
|
|
|
if ( bClicked )
|
|
*pbValue = !*pbValue;
|
|
|
|
return bClicked;
|
|
}
|
|
}
|
|
|
|
auto CAndromedaMenu::GetUIScale() -> float
|
|
{
|
|
float Scale = ImGui::GetIO().DisplaySize.y / 1080.f;
|
|
|
|
if ( Scale < 0.75f )
|
|
Scale = 0.75f;
|
|
|
|
if ( Scale > 2.0f )
|
|
Scale = 2.0f;
|
|
|
|
return Scale;
|
|
}
|
|
|
|
auto CAndromedaMenu::OnRenderMenu() -> void
|
|
{
|
|
m_fUIScale = GetUIScale();
|
|
|
|
ImGui::GetIO().FontGlobalScale = m_fUIScale;
|
|
|
|
const float MenuAlpha = static_cast<float>( Settings::Menu::MenuAlpha ) / 255.f;
|
|
|
|
ImGui::PushStyleVar( ImGuiStyleVar_Alpha , MenuAlpha );
|
|
|
|
ImGui::PushStyleColor( ImGuiCol_WindowBg , IM_COL32( 19 , 20 , 24 , 255 ) );
|
|
ImGui::PushStyleColor( ImGuiCol_ChildBg , IM_COL32( 0 , 0 , 0 , 0 ) );
|
|
|
|
ImGui::PushStyleColor( ImGuiCol_FrameBg , IM_COL32( 40 , 42 , 50 , 255 ) );
|
|
ImGui::PushStyleColor( ImGuiCol_FrameBgHovered , IM_COL32( 50 , 53 , 63 , 255 ) );
|
|
ImGui::PushStyleColor( ImGuiCol_FrameBgActive , IM_COL32( 58 , 61 , 73 , 255 ) );
|
|
|
|
ImGui::PushStyleColor( ImGuiCol_CheckMark , m_Accent );
|
|
ImGui::PushStyleColor( ImGuiCol_SliderGrab , m_Accent );
|
|
ImGui::PushStyleColor( ImGuiCol_SliderGrabActive , m_Accent );
|
|
|
|
ImGui::PushStyleColor( ImGuiCol_Button , IM_COL32( 45 , 48 , 58 , 255 ) );
|
|
ImGui::PushStyleColor( ImGuiCol_ButtonHovered , IM_COL32( 55 , 59 , 72 , 255 ) );
|
|
ImGui::PushStyleColor( ImGuiCol_ButtonActive , m_Accent );
|
|
|
|
ImGui::PushStyleColor( ImGuiCol_Header , m_Accent );
|
|
ImGui::PushStyleColor( ImGuiCol_HeaderHovered , IM_COL32( 60 , 45 , 58 , 255 ) );
|
|
ImGui::PushStyleColor( ImGuiCol_HeaderActive , IM_COL32( 70 , 48 , 62 , 255 ) );
|
|
|
|
ImGui::PushStyleVar( ImGuiStyleVar_WindowPadding , ImVec2( 8.f , 8.f ) );
|
|
ImGui::PushStyleVar( ImGuiStyleVar_WindowRounding , 8.f );
|
|
ImGui::PushStyleVar( ImGuiStyleVar_WindowBorderSize , 0.f );
|
|
ImGui::PushStyleVar( ImGuiStyleVar_FrameRounding , 4.f );
|
|
ImGui::PushStyleVar( ImGuiStyleVar_ItemSpacing , ImVec2( 8.f , 6.f ) );
|
|
|
|
const ImVec2 DisplaySize = ImGui::GetIO().DisplaySize;
|
|
|
|
float MenuW = 1120.f * m_fUIScale;
|
|
float MenuH = 640.f * m_fUIScale;
|
|
|
|
if ( MenuW > DisplaySize.x - 16.f )
|
|
MenuW = DisplaySize.x - 16.f;
|
|
|
|
if ( MenuH > DisplaySize.y - 16.f )
|
|
MenuH = DisplaySize.y - 16.f;
|
|
|
|
ImGui::SetNextWindowSize( ImVec2( MenuW , MenuH ) , ImGuiCond_Always );
|
|
ImGui::SetNextWindowPos( ImVec2( ( DisplaySize.x - MenuW ) * 0.5f , ( DisplaySize.y - MenuH ) * 0.5f ) , ImGuiCond_Always );
|
|
|
|
if ( ImGui::Begin( XorStr( "Evicted" ) , nullptr , ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar ) )
|
|
{
|
|
RenderSidebar();
|
|
|
|
ImGui::SameLine( 0.f , 0.f );
|
|
|
|
ImGui::PushStyleVar( ImGuiStyleVar_WindowPadding , ImVec2( 18.f , 16.f ) );
|
|
|
|
if ( ImGui::BeginChild( "##Content" , ImVec2( 0.f , 0.f ) , false ) )
|
|
{
|
|
switch ( m_iSelectedTab )
|
|
{
|
|
case TAB_VISUALS: RenderVisualPanel(); break;
|
|
case TAB_GLOW: RenderGlowPanel(); break;
|
|
case TAB_SKINS: RenderSkinPanel(); break;
|
|
case TAB_MUSIC: RenderMusicPanel(); break;
|
|
case TAB_CONFIG: RenderConfigPanel(); break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
ImGui::EndChild();
|
|
|
|
ImGui::PopStyleVar();
|
|
}
|
|
|
|
ImGui::End();
|
|
|
|
ImGui::PopStyleVar();
|
|
ImGui::PopStyleVar();
|
|
ImGui::PopStyleVar();
|
|
ImGui::PopStyleVar();
|
|
ImGui::PopStyleVar();
|
|
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
ImGui::PopStyleColor();
|
|
|
|
ImGui::PopStyleVar();
|
|
}
|
|
|
|
auto CAndromedaMenu::RenderSidebar() -> void
|
|
{
|
|
const float S = m_fUIScale;
|
|
|
|
const ImVec2 Avail = ImGui::GetContentRegionAvail();
|
|
|
|
ImDrawList* pDraw = ImGui::GetWindowDrawList();
|
|
|
|
const ImVec2 WinMin = ImGui::GetWindowPos();
|
|
const ImVec2 SidebarMax = WinMin + ImVec2( 210.f * S , Avail.y + 16.f );
|
|
|
|
pDraw->AddRectFilled( WinMin , SidebarMax , IM_COL32( 25 , 26 , 32 , 255 ) , 8.f );
|
|
|
|
if ( ImGui::BeginChild( "##Sidebar" , ImVec2( 210.f * S , Avail.y ) , false ) )
|
|
{
|
|
const float HeaderHeight = 92.f * S;
|
|
const ImVec2 HeaderMin = ImGui::GetCursorScreenPos();
|
|
const ImVec2 HeaderMax = HeaderMin + ImVec2( 210.f * S , HeaderHeight );
|
|
|
|
pDraw->AddRectFilled( HeaderMin , HeaderMax , AccentU32( m_Accent ) , 8.f );
|
|
|
|
pDraw->AddRectFilled( ImVec2( HeaderMax.x - 60.f * S , HeaderMin.y ) , HeaderMax , IM_COL32( 0 , 0 , 0 , 18 ) , 8.f );
|
|
pDraw->AddRectFilled( ImVec2( HeaderMin.x , HeaderMax.y - 22.f * S ) , HeaderMax , IM_COL32( 0 , 0 , 0 , 40 ) );
|
|
|
|
ImFont* pIcon = GetAndromedaGUI()->GetIconFont();
|
|
ImFont* pBold = GetAndromedaGUI()->GetBoldSegoeFont();
|
|
|
|
const char* szLogoIcon = "?";
|
|
const char* szLogoText = "EVI CTED";
|
|
const char* szSubText = "ANDROMEDA";
|
|
|
|
const float IconW = pIcon->CalcTextSizeA( 34.f * S , FLT_MAX , 0.f , szLogoIcon ).x;
|
|
|
|
ImGui::SetCursorScreenPos( ImVec2( HeaderMin.x + 18.f * S , HeaderMin.y + 20.f * S ) );
|
|
|
|
ImGui::PushFont( pIcon );
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.95f ) , "%s" , szLogoIcon );
|
|
ImGui::PopFont();
|
|
|
|
ImGui::SameLine( 0.f , 10.f * S );
|
|
|
|
ImGui::PushFont( pBold );
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 1.f ) , "%s" , szLogoText );
|
|
ImGui::PopFont();
|
|
|
|
ImGui::SameLine( 0.f , 8.f * S );
|
|
|
|
ImFont* pSeg = GetAndromedaGUI()->GetSegoeFont();
|
|
ImGui::PushFont( pSeg );
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.85f ) , "%s" , szSubText );
|
|
ImGui::PopFont();
|
|
|
|
ImGui::SetCursorScreenPos( ImVec2( HeaderMin.x + 18.f * S , HeaderMin.y + 52.f * S ) );
|
|
|
|
ImGui::Dummy( ImVec2( 0.f , 34.f * S ) );
|
|
|
|
ImGui::SetCursorPosX( 4.f * S );
|
|
|
|
const ImVec2 TabSize( 202.f * S , 40.f * S );
|
|
|
|
TabButton( "I" , "Visuals" , TAB_VISUALS , TabSize );
|
|
TabButton( "P" , "Glow & Chams" , TAB_GLOW , TabSize );
|
|
TabButton( "T" , "Skins" , TAB_SKINS , TabSize );
|
|
TabButton( "N" , "Music Kit" , TAB_MUSIC , TabSize );
|
|
TabButton( "S" , "Config" , TAB_CONFIG , TabSize );
|
|
|
|
ImGui::SetCursorPosY( ImGui::GetCursorPosY() + 6.f * S );
|
|
|
|
ImGui::Separator();
|
|
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.35f ) , "%s" , " Insert to close" );
|
|
}
|
|
|
|
ImGui::EndChild();
|
|
}
|
|
|
|
auto CAndromedaMenu::TabButton( const char* szIcon , const char* szLabel , const int iTab , const ImVec2& Size ) -> void
|
|
{
|
|
const bool bSelected = ( m_iSelectedTab == iTab );
|
|
|
|
const ImVec2 Pos = ImGui::GetCursorScreenPos();
|
|
const ImVec2 Max = Pos + Size;
|
|
|
|
char szID[ 32 ];
|
|
std::snprintf( szID , sizeof szID , "##tab_%d" , iTab );
|
|
|
|
ImGui::InvisibleButton( szID , Size );
|
|
|
|
const bool bHovered = ImGui::IsItemHovered();
|
|
const bool bClicked = ImGui::IsItemClicked();
|
|
|
|
if ( bClicked )
|
|
m_iSelectedTab = iTab;
|
|
|
|
ImDrawList* pDraw = ImGui::GetWindowDrawList();
|
|
|
|
ImU32 Bg = IM_COL32( 0 , 0 , 0 , 0 );
|
|
|
|
if ( bSelected )
|
|
Bg = AccentU32( m_Accent );
|
|
else if ( bHovered )
|
|
Bg = IM_COL32( 255 , 255 , 255 , 16 );
|
|
|
|
pDraw->AddRectFilled( Pos , Max , Bg , 6.f );
|
|
|
|
const float TextColorOn = bSelected ? 1.f : 0.45f;
|
|
|
|
ImFont* pIcon = GetAndromedaGUI()->GetIconFont();
|
|
ImFont* pText = GetAndromedaGUI()->GetDefaultFont();
|
|
|
|
const float S = m_fUIScale;
|
|
|
|
const ImVec2 Icon( Pos.x + 14.f * S , Pos.y + ( Size.y - 26.f * S ) * 0.5f );
|
|
|
|
pDraw->AddText( pIcon , 26.f * S , Icon , IM_COL32( 255 , 255 , 255 , (int)( TextColorOn * 255.f ) ) , szIcon );
|
|
|
|
const float IconW = pIcon->CalcTextSizeA( 26.f * S , FLT_MAX , 0.f , szIcon ).x;
|
|
|
|
pDraw->AddText( pText , pText->FontSize * S , ImVec2( Icon.x + IconW + 12.f * S , Pos.y + ( Size.y - pText->FontSize * S ) * 0.5f ) , IM_COL32( 255 , 255 , 255 , (int)( TextColorOn * 255.f ) ) , szLabel );
|
|
}
|
|
|
|
auto CAndromedaMenu::RenderVisualPanel() -> void
|
|
{
|
|
BeginPanel( "Visuals" );
|
|
|
|
Toggle( "Enabled" , "##Visual.Active" , Settings::Visual::Active );
|
|
Toggle( "Teammates" , "##Visual.Team" , Settings::Visual::Team );
|
|
Toggle( "Enemies" , "##Visual.Enemy" , Settings::Visual::Enemy );
|
|
Toggle( "Only Visible" , "##Visual.OnlyVisible" , Settings::Visual::OnlyVisible );
|
|
|
|
EndPanel();
|
|
|
|
BeginPanel( "Player Box" );
|
|
|
|
Toggle( "Player Box" , "##Visual.PlayerBox" , Settings::Visual::PlayerBox );
|
|
|
|
const char* PlayerBoxTypeItems[] =
|
|
{
|
|
"Box" , "Outline Box" , "Coal Box" , "Outline Coal Box" , "Glassy Box"
|
|
};
|
|
|
|
if ( Combo( "Type" , "##Visual.PlayerBoxType" , Settings::Visual::PlayerBoxType , PlayerBoxTypeItems , IM_ARRAYSIZE( PlayerBoxTypeItems ) ) )
|
|
{
|
|
if ( Settings::Visual::PlayerBoxType == 5 )
|
|
Settings::Visual::GlassyBox = true;
|
|
else
|
|
Settings::Visual::GlassyBox = false;
|
|
}
|
|
|
|
if ( Settings::Visual::PlayerBoxType == 5 )
|
|
SliderInt( "Glass Opacity" , "##Visual.GlassOpacity" , Settings::Visual::GlassOpacity , 10 , 90 , "%d%%" );
|
|
|
|
EndPanel();
|
|
|
|
BeginPanel( "Skeleton" );
|
|
|
|
Toggle( "Bone ESP" , "##Visual.BoneESP" , Settings::Visual::BoneESP );
|
|
|
|
if ( Settings::Visual::BoneESP )
|
|
{
|
|
Toggle( " Teammates" , "##Visual.BoneESPTeam" , Settings::Visual::BoneESPTeam );
|
|
Toggle( " Enemies" , "##Visual.BoneESPEnemy" , Settings::Visual::BoneESPEnemy );
|
|
}
|
|
|
|
EndPanel();
|
|
}
|
|
|
|
auto CAndromedaMenu::RenderGlowPanel() -> void
|
|
{
|
|
BeginPanel( "Glow" );
|
|
|
|
Toggle( "Glow Enabled" , "##Visual.Glow" , Settings::Visual::Glow );
|
|
|
|
if ( Settings::Visual::Glow )
|
|
{
|
|
Toggle( " Teammates" , "##Visual.GlowTeam" , Settings::Visual::GlowTeam );
|
|
Toggle( " Enemies" , "##Visual.GlowEnemy" , Settings::Visual::GlowEnemy );
|
|
|
|
ImGui::NewLine();
|
|
|
|
ColorEdit( "Glow TT" , "##Colors.Visual.GlowTT" , &Settings::Colors::Visual::GlowTT.x );
|
|
ColorEdit( "Glow TT Visible" , "##Colors.Visual.GlowTT_Visible" , &Settings::Colors::Visual::GlowTT_Visible.x );
|
|
ColorEdit( "Glow CT" , "##Colors.Visual.GlowCT" , &Settings::Colors::Visual::GlowCT.x );
|
|
ColorEdit( "Glow CT Visible" , "##Colors.Visual.GlowCT_Visible" , &Settings::Colors::Visual::GlowCT_Visible.x );
|
|
}
|
|
|
|
EndPanel();
|
|
|
|
BeginPanel( "Chams" );
|
|
|
|
Toggle( "Material Chams" , "##Chams.Enabled" , Settings::Chams::Enabled );
|
|
|
|
if ( Settings::Chams::Enabled )
|
|
{
|
|
Toggle( "Through Walls" , "##Chams.IgnoreZ" , Settings::Chams::IgnoreZ );
|
|
|
|
ImGui::NewLine();
|
|
|
|
ColorEdit( "Visible Color" , "##Chams.Visible" , &Settings::Chams::Visible.x );
|
|
ColorEdit( "Occluded Color" , "##Chams.Occluded" , &Settings::Chams::Occluded.x );
|
|
}
|
|
|
|
EndPanel();
|
|
|
|
BeginPanel( "Glassy Box" );
|
|
|
|
Toggle( "Glass Fill" , "##Visual.GlassyBox" , Settings::Visual::GlassyBox );
|
|
|
|
if ( Settings::Visual::GlassyBox )
|
|
{
|
|
SliderInt( "Opacity" , "##Visual.GlassOpacity" , Settings::Visual::GlassOpacity , 10 , 90 , "%d%%" );
|
|
|
|
ImGui::NewLine();
|
|
|
|
ColorEdit( "Box TT" , "##Colors.Visual.PlayerBoxTT" , &Settings::Colors::Visual::PlayerBoxTT.x );
|
|
ColorEdit( "Box CT" , "##Colors.Visual.PlayerBoxCT" , &Settings::Colors::Visual::PlayerBoxCT.x );
|
|
}
|
|
|
|
EndPanel();
|
|
}
|
|
|
|
auto CAndromedaMenu::RenderSkinPanel() -> void
|
|
{
|
|
auto* pManager = GetInventoryItemsManager();
|
|
|
|
if ( pManager->GetDumpedItems().empty() )
|
|
pManager->ScanAllItems();
|
|
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.4f ) , "%s" , "Select a weapon on the left, then click a skin to apply it instantly." );
|
|
|
|
ImGui::NewLine();
|
|
|
|
const float ItemWidth = ImGui::GetContentRegionAvail().x * 0.42f;
|
|
|
|
if ( ImGui::BeginChild( "##WeaponList" , ImVec2( ItemWidth , 0.f ) , true ) )
|
|
{
|
|
const auto& Items = pManager->GetDumpedItems();
|
|
|
|
for ( size_t i = 0; i < Items.size(); i++ )
|
|
{
|
|
const auto& Item = Items[ i ];
|
|
|
|
if ( Item.m_ItemType == CInventoryItemsManager::EDumpedItemType_t::DUMPED_ITEM_TYPE_MUSIC )
|
|
continue;
|
|
|
|
if ( Item.m_ItemType == CInventoryItemsManager::EDumpedItemType_t::DUMPED_ITEM_TYPE_AGENT )
|
|
continue;
|
|
|
|
const bool bSel = ( static_cast<int>( i ) == m_iSelectedItemIdx );
|
|
|
|
char szLabel[ 128 ];
|
|
std::snprintf( szLabel , sizeof szLabel , "%s (%u)" , Item.m_DisplayName.c_str() , Item.m_DefIdx );
|
|
|
|
if ( ImGui::Selectable( szLabel , bSel ) )
|
|
{
|
|
m_iSelectedItemIdx = static_cast<int>( i );
|
|
m_iSelectedSkinIdx = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
ImGui::EndChild();
|
|
|
|
ImGui::SameLine();
|
|
|
|
if ( ImGui::BeginChild( "##SkinList" , ImVec2( 0.f , 0.f ) , true ) )
|
|
{
|
|
const auto& Items = pManager->GetDumpedItems();
|
|
|
|
if ( m_iSelectedItemIdx >= 0 && m_iSelectedItemIdx < static_cast<int>( Items.size() ) )
|
|
{
|
|
const auto& Item = Items[ m_iSelectedItemIdx ];
|
|
|
|
ImGui::TextColored( m_Accent , "%s" , Item.m_DisplayName.c_str() );
|
|
|
|
ImGui::Separator();
|
|
|
|
if ( Item.m_ItemType == CInventoryItemsManager::EDumpedItemType_t::DUMPED_ITEM_TYPE_GLOVE ||
|
|
Item.m_ItemType == CInventoryItemsManager::EDumpedItemType_t::DUMPED_ITEM_TYPE_KNIFE ||
|
|
Item.m_ItemType == CInventoryItemsManager::EDumpedItemType_t::DUMPED_ITEM_TYPE_WEAPON )
|
|
{
|
|
for ( size_t j = 0; j < Item.m_DumpedSkins.size(); j++ )
|
|
{
|
|
const auto& Skin = Item.m_DumpedSkins[ j ];
|
|
|
|
const bool bSel = ( static_cast<int>( j ) == m_iSelectedSkinIdx );
|
|
|
|
char szLabel[ 256 ];
|
|
std::snprintf( szLabel , sizeof szLabel , "%s [%s]" , Skin.m_DisplayName.c_str() , pManager->GetRarityName( Skin.m_Rarity ).c_str() );
|
|
|
|
const ImU32 Rarity = pManager->GetRarityColor( Skin.m_Rarity );
|
|
|
|
ImGui::PushStyleColor( ImGuiCol_Header , Rarity );
|
|
|
|
if ( ImGui::Selectable( szLabel , bSel ) )
|
|
{
|
|
m_iSelectedSkinIdx = static_cast<int>( j );
|
|
|
|
pManager->SetWeaponSkin( Item.m_DefIdx , Skin.m_ID , true );
|
|
}
|
|
|
|
ImGui::PopStyleColor();
|
|
}
|
|
|
|
ImGui::NewLine();
|
|
|
|
if ( ImGui::Button( "Remove" , ImVec2( 120.f * m_fUIScale , 28.f * m_fUIScale ) ) )
|
|
pManager->RemoveWeaponSkin( Item.m_DefIdx );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.4f ) , "%s" , "No weapon selected." );
|
|
}
|
|
}
|
|
|
|
ImGui::EndChild();
|
|
}
|
|
|
|
auto CAndromedaMenu::RenderMusicPanel() -> void
|
|
{
|
|
auto* pManager = GetInventoryItemsManager();
|
|
|
|
if ( pManager->GetDumpedItems().empty() )
|
|
pManager->ScanAllItems();
|
|
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.4f ) , "%s" , "Click a music kit to apply it instantly. Selecting a new kit replaces the previous one." );
|
|
|
|
ImGui::NewLine();
|
|
|
|
if ( ImGui::BeginChild( "##MusicList" , ImVec2( 0.f , 0.f ) , true ) )
|
|
{
|
|
const auto& Items = pManager->GetDumpedItems();
|
|
|
|
for ( const auto& Item : Items )
|
|
{
|
|
if ( Item.m_ItemType != CInventoryItemsManager::EDumpedItemType_t::DUMPED_ITEM_TYPE_MUSIC )
|
|
continue;
|
|
|
|
for ( const auto& Skin : Item.m_DumpedSkins )
|
|
{
|
|
const bool bSel = ( Skin.m_ID == pManager->GetMusicSelection() );
|
|
|
|
if ( ImGui::Selectable( Skin.m_DisplayName.c_str() , bSel ) )
|
|
{
|
|
m_iSelectedMusicIdx = Skin.m_ID;
|
|
|
|
pManager->SetMusicKit( Skin.m_ID , true );
|
|
}
|
|
}
|
|
}
|
|
|
|
ImGui::NewLine();
|
|
|
|
if ( ImGui::Button( "Reset" , ImVec2( 100.f * m_fUIScale , 28.f * m_fUIScale ) ) )
|
|
pManager->RemoveMusicKit();
|
|
}
|
|
|
|
ImGui::EndChild();
|
|
}
|
|
|
|
auto CAndromedaMenu::RenderConfigPanel() -> void
|
|
{
|
|
BeginPanel( "Menu" );
|
|
|
|
SliderInt( "Menu Alpha" , "##Menu.MenuAlpha" , Settings::Menu::MenuAlpha , 100 , 255 );
|
|
|
|
const char* MenuStyleItems[] =
|
|
{
|
|
"Indigo" , "Vermillion" , "Classic Steam"
|
|
};
|
|
|
|
if ( Combo( "Menu Style" , "##Menu.MenuStyle" , Settings::Menu::MenuStyle , MenuStyleItems , IM_ARRAYSIZE( MenuStyleItems ) ) )
|
|
GetAndromedaGUI()->UpdateStyle();
|
|
|
|
EndPanel();
|
|
|
|
BeginPanel( "Skinchanger" );
|
|
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.4f ) , "%s" , "The skin changer now applies only the skins you configure per weapon." );
|
|
|
|
if ( ImGui::Button( "Clear All Skins" , ImVec2( 150.f * m_fUIScale , 28.f * m_fUIScale ) ) )
|
|
GetInventoryItemsManager()->ClearAllSelections();
|
|
|
|
EndPanel();
|
|
}
|
|
|
|
auto CAndromedaMenu::BeginPanel( const char* szTitle ) -> void
|
|
{
|
|
ImGui::PushID( szTitle );
|
|
|
|
ImGui::PushFont( GetAndromedaGUI()->GetBoldSegoeFont() );
|
|
ImGui::TextColored( ImVec4( 1.f , 1.f , 1.f , 0.95f ) , "%s" , szTitle );
|
|
ImGui::PopFont();
|
|
|
|
ImDrawList* pDraw = ImGui::GetWindowDrawList();
|
|
|
|
const ImVec2 Pos = ImGui::GetCursorScreenPos();
|
|
|
|
const float RightEdge = ImGui::GetWindowPos().x + ImGui::GetWindowContentRegionMax().x;
|
|
|
|
const float AccentW = 28.f * m_fUIScale;
|
|
|
|
pDraw->AddRectFilled( Pos , ImVec2( Pos.x + AccentW , Pos.y + 2.f ) , AccentU32( m_Accent ) );
|
|
pDraw->AddRectFilled( ImVec2( Pos.x + AccentW , Pos.y + 2.f ) , ImVec2( RightEdge , Pos.y + 2.f ) , IM_COL32( 255 , 255 , 255 , 18 ) );
|
|
|
|
ImGui::SetCursorPosY( ImGui::GetCursorPosY() + 12.f );
|
|
|
|
ImGui::Indent( 4.f );
|
|
}
|
|
|
|
auto CAndromedaMenu::EndPanel() -> void
|
|
{
|
|
ImGui::Unindent( 4.f );
|
|
|
|
ImGui::SetCursorPosY( ImGui::GetCursorPosY() + 14.f );
|
|
|
|
ImGui::PopID();
|
|
}
|
|
|
|
auto CAndromedaMenu::Toggle( const char* szLabel , const char* szStrID , bool& bValue ) -> bool
|
|
{
|
|
ImGui::AlignTextToFramePadding();
|
|
ImGui::TextUnformatted( szLabel );
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::SetCursorPosX( ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 40.f );
|
|
|
|
return ToggleSwitch( szStrID , &bValue , m_Accent );
|
|
}
|
|
|
|
auto CAndromedaMenu::SliderInt( const char* szLabel , const char* szStrID , int& iValue , int iMin , int iMax , const char* szFormat ) -> bool
|
|
{
|
|
ImGui::AlignTextToFramePadding();
|
|
ImGui::TextUnformatted( szLabel );
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::PushItemWidth( ImGui::GetContentRegionAvail().x - 10.f );
|
|
const bool bRet = ImGui::SliderInt( szStrID , &iValue , iMin , iMax , szFormat );
|
|
ImGui::PopItemWidth();
|
|
|
|
return bRet;
|
|
}
|
|
|
|
auto CAndromedaMenu::SliderFloat( const char* szLabel , const char* szStrID , float& fValue , float fMin , float fMax , const char* szFormat ) -> bool
|
|
{
|
|
ImGui::AlignTextToFramePadding();
|
|
ImGui::TextUnformatted( szLabel );
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::PushItemWidth( ImGui::GetContentRegionAvail().x - 10.f );
|
|
const bool bRet = ImGui::SliderFloat( szStrID , &fValue , fMin , fMax , szFormat );
|
|
ImGui::PopItemWidth();
|
|
|
|
return bRet;
|
|
}
|
|
|
|
auto CAndromedaMenu::Combo( const char* szLabel , const char* szStrID , int& iValue , const char* Items[] , int iItemsCount ) -> bool
|
|
{
|
|
ImGui::AlignTextToFramePadding();
|
|
ImGui::TextUnformatted( szLabel );
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::PushItemWidth( ImGui::GetContentRegionAvail().x - 10.f );
|
|
const bool bRet = ImGui::Combo( szStrID , &iValue , Items , iItemsCount );
|
|
ImGui::PopItemWidth();
|
|
|
|
return bRet;
|
|
}
|
|
|
|
auto CAndromedaMenu::ColorEdit( const char* szLabel , const char* szStrID , float* flColor ) -> bool
|
|
{
|
|
ImGui::AlignTextToFramePadding();
|
|
ImGui::TextUnformatted( szLabel );
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::PushItemWidth( ImGui::GetContentRegionAvail().x - 10.f );
|
|
const bool bRet = ImGui::ColorEdit4( szStrID , flColor , ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoInputs );
|
|
ImGui::PopItemWidth();
|
|
|
|
return bRet;
|
|
}
|
|
|
|
auto GetAndromedaMenu() -> CAndromedaMenu*
|
|
{
|
|
return &g_CAndromedaMenu;
|
|
} |