diff --git a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp index f9cb5a87..8a002783 100644 --- a/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotHitscan/AimbotHitscan.cpp @@ -700,7 +700,7 @@ static inline void DrawVisuals(CTFPlayer* pLocal, Target_t& tTarget, int nWeapon if (G::Attacking == 1 && nWeaponID != TF_WEAPON_LASER_POINTER) { - bool bLine = Vars::Visuals::Line::Enabled.Value; + bool bLine = Vars::Visuals::Line::TracersEnabled.Value; bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot; if (bLine || bBoxes) { diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index 7d3e0c1b..d2407e5e 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -495,7 +495,7 @@ static inline void DrawVisuals(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserC G::AimPoint = { tTarget.m_vPos, I::GlobalVars->tickcount }; bool bPath = Vars::Visuals::Prediction::SwingLines.Value && Vars::Visuals::Prediction::PlayerPath.Value; - bool bLine = Vars::Visuals::Line::Enabled.Value; + bool bLine = Vars::Visuals::Line::TracersEnabled.Value; bool bBoxes = Vars::Visuals::Hitbox::BonesEnabled.Value & Vars::Visuals::Hitbox::BonesEnabledEnum::OnShot; if (bPath || bLine || bBoxes) { diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp index 72d2a42c..5442ea55 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.cpp @@ -217,14 +217,9 @@ float CAimbotProjectile::GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pPla return flRadius * flScale; } -float CAimbotProjectile::GetSplashRadius(CBaseEntity* pProjectile, CTFWeaponBase* pWeapon, CTFPlayer* pPlayer, float flScale, CTFWeaponBase* pAirblast) +float CAimbotProjectile::GetSplashRadius(CBaseEntity* pProjectile, CTFWeaponBase* pWeapon, CTFPlayer* pPlayer, float flScale) { float flRadius = 0.f; - if (pAirblast) - { - pWeapon = pAirblast; - pPlayer = pWeapon->m_hOwner()->As(); - } switch (pProjectile->GetClassID()) { case ETFClassID::CTFWeaponBaseGrenadeProj: @@ -283,9 +278,9 @@ static inline bool ShouldLob(MoveStorage& tMoveStorage, Info_t& tInfo) return tInfo.m_bIgnoreTiming && (tMoveStorage.m_bFailed || tMoveStorage.m_pPlayer->IsOnGround()); } -static inline bool AirSplash(CTFWeaponBase* pWeapon) +static inline bool AirSplash(CTFWeaponBase* pWeapon, Info_t& tInfo) { - if (!(Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::AirSplash)) + if (!(Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::AirSplash) || tInfo.m_pProjectile) return false; switch (pWeapon->GetWeaponID()) @@ -657,7 +652,7 @@ void CAimbotProjectile::SetupSplashPoints(Vec3& vOrigin, std::vector& v Vec3 vTargetEye = vOrigin + m_tInfo.m_vTargetEye; Vec3 vTargetCenter = vOrigin + m_tInfo.m_pTarget->m_pEntity->GetOffset() / 2; float flRadius = m_tInfo.m_flRadius + m_tInfo.m_pTarget->m_pEntity->GetSize().Length() / 2; - bool bAirSplash = AirSplash(m_tInfo.m_pWeapon); + bool bAirSplash = AirSplash(m_tInfo.m_pWeapon, m_tInfo); auto fCheckNormal = [&](const Vec3& vNormal, const Vec3& vPoint, Vec3* pAngle = nullptr) { @@ -780,7 +775,7 @@ std::vector CAimbotProjectile::GetSplashPoints(Vec3 vOrigin, std::vecto m_tInfo.m_pTarget->m_vPos = vOrigin; Vec3 vTargetEye = vOrigin + m_tInfo.m_vTargetEye; float flRadiusSqr = powf(m_tInfo.m_flRadius, 2), flRadiusAirSqr = flRadiusSqr; - if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::AirSplash && m_tInfo.m_pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER) + if (Vars::Aimbot::Projectile::Modifiers.Value & Vars::Aimbot::Projectile::ModifiersEnum::AirSplash && !m_tInfo.m_pProjectile && m_tInfo.m_pWeapon->GetWeaponID() == TF_WEAPON_PIPEBOMBLAUNCHER) { static auto tf_grenadelauncher_livetime = H::ConVars.FindVar("tf_grenadelauncher_livetime"); static auto tf_sticky_radius_ramp_time = H::ConVars.FindVar("tf_sticky_radius_ramp_time"); @@ -1280,17 +1275,18 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i case PointTypeEnum::Air: bValid = !trace.DidHit(); break; } + if (bValid && iType != PointTypeEnum::Direct) { - CGameTrace eyeTrace = {}; - SDK::Trace(trace.endpos + trace.plane.normal * m_tInfo.m_flNormalOffset, tTarget.m_vPos + m_tInfo.m_vTargetEye, MASK_SHOT, &filter, &eyeTrace); - bValid = eyeTrace.fraction == 1.f; + CGameTrace trace2 = {}; + SDK::Trace(trace.endpos + trace.plane.normal * m_tInfo.m_flNormalOffset, tTarget.m_vPos + m_tInfo.m_vTargetEye, MASK_SHOT, &filter, &trace2); + bValid = trace2.fraction == 1.f; #ifdef SPLASH_DEBUG5 s_mTraceCount[__FUNCTION__": splash eye trace"]++; #endif #ifdef SPLASH_DEBUG4 //G::LineStorage.emplace_back(std::pair(trace.endpos, trace.endpos + trace.plane.normal * m_tInfo.m_flNormalOffset), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 255)); - G::LineStorage.emplace_back(std::pair(eyeTrace.startpos, eyeTrace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 255)); + G::LineStorage.emplace_back(std::pair(trace2.startpos, trace2.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 255)); G::BoxStorage.emplace_back(trace.endpos + m_tInfo.m_flNormalOffset * trace.plane.normal, -vHull, vHull, Vec3(), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 255), Color_t(0, 0, 0, 0)); #endif } @@ -1302,6 +1298,32 @@ bool CAimbotProjectile::TestAngle(const Vec3& vPoint, const Vec3& vAngles, int i G::BoxStorage.emplace_back(vPoint, -vHull, vHull, Vec3(), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 0), Color_t(0, 0, 0, 0)); #endif + if (bValid && Vars::Aimbot::Projectile::IntervalRetest.Value && iTraceInterval != 1) + { + CGameTrace trace2 = {}; Vec3 vOld, vNew; + int iTicks = int(m_tProjInfo.m_vPath.size()); + if (m_tInfo.m_flGravity) + iTicks -= iTimingTolerance; + + for (int i = 1; i < iTicks; i++) + { + vOld = m_tProjInfo.m_vPath[i - 1], vNew = m_tProjInfo.m_vPath[i]; + SDK::TraceHull(vOld, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace2); + bValid = !trace2.DidHit(); +#ifdef SPLASH_DEBUG5 + s_mTraceCount[__FUNCTION__": trace (retest)"]++; +#endif +#ifdef SPLASH_DEBUG4 + G::LineStorage.emplace_back(std::pair(trace2.startpos, trace2.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 255, 0)); + if (!bValid) + G::BoxStorage.emplace_back(trace2.endpos, -vHull, vHull, Vec3(), I::GlobalVars->curtime + 5.f, Color_t(255, 255, 0), Color_t(0, 0, 0, 0)); +#endif + + if (!bValid) + break; + } + } + if (bValid) { if (iTraceInterval != 1 && iType != PointTypeEnum::Direct) @@ -2180,11 +2202,30 @@ bool CAimbotProjectile::TestAngle(CBaseEntity* pProjectile, const Vec3& vPoint, case PointTypeEnum::Air: bValid = !trace.DidHit(); break; } + if (bValid && iType != PointTypeEnum::Direct) { - CGameTrace eyeTrace = {}; - SDK::Trace(trace.endpos + trace.plane.normal * m_tInfo.m_flNormalOffset, tTarget.m_vPos + m_tInfo.m_vTargetEye, MASK_SHOT, &filter, &eyeTrace); - bValid = eyeTrace.fraction == 1.f; + CGameTrace trace2 = {}; + SDK::Trace(trace.endpos + trace.plane.normal * m_tInfo.m_flNormalOffset, tTarget.m_vPos + m_tInfo.m_vTargetEye, MASK_SHOT, &filter, &trace2); + bValid = trace2.fraction == 1.f; + } + + if (bValid && Vars::Aimbot::Projectile::IntervalRetest.Value && iTraceInterval != 1) + { + CGameTrace trace2 = {}; Vec3 vOld, vNew; + int iTicks = int(m_tProjInfo.m_vPath.size()); + if (m_tInfo.m_flGravity) + iTicks -= iTimingTolerance; + + for (int i = 1; i < iTicks; i++) + { + vOld = m_tProjInfo.m_vPath[i - 1], vNew = m_tProjInfo.m_vPath[i]; + SDK::TraceHull(vOld, vNew, -m_tProjInfo.m_vHull, m_tProjInfo.m_vHull, nMask, &filter, &trace2); + bValid = !trace2.DidHit(); + + if (!bValid) + break; + } } if (bValid) @@ -2257,7 +2298,7 @@ bool CAimbotProjectile::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBa m_tInfo.m_iSplashRestrict = !m_tInfo.m_flGravity ? Vars::Aimbot::Projectile::SplashRestrictDirect.Value : Vars::Aimbot::Projectile::SplashRestrictArc.Value; float flSize = tTarget.m_pEntity->GetSize().Length(); - m_tInfo.m_flRadius = GetSplashRadius(pProjectile, m_tProjInfo.m_pWeapon, m_tProjInfo.m_pOwner, Vars::Aimbot::Projectile::SplashRadius.Value / 100, pWeapon); + m_tInfo.m_flRadius = GetSplashRadius(pProjectile, pWeapon, pLocal, Vars::Aimbot::Projectile::SplashRadius.Value / 100); m_tInfo.m_flBoundsTime = tTarget.m_pEntity->GetSize().Length() / m_tInfo.m_flVelocity; m_tInfo.m_flRadiusTime = m_tInfo.m_flBoundsTime + m_tInfo.m_flRadius / m_tInfo.m_flVelocity; m_tInfo.m_bIgnoreTiming = Vars::Aimbot::Projectile::LobAnglesUnderpredict.Value && m_tInfo.m_flRadius; diff --git a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h index 33fa522e..6a1ec180 100644 --- a/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h +++ b/Amalgam/src/Features/Aimbot/AimbotProjectile/AimbotProjectile.h @@ -134,7 +134,7 @@ public: float GetSplashRadius(CTFWeaponBase* pWeapon, CTFPlayer* pPlayer, float flScale = 1.f); bool AutoAirblast(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, CBaseEntity* pProjectile); - float GetSplashRadius(CBaseEntity* pProjectile, CTFWeaponBase* pWeapon = nullptr, CTFPlayer* pPlayer = nullptr, float flScale = 1.f, CTFWeaponBase* pAirblast = nullptr); + float GetSplashRadius(CBaseEntity* pProjectile, CTFWeaponBase* pWeapon = nullptr, CTFPlayer* pPlayer = nullptr, float flScale = 1.f); int m_iLastTickCancel = 0; }; diff --git a/Amalgam/src/Features/Backtrack/Backtrack.cpp b/Amalgam/src/Features/Backtrack/Backtrack.cpp index a73897c4..26f6a4d6 100644 --- a/Amalgam/src/Features/Backtrack/Backtrack.cpp +++ b/Amalgam/src/Features/Backtrack/Backtrack.cpp @@ -133,6 +133,7 @@ bool CBacktrack::GetRecords(CBaseEntity* pEntity, std::vector& vRet return false; auto& vRecords = m_mRecords[pEntity]; + vReturn.reserve(vRecords.size()); for (auto& tRecord : vRecords) vReturn.push_back(&tRecord); return true; diff --git a/Amalgam/src/Features/ImGui/Menu/Components.h b/Amalgam/src/Features/ImGui/Menu/Components.h index 7dfd4865..d6b00e23 100644 --- a/Amalgam/src/Features/ImGui/Menu/Components.h +++ b/Amalgam/src/Features/ImGui/Menu/Components.h @@ -114,31 +114,30 @@ namespace ImGui ImVec2 m_vPos; ImVec2 m_vSize; }; - static std::vector vRowSizes = {}; + static std::vector vRowSizesRegular = {}, vRowSizesPopup = {}; + static auto pRowSizes = &vRowSizesRegular; inline void AddRowSize(ImVec2 vPos, ImVec2 vSize) { - if (GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup) - return; + pRowSizes = GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup ? &vRowSizesPopup : &vRowSizesRegular; vPos += GetDrawPos(); - if (!vRowSizes.empty() && vRowSizes.back().m_vPos.y != vPos.y) - vRowSizes.clear(); - vRowSizes.emplace_back(vPos, vSize); + if (!pRowSizes->empty() && pRowSizes->back().m_vPos.y != vPos.y) + pRowSizes->clear(); + pRowSizes->emplace_back(vPos, vSize); } inline float GetRowPos(bool bDrawPos = false) { - if (!vRowSizes.empty()) - return vRowSizes.front().m_vPos.y - (!bDrawPos ? GetDrawPos().y : 0.f); + if (!pRowSizes->empty()) + return pRowSizes->front().m_vPos.y - (!bDrawPos ? GetDrawPos().y : 0.f); else return GetCursorPosY() + (bDrawPos ? GetDrawPos().y : 0.f); } inline float GetRowSize(float flDefault = 0.f) { - if (GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup) - return flDefault; + pRowSizes = GetCurrentWindow()->Flags & ImGuiWindowFlags_Popup ? &vRowSizesPopup : &vRowSizesRegular; float flMax = 0.f; - for (auto& [_, vSize] : vRowSizes) + for (auto& [_, vSize] : *pRowSizes) flMax = std::max(flMax, vSize.y); return flMax; } @@ -447,8 +446,8 @@ namespace ImGui PushFont(pFont); ImDrawList* pDrawList = GetForegroundDrawList(); - ImVec2 vPos = pPosOverride ? *pPosOverride : !vRowSizes.empty() ? vRowSizes.back().m_vPos : ImVec2((GetItemRectMin().x + GetItemRectMax().x) / 2, GetItemRectMax().y); - ImVec2 vSize = pSizeOverride ? *pSizeOverride : !vRowSizes.empty() ? vRowSizes.back().m_vSize : ImVec2(); + ImVec2 vPos = pPosOverride ? *pPosOverride : !pRowSizes->empty() ? pRowSizes->back().m_vPos : ImVec2((GetItemRectMin().x + GetItemRectMax().x) / 2, GetItemRectMax().y); + ImVec2 vSize = pSizeOverride ? *pSizeOverride : !pRowSizes->empty() ? pRowSizes->back().m_vSize : ImVec2(); std::deque vWraps = WrapText(sTooltip, H::Draw.Scale(flWrapWidth)); ImVec2 vText = { 0, H::Draw.Scale(9) }; @@ -494,7 +493,7 @@ namespace ImGui } } - inline void FText(const char* sText, int iFlags = FTextEnum::None, ImFont* pFont = nullptr) + inline void FText(const char* sText, ImVec2 vOffset = {}, int iFlags = FTextEnum::None, ImFont * pFont = nullptr) { if (Transparent || Disabled) PushStyleVar(ImGuiStyleVar_Alpha, 0.5f); @@ -513,6 +512,7 @@ namespace ImGui else if (iFlags & FTextEnum::Right) SetCursorPosX(flWindowWidth - flTextWidth - GetStyle().WindowPadding.x); } + SetCursorPos(GetCursorPos() + vOffset * H::Draw.Scale()); TextUnformatted(sText); if (pFont) @@ -522,7 +522,7 @@ namespace ImGui PopStyleVar(); } - inline bool FInputText(const char* sLabel, std::string& sText, float flWidth = H::Draw.Scale(150), int iFlags = ImGuiInputTextFlags_None, ImGuiInputTextCallback fCallback = nullptr) + inline bool FInputText(const char* sLabel, std::string& sText, float flWidth = H::Draw.Scale(150), ImGuiInputTextFlags iFlags = ImGuiInputTextFlags_None, ImGuiInputTextCallback fCallback = nullptr) { PushStyleVar(ImGuiStyleVar_FramePadding, { H::Draw.Scale(8), H::Draw.Scale(8) }); PushItemWidth(flWidth); @@ -594,33 +594,56 @@ namespace ImGui return Disabled ? false : bReturn; } - inline bool FBeginPopup(const char* sLabel, ImGuiWindowFlags iFlags = ImGuiWindowFlags_NoSavedSettings) + inline bool FBeginPopup(const char* sLabel, float flOffset = 0.f, ImGuiWindowFlags iFlags = ImGuiWindowFlags_NoSavedSettings) { - PushStyleColor(ImGuiCol_PopupBg, {}); + bool bReturn = BeginPopup(sLabel, iFlags | ImGuiWindowFlags_NoBackground); - bool bReturn = BeginPopup(sLabel, iFlags); - - PopStyleColor(); if (bReturn) + { RenderBackground(F::Render.Background0p5, F::Render.Background2); + if (flOffset) + SetCursorPosY(GetCursorPosY() + H::Draw.Scale(flOffset)); + } + return bReturn; } - inline bool FBeginPopupModal(const char* sLabel, bool* pOpen = nullptr, ImGuiWindowFlags iFlags = ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar) + inline bool FBeginPopupModal(const char* sLabel, float flOffset = 0.f, bool* pOpen = nullptr, ImGuiWindowFlags iFlags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings) { - PushStyleColor(ImGuiCol_PopupBg, {}); + bool bReturn = BeginPopupModal(sLabel, pOpen, iFlags | ImGuiWindowFlags_NoBackground); - bool bReturn = BeginPopupModal(sLabel, pOpen, iFlags); - - PopStyleColor(); if (bReturn) + { RenderBackground(F::Render.Background0p5, F::Render.Background2); + if (flOffset) + SetCursorPosY(GetCursorPosY() + H::Draw.Scale(flOffset)); + } + return bReturn; } - inline bool FSelectable(const char* sLabel, ImVec4* pColor, float flRounding = H::Draw.Scale(4), bool bSelected = false, int iFlags = ImGuiSelectableFlags_None, const ImVec2& vSize = {}) + inline bool FPopupButton(const char* sLabel, ImVec2 vOffset = {}, float flOffset = 0.f, int iFlags = FButtonEnum::SameLine, const char* sIcon = nullptr) + { + if (iFlags & FButtonEnum::SameLine) + SameLine(GetWindowWidth() - H::Draw.Scale(33)); + SetCursorPos(GetCursorPos() + vOffset * H::Draw.Scale()); + + ImVec2 vIdealPosition = GetDrawPos() + ImVec2(0, GetCursorPosY() + H::Draw.Scale(23) + GetStyle().WindowPadding.y); + ImVec2 vIdealSize = { GetWindowWidth(), 0 }; + + if (!sIcon) + sIcon = IsPopupOpen(sLabel) ? ICON_MD_KEYBOARD_ARROW_UP : ICON_MD_KEYBOARD_ARROW_DOWN; + if (IconButton(sIcon)) + OpenPopup(sLabel); + + SetNextWindowPos(vIdealPosition, ImGuiCond_Appearing); + SetNextWindowSize(vIdealSize, ImGuiCond_Appearing); + return FBeginPopup(sLabel, flOffset); + } + + inline bool FSelectable(const char* sLabel, ImVec4* pColor, float flRounding = H::Draw.Scale(4), bool bSelected = false, ImGuiSelectableFlags iFlags = ImGuiSelectableFlags_None, const ImVec2& vSize = {}) { PushStyleVar(ImGuiStyleVar_FrameRounding, flRounding); if (pColor) @@ -640,7 +663,7 @@ namespace ImGui return bReturn; } - inline bool FSelectable(const char* sLabel, ImVec4 tColor = { 0.2f, 0.6f, 0.85f, 1.f }, float flRounding = H::Draw.Scale(4), bool bSelected = false, int iFlags = ImGuiSelectableFlags_None, const ImVec2& vSize = {}) + inline bool FSelectable(const char* sLabel, ImVec4 tColor = { 0.2f, 0.6f, 0.85f, 1.f }, float flRounding = H::Draw.Scale(4), bool bSelected = false, ImGuiSelectableFlags iFlags = ImGuiSelectableFlags_None, const ImVec2& vSize = {}) { return FSelectable(sLabel, &tColor, flRounding, bSelected, iFlags, vSize); } @@ -729,7 +752,7 @@ namespace ImGui PopStyleVar(); } - inline std::vector WidgetTable(int iCount, float flHeight, std::vector vWidths = {}, int iWindowFlags = ImGuiChildFlags_AlwaysUseWindowPadding, int iChildFlags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse) + inline std::vector WidgetTable(int iCount, float flHeight, std::vector vWidths = {}, ImGuiChildFlags iWindowFlags = ImGuiChildFlags_AlwaysUseWindowPadding, ImGuiWindowFlags iChildFlags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse) { std::vector vReturn = {}; @@ -754,7 +777,7 @@ namespace ImGui float flWidth = vWidths[i] + GetStyle().WindowPadding.x * (iCount - 1) / iCount; vReturn.emplace_back( std::format("{}", i), - ImVec2(flTotalWidth - GetStyle().WindowPadding.x / 2, GetCursorPos().y - H::Draw.Scale(8)), + ImVec2(flTotalWidth - GetStyle().WindowPadding.x / 2, GetCursorPos().y), ImVec2(flWidth, flHeight), iWindowFlags, iChildFlags @@ -768,7 +791,12 @@ namespace ImGui inline bool BeginWidgetTable(int iIndex, std::vector& vTable) { SetCursorPos(vTable[iIndex].m_vPos); - return BeginChild(vTable[iIndex].m_sName.c_str(), vTable[iIndex].m_vSize, vTable[iIndex].m_iWindowFlags, vTable[iIndex].m_iChildFlags); + bool bReturn = BeginChild(vTable[iIndex].m_sName.c_str(), vTable[iIndex].m_vSize, vTable[iIndex].m_iWindowFlags, vTable[iIndex].m_iChildFlags); + + if (bReturn) + SetCursorPosY(GetCursorPosY() - H::Draw.Scale(8)); + + return bReturn; } // widgets @@ -2076,9 +2104,9 @@ namespace ImGui PopID(); } - inline void FKeybind(ConfigVar& var, int iFlags = FKeybindEnum::None, std::vector vIgnore = { Vars::Menu::PrimaryKey[DEFAULT_BIND], Vars::Menu::SecondaryKey[DEFAULT_BIND] }, ImVec2 vSize = { 0, 30 }, int iSizeOffset = 0, bool* pHovered = nullptr) + inline void FKeybind(ConfigVar& tVar, int iFlags = FKeybindEnum::None, std::vector vIgnore = { Vars::Menu::PrimaryKey[DEFAULT_BIND], Vars::Menu::SecondaryKey[DEFAULT_BIND] }, ImVec2 vSize = { 0, 30 }, int iSizeOffset = 0, bool* pHovered = nullptr) { - FKeybind(var.m_vNames.front(), var[DEFAULT_BIND], iFlags, vIgnore, vSize, iSizeOffset, pHovered); + FKeybind(tVar.m_vNames.front(), tVar[DEFAULT_BIND], iFlags, vIgnore, vSize, iSizeOffset, pHovered); } // dropdown for materials @@ -2260,9 +2288,9 @@ namespace ImGui // convar wrappers template - inline int GetBind(ConfigVar& var, bool bForce = false) + inline int GetBind(ConfigVar& tVar, bool bForce = false) { - if (var.m_iFlags & (NOSAVE | NOBIND)) + if (tVar.m_iFlags & (NOSAVE | NOBIND)) return DEFAULT_BIND; if (bForce) @@ -2271,7 +2299,7 @@ namespace ImGui int iParent = CurrentBind; while (true) { - if (iParent == DEFAULT_BIND || var.contains(iParent)) + if (iParent == DEFAULT_BIND || tVar.contains(iParent)) break; iParent = F::Binds.GetParent(iParent); } @@ -2279,38 +2307,38 @@ namespace ImGui } template - inline T GetParentValue(ConfigVar& var, int iBind) // oh my god + inline T GetParentValue(ConfigVar& tVar, int iBind) // oh my god { int iParent = iBind; while (true) { iParent = F::Binds.GetParent(iParent); - if (iParent == DEFAULT_BIND || var.contains(iParent)) + if (iParent == DEFAULT_BIND || tVar.contains(iParent)) break; } - return var[iParent]; + return tVar[iParent]; } bool bPushedDisabled = false, bPushedTransparent = false; template - inline T& FGet(ConfigVar& var, bool bDisable = false) + inline T& FGet(ConfigVar& tVar, bool bDisable = false) { - int iBind = GetBind(var); + int iBind = GetBind(tVar); if (bDisable) { bPushedDisabled = false, bPushedTransparent = false; if (CurrentBind == DEFAULT_BIND) { - if (Vars::Menu::MenuShowsBinds.Value && var[DEFAULT_BIND] != var.Value) + if (Vars::Menu::MenuShowsBinds.Value && tVar[DEFAULT_BIND] != tVar.Value) { - for (auto& [_iBind, tVal] : var.Map) + for (auto& [_iBind, tVal] : tVar.Map) { if (_iBind == DEFAULT_BIND) continue; - if (tVal == var.Value) + if (tVal == tVar.Value) { PushDisabled(true); bPushedDisabled = true; @@ -2321,42 +2349,42 @@ namespace ImGui } else { - PushTransparent(CurrentBind != iBind && !(var.m_iFlags & (NOSAVE | NOBIND))); + PushTransparent(CurrentBind != iBind && !(tVar.m_iFlags & (NOSAVE | NOBIND))); bPushedTransparent = true; } } - return var[iBind]; + return tVar[iBind]; } template - inline void FSet(ConfigVar& var, T val) + inline void FSet(ConfigVar& tVar, T tVal) { if (!Disabled) { - int iBind = GetBind(var, true); - auto tVal = GetParentValue(var, iBind); + int iBind = GetBind(tVar, true); + auto _tVal = GetParentValue(tVar, iBind); - if (tVal != val) + if (tVal != _tVal) { - var[iBind] = val; + tVar[iBind] = tVal; if (iBind < F::Binds.m_vBinds.size()) { auto& tBind = *std::next(F::Binds.m_vBinds.begin(), iBind); - if (std::find(tBind.m_vVars.begin(), tBind.m_vVars.end(), &var) == tBind.m_vVars.end()) - tBind.m_vVars.push_back(&var); + if (std::find(tBind.m_vVars.begin(), tBind.m_vVars.end(), &tVar) == tBind.m_vVars.end()) + tBind.m_vVars.push_back(&tVar); } } else if (iBind != DEFAULT_BIND) { - for (auto it = var.Map.begin(); it != var.Map.end();) + for (auto it = tVar.Map.begin(); it != tVar.Map.end();) { if (it->first == iBind) { - it = var.Map.erase(it); + it = tVar.Map.erase(it); if (iBind < F::Binds.m_vBinds.size()) { auto& tBind = *std::next(F::Binds.m_vBinds.begin(), iBind); - auto it2 = std::find(tBind.m_vVars.begin(), tBind.m_vVars.end(), &var); + auto it2 = std::find(tBind.m_vVars.begin(), tBind.m_vVars.end(), &tVar); if (it2 != tBind.m_vVars.end()) tBind.m_vVars.erase(it2); } @@ -2374,7 +2402,7 @@ namespace ImGui } template - inline void DrawBindInfo(ConfigVar& var, T& val, const std::string& sBind, bool bNewPopup, bool& bLastHovered) + inline void DrawBindInfo(ConfigVar& tVar, T& tVal, const char* sType, const std::string& sBind, bool bNewPopup, bool& bLastHovered) { TextUnformatted(std::format("Bind '{}'", sBind).c_str()); @@ -2390,7 +2418,7 @@ namespace ImGui std::vector vValues = {}; std::vector vStrings = {}; // prevent dangling pointers - for (auto& _iBind : var.Map | std::views::keys) + for (auto& _iBind : tVar.Map | std::views::keys) { if (_iBind != DEFAULT_BIND) vValues.push_back(_iBind); @@ -2408,14 +2436,14 @@ namespace ImGui vValues.push_back(-1); int iModified = -2; - if (FDropdown("Bind", &iBind, vEntries, vValues, FDropdownEnum::Modifiable, -85, "None", nullptr, &iModified)) + if (FDropdown("##Bind", &iBind, vEntries, vValues, FDropdownEnum::Modifiable, -84, "None", nullptr, &iModified)) { if (iBind != DEFAULT_BIND && iBind < F::Binds.m_vBinds.size()) tBind = F::Binds.m_vBinds[iBind]; else tBind = { sBind }; - if (var.contains(iBind)) - val = var[iBind]; + if (tVar.contains(iBind)) + tVal = tVar[iBind]; } bool bClickedNew = iBind == DEFAULT_BIND && bLastHovered && IsMouseDown(ImGuiMouseButton_Left); if (iModified != -2 || bClickedNew) @@ -2424,19 +2452,19 @@ namespace ImGui { iBind = int(F::Binds.m_vBinds.size()); tBind = { sBind }; - tBind.m_vVars.push_back(&var); + tBind.m_vVars.push_back(&tVar); F::Binds.AddBind(iBind, tBind); } else { - auto it = var.Map.find(iModified); - if (it != var.Map.end()) + auto it = tVar.Map.find(iModified); + if (it != tVar.Map.end()) { - var.Map.erase(it); + tVar.Map.erase(it); if (iModified < F::Binds.m_vBinds.size()) { auto& tBind = *std::next(F::Binds.m_vBinds.begin(), iModified); - auto it2 = std::find(tBind.m_vVars.begin(), tBind.m_vVars.end(), &var); + auto it2 = std::find(tBind.m_vVars.begin(), tBind.m_vVars.end(), &tVar); if (it2 != tBind.m_vVars.end()) tBind.m_vVars.erase(it2); } @@ -2452,23 +2480,23 @@ namespace ImGui { ImVec2 vOriginalPos = GetCursorPos(); - int iOffset = 9; + int iOffset = 12; PushTransparent(Transparent || !tBind.m_bEnabled, true); - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(29) }); PushTransparent(Transparent || tBind.m_iVisibility == BindVisibilityEnum::Hidden, true); if (IconButton(tBind.m_iVisibility == BindVisibilityEnum::Always ? ICON_MD_VISIBILITY : ICON_MD_VISIBILITY_OFF, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered)) tBind.m_iVisibility = (tBind.m_iVisibility + 1) % 3; PopTransparent(1, 1); bLastHovered |= bHovered; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(29) }); if (IconButton(!tBind.m_bNot ? ICON_MD_CODE : ICON_MD_CODE_OFF, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered)) tBind.m_bNot = !tBind.m_bNot; bLastHovered |= bHovered; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(36) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(iOffset += 25), H::Draw.Scale(29) }); if (IconButton(!tBind.m_bEnabled ? ICON_MD_TOGGLE_OFF : ICON_MD_TOGGLE_ON, H::Draw.Scale(24), { 1, 1, 1, -1 }, &bHovered)) tBind.m_bEnabled = !tBind.m_bEnabled; bLastHovered |= bHovered; @@ -2478,27 +2506,39 @@ namespace ImGui SetCursorPos(vOriginalPos); } - FDropdown("Type", &tBind.m_iType, { "Key", "Class", "Weapon type", "Item slot", "Misc" }, {}, FDropdownEnum::Left, 0, "None", &bHovered); - bLastHovered |= bHovered; - switch (tBind.m_iType) - { - case BindEnum::Key: FDropdown("Behavior", &tBind.m_iInfo, { "Hold", "Toggle", "Double click" }, {}, FDropdownEnum::Right, 0, "None", &bHovered); break; - case BindEnum::Class: FDropdown("Class", &tBind.m_iInfo, { "Scout", "Soldier", "Pyro", "Demoman", "Heavy", "Engineer", "Medic", "Sniper", "Spy" }, {}, FDropdownEnum::Right, 0, "None", &bHovered); break; - case BindEnum::WeaponType: FDropdown("Weapon type", &tBind.m_iInfo, { "Hitscan", "Projectile", "Melee", "Throwable" }, {}, FDropdownEnum::Right, 0, "None", &bHovered); break; - case BindEnum::ItemSlot: FDropdown("Item slot", &tBind.m_iInfo, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, {}, FDropdownEnum::Right, 0, "None", &bHovered); break; - case BindEnum::Misc: FDropdown("Misc", &tBind.m_iInfo, { "Spectated", "Spectated 1st", "Spectated 3rd", "##Divider", "Zoomed", "Aiming" }, {}, FDropdownEnum::Right); break; - } - bLastHovered |= bHovered; + auto vTable = tBind.m_iType == BindEnum::Key ? WidgetTable(3, H::Draw.Scale(40), { H::Draw.Scale(80), H::Draw.Scale(104), H::Draw.Scale(116) + 1 }) : WidgetTable(2, H::Draw.Scale(40)); - if (tBind.m_iType == BindEnum::Key) + if (BeginWidgetTable(0, vTable)) { - FKeybind("Key", tBind.m_iKey, FKeybindEnum::None, { Vars::Menu::PrimaryKey[DEFAULT_BIND], Vars::Menu::SecondaryKey[DEFAULT_BIND] }, { 0, 30 }, 0, &bHovered); + FDropdown("Type", &tBind.m_iType, { "Key", "Class", "Weapon type", "Item slot", "Misc" }, {}, FDropdownEnum::None, 0, "None", &bHovered); bLastHovered |= bHovered; + } EndChild(); + + if (BeginWidgetTable(1, vTable)) + { + switch (tBind.m_iType) + { + case BindEnum::Key: FDropdown("Behavior", &tBind.m_iInfo, { "Hold", "Toggle", "Double click" }, {}, FDropdownEnum::None, 0, "None", &bHovered); break; + case BindEnum::Class: FDropdown("Class", &tBind.m_iInfo, { "Scout", "Soldier", "Pyro", "Demoman", "Heavy", "Engineer", "Medic", "Sniper", "Spy" }, {}, FDropdownEnum::None, 0, "None", &bHovered); break; + case BindEnum::WeaponType: FDropdown("Weapon type", &tBind.m_iInfo, { "Hitscan", "Projectile", "Melee", "Throwable" }, {}, FDropdownEnum::None, 0, "None", &bHovered); break; + case BindEnum::ItemSlot: FDropdown("Item slot", &tBind.m_iInfo, { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, {}, FDropdownEnum::None, 0, "None", &bHovered); break; + case BindEnum::Misc: FDropdown("Misc", &tBind.m_iInfo, { "Spectated", "Spectated 1st", "Spectated 3rd", "##Divider", "Zoomed", "Aiming" }, {}, FDropdownEnum::None); break; + } + bLastHovered |= bHovered; + } EndChild(); + + if (vTable.size() == 3) + { + if (BeginWidgetTable(2, vTable)) + { + FKeybind("Key", tBind.m_iKey, FKeybindEnum::None, { Vars::Menu::PrimaryKey[DEFAULT_BIND], Vars::Menu::SecondaryKey[DEFAULT_BIND] }, { 0, 40 }, 0, &bHovered); + bLastHovered |= bHovered; + } EndChild(); } if (!Disabled && iBind != DEFAULT_BIND && iBind < F::Binds.m_vBinds.size()) { - var[iBind] = val; + tVar[iBind] = tVal; // don't completely override to retain misc info auto& _tBind = F::Binds.m_vBinds[iBind]; @@ -2510,46 +2550,54 @@ namespace ImGui _tBind.m_bNot = tBind.m_bNot; } - DebugDummy({ 0, GetStyle().WindowPadding.y }); + switch (FNV1A::Hash32(sType)) + { + case FNV1A::Hash32Const("FDropdown"): + case FNV1A::Hash32Const("FSDropdown"): + case FNV1A::Hash32Const("FMDropdown"): + break; + default: + DebugDummy({ 0, GetStyle().WindowPadding.y }); + } } #define WRAPPER(function, type, parameters, arguments) \ - inline bool function(ConfigVar& var, parameters, bool* pHovered = nullptr, int iBindOverride = -1, int iLabelOverride = -1) \ + inline bool function(ConfigVar& tVar, parameters, bool* pHovered = nullptr, int iBindOverride = -1, int iLabelOverride = -1) \ { \ - const char* sLabel = iLabelOverride != -1 ? var.m_vNames[iLabelOverride] : var.m_vNames.front(); \ - int iVarFlags = var.m_iFlags & ~(VISUAL | NOSAVE | NOBIND | DEBUGVAR); \ + const char* sLabel = iLabelOverride != -1 ? tVar.m_vNames[iLabelOverride] : tVar.m_vNames.front(); \ + int iVarFlags = tVar.m_iFlags & ~(VISUAL | NOSAVE | NOBIND | DEBUGVAR); \ iFlags |= iVarFlags; \ - auto val = FGet(var, true); \ + auto tVal = FGet(tVar, true); \ bool bHovered = false; \ - bool bReturn = function(std::format("{}## {}", sLabel, var.Name()).c_str(), arguments, &bHovered); \ - FSet(var, val); \ + bool bReturn = function(std::format("{}## {}", sLabel, tVar.Name()).c_str(), arguments, &bHovered); \ + FSet(tVar, tVal); \ if (pHovered) \ *pHovered = bHovered; \ - if (!(var.m_iFlags & (NOBIND | NOSAVE)) && !Disabled && CurrentBind == DEFAULT_BIND) \ + if (!(tVar.m_iFlags & (NOBIND | NOSAVE)) && !Disabled && CurrentBind == DEFAULT_BIND) \ { /*probably a better way to do this*/ \ - static auto staticVal = val; \ + static auto tStaticVal = tVal; \ bool bNewPopup = bHovered && IsMouseReleased(ImGuiMouseButton_Right) && !IsMouseDown(ImGuiMouseButton_Left) && !IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopupId); \ if (bNewPopup) \ { \ - OpenPopup(var.Name()); \ - staticVal = val; \ + OpenPopup(tVar.Name()); \ + tStaticVal = tVal; \ } \ - SetNextWindowSize({ H::Draw.Scale(300), 0 }); \ - bool bPopup = FBeginPopup(var.Name()); \ + SetNextWindowSize({ H::Draw.Scale(300), 0 }, ImGuiCond_Always); \ + bool bPopup = FBeginPopup(tVar.Name()); \ if (bPopup) \ { \ - std::string sBind = iBindOverride != -1 ? var.m_vNames[iBindOverride] : var.m_vNames.back(); \ + std::string sBind = iBindOverride != -1 ? tVar.m_vNames[iBindOverride] : tVar.m_vNames.back(); \ std::transform(sBind.begin(), sBind.end(), sBind.begin(), ::tolower); \ iFlags = iVarFlags; /*get rid of any visual flags*/ \ if (FNV1A::Hash32Const(#function) == FNV1A::Hash32Const("FColorPicker")) \ iFlags |= FColorPickerEnum::Full | FColorPickerEnum::RemoveVisuals; \ PushTransparent(false); \ static bool bLastHovered = false; \ - DrawBindInfo(var, staticVal, StripDoubleHash(sBind.c_str()), bNewPopup, bLastHovered); \ - val = staticVal; \ - function(std::format("{}## Bind", var.m_vNames.front()).c_str(), arguments, &bHovered); \ + DrawBindInfo(tVar, tStaticVal, #function, StripDoubleHash(sBind.c_str()), bNewPopup, bLastHovered); \ + tVal = tStaticVal; \ + function(std::format("{}## Bind", tVar.m_vNames.front()).c_str(), arguments, &bHovered); \ bLastHovered |= bHovered; \ - staticVal = val; \ + tStaticVal = tVal; \ PopTransparent(2); \ EndPopup(); \ } \ @@ -2557,16 +2605,16 @@ namespace ImGui return bReturn; \ } - WRAPPER(FToggle, bool, VA_LIST(int iFlags = 0), VA_LIST(&val, iFlags)) - WRAPPER(FToggle, int, VA_LIST(int iBit, int iFlags = 0), VA_LIST(&val, iBit, iFlags)) - WRAPPER(FSlider, FloatRange_t, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&val.Min, &val.Max, var.m_unMin.f, var.m_unMax.f, var.m_unStep.f, sFormatOverride ? sFormatOverride : var.m_sExtra, iFlags)) - WRAPPER(FSlider, IntRange_t, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&val.Min, &val.Max, var.m_unMin.i, var.m_unMax.i, var.m_unStep.i, sFormatOverride ? sFormatOverride : var.m_sExtra, iFlags)) - WRAPPER(FSlider, float, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&val, var.m_unMin.f, var.m_unMax.f, var.m_unStep.f, sFormatOverride ? sFormatOverride : var.m_sExtra, iFlags)) - WRAPPER(FSlider, int, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&val, var.m_unMin.i, var.m_unMax.i, var.m_unStep.i, sFormatOverride ? sFormatOverride : var.m_sExtra, iFlags)) - WRAPPER(FDropdown, int, VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&val, var.m_vValues, {}, iFlags, iSizeOffset, var.m_sExtra ? var.m_sExtra : "None")) - WRAPPER(FDropdown, int, VA_LIST(std::vector vEntries, std::vector vValues = {}, int iFlags = 0, int iSizeOffset = 0), VA_LIST(&val, vEntries, vValues, iFlags, iSizeOffset, var.m_sExtra ? var.m_sExtra : "None")) - WRAPPER(FSDropdown, std::string, VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&val, var.m_vValues, iFlags, iSizeOffset)) - WRAPPER(FMDropdown, VA_LIST(std::vector>), VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&val, iFlags, iSizeOffset)) - WRAPPER(FColorPicker, Color_t, VA_LIST(int iFlags = 0, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}), VA_LIST(&val, iFlags, vOffset, vSize, vIconOffset)) - WRAPPER(FColorPicker, Gradient_t, VA_LIST(bool bStart = true, int iFlags = 0, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}), VA_LIST(bStart ? &val.StartColor : &val.EndColor, iFlags, vOffset, vSize, vIconOffset)) + WRAPPER(FToggle, bool, VA_LIST(int iFlags = 0), VA_LIST(&tVal, iFlags)) + WRAPPER(FToggle, int, VA_LIST(int iBit, int iFlags = 0), VA_LIST(&tVal, iBit, iFlags)) + WRAPPER(FSlider, FloatRange_t, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&tVal.Min, &tVal.Max, tVar.m_unMin.f, tVar.m_unMax.f, tVar.m_unStep.f, sFormatOverride ? sFormatOverride : tVar.m_sExtra, iFlags)) + WRAPPER(FSlider, IntRange_t, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&tVal.Min, &tVal.Max, tVar.m_unMin.i, tVar.m_unMax.i, tVar.m_unStep.i, sFormatOverride ? sFormatOverride : tVar.m_sExtra, iFlags)) + WRAPPER(FSlider, float, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&tVal, tVar.m_unMin.f, tVar.m_unMax.f, tVar.m_unStep.f, sFormatOverride ? sFormatOverride : tVar.m_sExtra, iFlags)) + WRAPPER(FSlider, int, VA_LIST(int iFlags = 0, const char* sFormatOverride = nullptr), VA_LIST(&tVal, tVar.m_unMin.i, tVar.m_unMax.i, tVar.m_unStep.i, sFormatOverride ? sFormatOverride : tVar.m_sExtra, iFlags)) + WRAPPER(FDropdown, int, VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&tVal, tVar.m_vValues, {}, iFlags, iSizeOffset, tVar.m_sExtra ? tVar.m_sExtra : "None")) + WRAPPER(FDropdown, int, VA_LIST(std::vector vEntries, std::vector vValues = {}, int iFlags = 0, int iSizeOffset = 0), VA_LIST(&tVal, vEntries, vValues, iFlags, iSizeOffset, tVar.m_sExtra ? tVar.m_sExtra : "None")) + WRAPPER(FSDropdown, std::string, VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&tVal, tVar.m_vValues, iFlags, iSizeOffset)) + WRAPPER(FMDropdown, VA_LIST(std::vector>), VA_LIST(int iFlags = 0, int iSizeOffset = 0), VA_LIST(&tVal, iFlags, iSizeOffset)) + WRAPPER(FColorPicker, Color_t, VA_LIST(int iFlags = 0, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}), VA_LIST(&tVal, iFlags, vOffset, vSize, vIconOffset)) + WRAPPER(FColorPicker, Gradient_t, VA_LIST(bool bStart = true, int iFlags = 0, ImVec2 vOffset = {}, ImVec2 vSize = { H::Draw.Scale(12), H::Draw.Scale(12) }, ImVec2 vIconOffset = {}), VA_LIST(bStart ? &tVal.StartColor : &tVal.EndColor, iFlags, vOffset, vSize, vIconOffset)) } \ No newline at end of file diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index cd40eb36..95307395 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -47,10 +47,10 @@ void CMenu::DrawMenu() pDrawList->AddRectFilled(vDrawPos + ImVec2(0, flOffset), vDrawPos + ImVec2(flSize - flInset, vWindowSize.y), F::Render.Background0, H::Draw.Scale(3), ImDrawFlags_RoundCornersBottomLeft); SetCursorPos({ H::Draw.Scale(12), H::Draw.Scale(11) }); - FText("Editing bind", 0, F::Render.FontRegular); + FText("Editing bind", {}, 0, F::Render.FontRegular); SetCursorPos({ H::Draw.Scale(12), H::Draw.Scale(35) }); PushStyleColor(ImGuiCol_Text, F::Render.Accent.Value); - FText(TruncateText(tBind.m_sName, flSize - H::Draw.Scale(28)).c_str(), 0, F::Render.FontRegular); + FText(TruncateText(tBind.m_sName, flSize - H::Draw.Scale(28)).c_str(), {}, 0, F::Render.FontRegular); PopStyleColor(); SetCursorPos({ flSize - H::Draw.Scale(31), H::Draw.Scale(6) }); @@ -66,7 +66,7 @@ void CMenu::DrawMenu() SetCursorPos({ H::Draw.Scale(12), H::Draw.Scale(11) }); PushStyleColor(ImGuiCol_Text, F::Render.Accent.Value); - FText(TruncateText(Vars::Menu::CheatTitle.Value, flSize - H::Draw.Scale(28), F::Render.FontBold).c_str(), 0, F::Render.FontBold); + FText(TruncateText(Vars::Menu::CheatTitle.Value, flSize - H::Draw.Scale(28), F::Render.FontBold).c_str(), {}, 0, F::Render.FontBold); PopStyleColor(); } else @@ -85,7 +85,7 @@ void CMenu::DrawMenu() { "VISUALS", "ESP", "MISC##", "MENU" }, { "MISC" }, { "LOGS", "PLAYERLIST", "SETTINGS##", "OUTPUT" }, - { "SETTINGS", "CONFIG", "BINDS", "MATERIALS", "EXTRA" } + { "SETTINGS", "CONFIG", "BINDS", "MATERIALS", "MISC##" } }, { &iTab, &iAimbotTab, nullptr, &iVisualsTab, nullptr, &iLogsTab, &iSettingsTab }, { flSize - H::Draw.Scale(16), H::Draw.Scale(36) }, @@ -180,13 +180,19 @@ void CMenu::MenuAimbot(int iTab) } EndSection(); if (Vars::Debug::Options.Value) { - if (Section("##Debug Aimbot", -8)) + if (Section("##Debug Aimbot")) { - FDropdown(Vars::Aimbot::General::AimHoldsFire); - FSlider(Vars::Aimbot::General::NoSpreadOffset); - FSlider(Vars::Aimbot::General::NoSpreadAverage); - FSlider(Vars::Aimbot::General::NoSpreadInterval); - FSlider(Vars::Aimbot::General::NoSpreadBackupInterval); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 }, -8)) + { + FDropdown(Vars::Aimbot::General::AimHoldsFire); + FSlider(Vars::Aimbot::General::NoSpreadOffset); + FSlider(Vars::Aimbot::General::NoSpreadAverage); + FSlider(Vars::Aimbot::General::NoSpreadInterval); + FSlider(Vars::Aimbot::General::NoSpreadBackupInterval); + + EndPopup(); + } } EndSection(); } if (Section("Backtrack", 8)) @@ -200,7 +206,13 @@ void CMenu::MenuAimbot(int iTab) { if (Section("##Debug Backtrack")) { - FSlider(Vars::Backtrack::Offset); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FSlider(Vars::Backtrack::Offset); + + EndPopup(); + } } EndSection(); } if (Section("Healing")) @@ -217,10 +229,16 @@ void CMenu::MenuAimbot(int iTab) { if (Section("##Debug Healing")) { - FSlider(Vars::Aimbot::Healing::AutoVaccinatorBulletScale); - FSlider(Vars::Aimbot::Healing::AutoVaccinatorBlastScale); - FSlider(Vars::Aimbot::Healing::AutoVaccinatorFireScale); - FToggle(Vars::Aimbot::Healing::AutoVaccinatorFlamethrowerDamageOnly); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FSlider(Vars::Aimbot::Healing::AutoVaccinatorBulletScale); + FSlider(Vars::Aimbot::Healing::AutoVaccinatorBlastScale); + FSlider(Vars::Aimbot::Healing::AutoVaccinatorFireScale); + FToggle(Vars::Aimbot::Healing::AutoVaccinatorFlamethrowerDamageOnly); + + EndPopup(); + } } EndSection(); } } @@ -241,12 +259,18 @@ void CMenu::MenuAimbot(int iTab) } EndSection(); if (Vars::Debug::Options.Value) { - if (Section("##Debug Hitscan", -8)) + if (Section("##Debug Hitscan")) { - FDropdown(Vars::Aimbot::Hitscan::PeekCheck, FDropdownEnum::None, 0, &Hovered); FTooltip("This should stay as doubletap only or off if you want to be able to target hitboxes other than the highest priority one", Hovered); - FSlider(Vars::Aimbot::Hitscan::PeekAmount); - FSlider(Vars::Aimbot::Hitscan::BoneSizeSubtract); - FSlider(Vars::Aimbot::Hitscan::BoneSizeMinimumScale); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 }, -8)) + { + FDropdown(Vars::Aimbot::Hitscan::PeekCheck, FDropdownEnum::None, 0, &Hovered); FTooltip("This should stay as doubletap only or off if you want to be able to target hitboxes other than the highest priority one", Hovered); + FSlider(Vars::Aimbot::Hitscan::PeekAmount); + FSlider(Vars::Aimbot::Hitscan::BoneSizeSubtract); + FSlider(Vars::Aimbot::Hitscan::BoneSizeMinimumScale); + + EndPopup(); + } } EndSection(); } if (Section("Projectile")) @@ -275,84 +299,101 @@ void CMenu::MenuAimbot(int iTab) { if (Section("##Debug Projectile")) { - FText("Ground"); - Divider(); - FSlider(Vars::Aimbot::Projectile::GroundSamples, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::GroundStraightFuzzyValue, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::GroundLowMinimumSamples, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::GroundHighMinimumSamples, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::GroundLowMinimumDistance, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::GroundHighMinimumDistance, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::GroundMaxChanges, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::GroundMaxChangeTime, FSliderEnum::Right); - - Divider(); - FText("Air"); - Divider(); - FSlider(Vars::Aimbot::Projectile::AirSamples, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::AirStraightFuzzyValue, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::AirLowMinimumSamples, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::AirHighMinimumSamples, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::AirLowMinimumDistance, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::AirHighMinimumDistance, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::AirMaxChanges, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::AirMaxChangeTime, FSliderEnum::Right); - - Divider(); - FText("General"); - Divider(); - FSlider(Vars::Aimbot::Projectile::VelocityAverageCount, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::VerticalShift, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::DragOverride, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::TimeOverride, FSliderEnum::Right); - FToggle(Vars::Aimbot::Projectile::LobAnglesUnderpredict); - - Divider(); - FSlider(Vars::Aimbot::Projectile::HuntsmanLerp, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::HuntsmanLerpLow, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::HuntsmanAdd, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::HuntsmanAddLow, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::HuntsmanClamp, FSliderEnum::Left); - FToggle(Vars::Aimbot::Projectile::HuntsmanPullPoint, FSliderEnum::Left); - FToggle(Vars::Aimbot::Projectile::HuntsmanPullNoZ, FToggleEnum::Right); - - Divider(); - FText("Splash"); - Divider(H::Draw.Scale(8), H::Draw.Scale(-1)); - FDropdown(Vars::Aimbot::Projectile::SplashMode); - PushTransparent(Vars::Aimbot::Projectile::SplashMode.Value != Vars::Aimbot::Projectile::SplashModeEnum::Trace); + FText("General", { 5, 5 }); + if (FPopupButton("General", { 0, -5 })) { - FSlider(Vars::Aimbot::Projectile::SplashPointsDirect, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::SplashPointsArc, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::SplashRotateX, FSliderEnum::Left, Vars::Aimbot::Projectile::SplashRotateX[DEFAULT_BIND] < 0.f ? "random" : "%g"); - FSlider(Vars::Aimbot::Projectile::SplashRotateY, FSliderEnum::Right, Vars::Aimbot::Projectile::SplashRotateY[DEFAULT_BIND] < 0.f ? "random" : "%g"); + FSlider(Vars::Aimbot::Projectile::VelocityAverageCount, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::VerticalShift, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::DragOverride, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::TimeOverride, FSliderEnum::Right); + FToggle(Vars::Aimbot::Projectile::LobAnglesUnderpredict); + + Divider(); + FSlider(Vars::Aimbot::Projectile::HuntsmanLerp, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::HuntsmanLerpLow, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::HuntsmanAdd, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::HuntsmanAddLow, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::HuntsmanClamp, FSliderEnum::Left); + FToggle(Vars::Aimbot::Projectile::HuntsmanPullPoint, FSliderEnum::Left); + FToggle(Vars::Aimbot::Projectile::HuntsmanPullNoZ, FToggleEnum::Right); + + EndPopup(); } - PopTransparent(); - PushTransparent(Vars::Aimbot::Projectile::SplashMode.Value != Vars::Aimbot::Projectile::SplashModeEnum::Face); + + FText("Splash", { 5, 5 }); + if (FPopupButton("Splash", { 0, -5 }, -8)) { - FSlider(Vars::Aimbot::Projectile::SplashDensityDirect, FSliderEnum::Left); - FSlider(Vars::Aimbot::Projectile::SplashDensityArc, FSliderEnum::Right); - FSlider(Vars::Aimbot::Projectile::SplashSamplesCutoff); + FDropdown(Vars::Aimbot::Projectile::SplashMode); + PushTransparent(Vars::Aimbot::Projectile::SplashMode.Value != Vars::Aimbot::Projectile::SplashModeEnum::Trace); + { + FSlider(Vars::Aimbot::Projectile::SplashPointsDirect, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::SplashPointsArc, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::SplashRotateX, FSliderEnum::Left, Vars::Aimbot::Projectile::SplashRotateX[DEFAULT_BIND] < 0.f ? "random" : "%g"); + FSlider(Vars::Aimbot::Projectile::SplashRotateY, FSliderEnum::Right, Vars::Aimbot::Projectile::SplashRotateY[DEFAULT_BIND] < 0.f ? "random" : "%g"); + } + PopTransparent(); + PushTransparent(Vars::Aimbot::Projectile::SplashMode.Value != Vars::Aimbot::Projectile::SplashModeEnum::Face); + { + FSlider(Vars::Aimbot::Projectile::SplashDensityDirect, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::SplashDensityArc, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::SplashSamplesCutoff); + } + PopTransparent(); + FSlider(Vars::Aimbot::Projectile::SplashAirCount, FSliderEnum::None, !Vars::Aimbot::Projectile::SplashAirCount[DEFAULT_BIND] ? "random" : "%i"); + + Divider(); + FSlider(Vars::Aimbot::Projectile::SplashRestrictDirect); + FSlider(Vars::Aimbot::Projectile::SplashRestrictArc); + FSlider(Vars::Aimbot::Projectile::SplashRestrictFirst); + + Divider(); + FSlider(Vars::Aimbot::Projectile::DirectTraceInterval); + FSlider(Vars::Aimbot::Projectile::SplashTraceInterval); + FSlider(Vars::Aimbot::Projectile::LobTraceInterval); + FToggle(Vars::Aimbot::Projectile::IntervalRetest); + + EndPopup(); } - PopTransparent(); - FSlider(Vars::Aimbot::Projectile::SplashAirCount, FSliderEnum::None, !Vars::Aimbot::Projectile::SplashAirCount[DEFAULT_BIND] ? "random" : "%i"); - Divider(); - FSlider(Vars::Aimbot::Projectile::SplashRestrictDirect); - FSlider(Vars::Aimbot::Projectile::SplashRestrictArc); - FSlider(Vars::Aimbot::Projectile::SplashRestrictFirst); + FText("Ground", { 5, 5 }); + if (FPopupButton("Ground", { 0, -5 })) + { + FSlider(Vars::Aimbot::Projectile::GroundSamples, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::GroundStraightFuzzyValue, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::GroundLowMinimumSamples, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::GroundHighMinimumSamples, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::GroundLowMinimumDistance, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::GroundHighMinimumDistance, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::GroundMaxChanges, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::GroundMaxChangeTime, FSliderEnum::Right); - Divider(); - FSlider(Vars::Aimbot::Projectile::DirectTraceInterval); - FSlider(Vars::Aimbot::Projectile::SplashTraceInterval); - FSlider(Vars::Aimbot::Projectile::LobTraceInterval); + EndPopup(); + } - Divider(); - FText("Misc"); - Divider(); - FSlider(Vars::Aimbot::Projectile::DeltaCount, FSliderEnum::Left); - FDropdown(Vars::Aimbot::Projectile::DeltaMode, FDropdownEnum::Right); - FDropdown(Vars::Aimbot::Projectile::MovesimFrictionFlags); + FText("Air", { 5, 5 }); + if (FPopupButton("Air", { 0, -5 })) + { + FSlider(Vars::Aimbot::Projectile::AirSamples, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::AirStraightFuzzyValue, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::AirLowMinimumSamples, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::AirHighMinimumSamples, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::AirLowMinimumDistance, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::AirHighMinimumDistance, FSliderEnum::Right); + FSlider(Vars::Aimbot::Projectile::AirMaxChanges, FSliderEnum::Left); + FSlider(Vars::Aimbot::Projectile::AirMaxChangeTime, FSliderEnum::Right); + + EndPopup(); + } + + FText("Misc", { 5, 5 }); + if (FPopupButton("Misc", { 0, -5 })) + { + FSlider(Vars::Aimbot::Projectile::DeltaCount, FSliderEnum::Left); + FDropdown(Vars::Aimbot::Projectile::DeltaMode, FDropdownEnum::Right); + FDropdown(Vars::Aimbot::Projectile::MovesimFrictionFlags); + + EndPopup(); + } } EndSection(); } if (Section("Melee", 8)) @@ -366,10 +407,16 @@ void CMenu::MenuAimbot(int iTab) { if (Section("##Debug Melee")) { - FSlider(Vars::Aimbot::Melee::SwingOffset, FSliderEnum::Left); - FToggle(Vars::Aimbot::Melee::SwingPredictLag, FToggleEnum::Right); - FToggle(Vars::Aimbot::Melee::BackstabAccountPing, FToggleEnum::Left); - FToggle(Vars::Aimbot::Melee::BackstabDoubleTest, FToggleEnum::Right); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FSlider(Vars::Aimbot::Melee::SwingOffset, FSliderEnum::Left); + FToggle(Vars::Aimbot::Melee::SwingPredictLag, FToggleEnum::Right); + FToggle(Vars::Aimbot::Melee::BackstabAccountPing, FToggleEnum::Left); + FToggle(Vars::Aimbot::Melee::BackstabDoubleTest, FToggleEnum::Right); + + EndPopup(); + } } EndSection(); } } @@ -389,7 +436,7 @@ void CMenu::MenuAimbot(int iTab) { FColorPicker(Vars::Colors::LineIgnoreZ, FColorPickerEnum::None, { 0, H::Draw.Scale(6) }, { H::Draw.Scale(12), H::Draw.Scale(6) }); FColorPicker(Vars::Colors::Line, FColorPickerEnum::None, {}, { H::Draw.Scale(12), H::Draw.Scale(6) }); - FToggle(Vars::Visuals::Line::Enabled); + FToggle(Vars::Visuals::Line::TracersEnabled); FSlider(Vars::Visuals::Line::DrawDuration); } EndSection(); if (Section("Hitbox")) @@ -451,99 +498,109 @@ void CMenu::MenuAimbot(int iTab) } EndSection(); if (Vars::Debug::Options.Value) { - if (Section("##Debug Part1", -8)) + if (Section("##Debug")) { - FDropdown(Vars::Visuals::Prediction::RealPath, FDropdownEnum::None, -10); - FColorPicker(Vars::Colors::RealPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) }); - FColorPicker(Vars::Colors::RealPathIgnoreZ, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) }); - - FSlider(Vars::Visuals::Path::SeparatorSpacing, FSliderEnum::Left); - FSlider(Vars::Visuals::Path::SeparatorLength, FSliderEnum::Right); - } EndSection(); - if (Section("##Debug Part2")) - { - FToggle(Vars::Visuals::Trajectory::Override); - bool bApply = FButton("Apply current"); - FSDropdown(Vars::Visuals::Trajectory::Type); - FSlider(Vars::Visuals::Trajectory::OffsetX); - FSlider(Vars::Visuals::Trajectory::OffsetY); - FSlider(Vars::Visuals::Trajectory::OffsetZ); - FSlider(Vars::Visuals::Trajectory::ForwardRedirect); - FSlider(Vars::Visuals::Trajectory::ForwardCutoff); - FSlider(Vars::Visuals::Trajectory::Hull); - FSlider(Vars::Visuals::Trajectory::Speed); - FSlider(Vars::Visuals::Trajectory::Gravity); - FSlider(Vars::Visuals::Trajectory::LifeTime); - FSlider(Vars::Visuals::Trajectory::UpVelocity); - FSlider(Vars::Visuals::Trajectory::AngularVelocityX); - FSlider(Vars::Visuals::Trajectory::AngularVelocityY); - FSlider(Vars::Visuals::Trajectory::AngularVelocityZ); - FSlider(Vars::Visuals::Trajectory::Drag); - FSlider(Vars::Visuals::Trajectory::DragX); - FSlider(Vars::Visuals::Trajectory::DragY); - FSlider(Vars::Visuals::Trajectory::DragZ); - FSlider(Vars::Visuals::Trajectory::AngularDragX); - FSlider(Vars::Visuals::Trajectory::AngularDragY); - FSlider(Vars::Visuals::Trajectory::AngularDragZ); - FSlider(Vars::Visuals::Trajectory::MaxVelocity); - FSlider(Vars::Visuals::Trajectory::MaxAngularVelocity); - - if (bApply) + FText("Extra", { 5, 5 }); + if (FPopupButton("Extra", { 0, -5 }, -8)) { - auto pLocal = H::Entities.GetLocal(); - auto pWeapon = H::Entities.GetWeapon(); - if (pLocal && pWeapon) - { - ProjectileInfo tProjInfo = {}; - bool bOriginal = Vars::Visuals::Trajectory::Override.Value; - Vars::Visuals::Trajectory::Override.Value = false; - bool bSetup = F::ProjSim.GetInfo(pLocal, pWeapon, {}, tProjInfo, ProjSimEnum::Interp) - && F::ProjSim.Initialize(tProjInfo, false); - Vars::Visuals::Trajectory::Override.Value = bOriginal; - if (bSetup) - { - Vec3 vLocalEye = pLocal->GetEyePosition(); - Vec3 vOffset = tProjInfo.m_vPos - vLocalEye; vOffset.y *= -1; - float flForwardRedirect = 0.f, flForwardCutoff = 0.f; - switch (tProjInfo.m_uType) - { - case FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl"): - case FNV1A::Hash32Const("models/weapons/w_models/w_drg_ball.mdl"): - case FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"): - case FNV1A::Hash32Const("models/weapons/w_models/w_arrow.mdl"): - case FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl"): - case FNV1A::Hash32Const("models/weapons/w_models/w_repair_claw.mdl"): - flForwardRedirect = 2000.f, flForwardCutoff = 0.1f; break; - case FNV1A::Hash32Const("models/weapons/c_models/c_flameball/c_flameball.mdl"): - flForwardRedirect = H::ConVars.FindVar("tf_fireball_distance")->GetFloat(), flForwardCutoff = 1.f; - } - physics_performanceparams_t params = {}; F::ProjSim.m_pEnv->GetPerformanceSettings(¶ms); - Vec3 vVelocity, vAngVelocity; F::ProjSim.m_pObj->GetVelocity(&vVelocity, &vAngVelocity); + FDropdown(Vars::Visuals::Prediction::RealPath, FDropdownEnum::None, -10); + FColorPicker(Vars::Colors::RealPath, FColorPickerEnum::SameLine, {}, { H::Draw.Scale(10), H::Draw.Scale(20) }); + FColorPicker(Vars::Colors::RealPathIgnoreZ, FColorPickerEnum::SameLine, { H::Draw.Scale(-10), H::Draw.Scale(20) }, { H::Draw.Scale(10), H::Draw.Scale(20) }); - Vars::Visuals::Trajectory::OffsetX[DEFAULT_BIND] = vOffset.x; - Vars::Visuals::Trajectory::OffsetY[DEFAULT_BIND] = vOffset.y; - Vars::Visuals::Trajectory::OffsetZ[DEFAULT_BIND] = vOffset.z; - Vars::Visuals::Trajectory::ForwardRedirect[DEFAULT_BIND] = flForwardRedirect; - Vars::Visuals::Trajectory::ForwardCutoff[DEFAULT_BIND] = flForwardCutoff; - Vars::Visuals::Trajectory::Hull[DEFAULT_BIND] = tProjInfo.m_vHull.x; - Vars::Visuals::Trajectory::Speed[DEFAULT_BIND] = vVelocity.x; - Vars::Visuals::Trajectory::Gravity[DEFAULT_BIND] = tProjInfo.m_flGravity; - Vars::Visuals::Trajectory::LifeTime[DEFAULT_BIND] = tProjInfo.m_flLifetime; - Vars::Visuals::Trajectory::UpVelocity[DEFAULT_BIND] = vVelocity.z; - Vars::Visuals::Trajectory::AngularVelocityX[DEFAULT_BIND] = vAngVelocity.x; - Vars::Visuals::Trajectory::AngularVelocityY[DEFAULT_BIND] = vAngVelocity.y; - Vars::Visuals::Trajectory::AngularVelocityZ[DEFAULT_BIND] = vAngVelocity.z; - Vars::Visuals::Trajectory::Drag[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragCoefficient; - Vars::Visuals::Trajectory::DragX[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.x; - Vars::Visuals::Trajectory::DragY[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.y; - Vars::Visuals::Trajectory::DragZ[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.z; - Vars::Visuals::Trajectory::AngularDragX[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.x; - Vars::Visuals::Trajectory::AngularDragY[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.y; - Vars::Visuals::Trajectory::AngularDragZ[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.z; - Vars::Visuals::Trajectory::MaxVelocity[DEFAULT_BIND] = params.maxVelocity; - Vars::Visuals::Trajectory::MaxAngularVelocity[DEFAULT_BIND] = params.maxAngularVelocity; + FSlider(Vars::Visuals::Path::SeparatorSpacing, FSliderEnum::Left); + FSlider(Vars::Visuals::Path::SeparatorLength, FSliderEnum::Right); + + EndPopup(); + } + + FText("Simulation", { 5, 5 }); + if (FPopupButton("Simulation", { 0, -5 })) + { + FToggle(Vars::Visuals::Trajectory::Override); + bool bApply = FButton("Apply current"); + FSDropdown(Vars::Visuals::Trajectory::Type); + FSlider(Vars::Visuals::Trajectory::OffsetX); + FSlider(Vars::Visuals::Trajectory::OffsetY); + FSlider(Vars::Visuals::Trajectory::OffsetZ); + FSlider(Vars::Visuals::Trajectory::ForwardRedirect); + FSlider(Vars::Visuals::Trajectory::ForwardCutoff); + FSlider(Vars::Visuals::Trajectory::Hull); + FSlider(Vars::Visuals::Trajectory::Speed); + FSlider(Vars::Visuals::Trajectory::Gravity); + FSlider(Vars::Visuals::Trajectory::LifeTime); + FSlider(Vars::Visuals::Trajectory::UpVelocity); + FSlider(Vars::Visuals::Trajectory::AngularVelocityX); + FSlider(Vars::Visuals::Trajectory::AngularVelocityY); + FSlider(Vars::Visuals::Trajectory::AngularVelocityZ); + FSlider(Vars::Visuals::Trajectory::Drag); + FSlider(Vars::Visuals::Trajectory::DragX); + FSlider(Vars::Visuals::Trajectory::DragY); + FSlider(Vars::Visuals::Trajectory::DragZ); + FSlider(Vars::Visuals::Trajectory::AngularDragX); + FSlider(Vars::Visuals::Trajectory::AngularDragY); + FSlider(Vars::Visuals::Trajectory::AngularDragZ); + FSlider(Vars::Visuals::Trajectory::MaxVelocity); + FSlider(Vars::Visuals::Trajectory::MaxAngularVelocity); + + if (bApply) + { + auto pLocal = H::Entities.GetLocal(); + auto pWeapon = H::Entities.GetWeapon(); + if (pLocal && pWeapon) + { + ProjectileInfo tProjInfo = {}; + bool bOriginal = Vars::Visuals::Trajectory::Override.Value; + Vars::Visuals::Trajectory::Override.Value = false; + bool bSetup = F::ProjSim.GetInfo(pLocal, pWeapon, {}, tProjInfo, ProjSimEnum::Interp) + && F::ProjSim.Initialize(tProjInfo, false); + Vars::Visuals::Trajectory::Override.Value = bOriginal; + if (bSetup) + { + Vec3 vLocalEye = pLocal->GetEyePosition(); + Vec3 vOffset = tProjInfo.m_vPos - vLocalEye; vOffset.y *= -1; + float flForwardRedirect = 0.f, flForwardCutoff = 0.f; + switch (tProjInfo.m_uType) + { + case FNV1A::Hash32Const("models/weapons/w_models/w_rocket.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_drg_ball.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_flaregun_shell.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_arrow.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_syringe_proj.mdl"): + case FNV1A::Hash32Const("models/weapons/w_models/w_repair_claw.mdl"): + flForwardRedirect = 2000.f, flForwardCutoff = 0.1f; break; + case FNV1A::Hash32Const("models/weapons/c_models/c_flameball/c_flameball.mdl"): + flForwardRedirect = H::ConVars.FindVar("tf_fireball_distance")->GetFloat(), flForwardCutoff = 1.f; + } + physics_performanceparams_t params = {}; F::ProjSim.m_pEnv->GetPerformanceSettings(¶ms); + Vec3 vVelocity, vAngVelocity; F::ProjSim.m_pObj->GetVelocity(&vVelocity, &vAngVelocity); + + Vars::Visuals::Trajectory::OffsetX[DEFAULT_BIND] = vOffset.x; + Vars::Visuals::Trajectory::OffsetY[DEFAULT_BIND] = vOffset.y; + Vars::Visuals::Trajectory::OffsetZ[DEFAULT_BIND] = vOffset.z; + Vars::Visuals::Trajectory::ForwardRedirect[DEFAULT_BIND] = flForwardRedirect; + Vars::Visuals::Trajectory::ForwardCutoff[DEFAULT_BIND] = flForwardCutoff; + Vars::Visuals::Trajectory::Hull[DEFAULT_BIND] = tProjInfo.m_vHull.x; + Vars::Visuals::Trajectory::Speed[DEFAULT_BIND] = vVelocity.x; + Vars::Visuals::Trajectory::Gravity[DEFAULT_BIND] = tProjInfo.m_flGravity; + Vars::Visuals::Trajectory::LifeTime[DEFAULT_BIND] = tProjInfo.m_flLifetime; + Vars::Visuals::Trajectory::UpVelocity[DEFAULT_BIND] = vVelocity.z; + Vars::Visuals::Trajectory::AngularVelocityX[DEFAULT_BIND] = vAngVelocity.x; + Vars::Visuals::Trajectory::AngularVelocityY[DEFAULT_BIND] = vAngVelocity.y; + Vars::Visuals::Trajectory::AngularVelocityZ[DEFAULT_BIND] = vAngVelocity.z; + Vars::Visuals::Trajectory::Drag[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragCoefficient; + Vars::Visuals::Trajectory::DragX[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.x; + Vars::Visuals::Trajectory::DragY[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.y; + Vars::Visuals::Trajectory::DragZ[DEFAULT_BIND] = F::ProjSim.m_pObj->m_dragBasis.z; + Vars::Visuals::Trajectory::AngularDragX[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.x; + Vars::Visuals::Trajectory::AngularDragY[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.y; + Vars::Visuals::Trajectory::AngularDragZ[DEFAULT_BIND] = F::ProjSim.m_pObj->m_angDragBasis.z; + Vars::Visuals::Trajectory::MaxVelocity[DEFAULT_BIND] = params.maxVelocity; + Vars::Visuals::Trajectory::MaxAngularVelocity[DEFAULT_BIND] = params.maxAngularVelocity; + } } } + + EndPopup(); } } EndSection(); } @@ -599,9 +656,15 @@ void CMenu::MenuHVH(int iTab) } EndSection(); if (Vars::Debug::Options.Value) { - if (Section("##Debug")) + if (Section("##Debug Fakelag")) { - FToggle(Vars::Fakelag::RetainSoldierOnly); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FToggle(Vars::Fakelag::RetainSoldierOnly); + + EndPopup(); + } } EndSection(); } if (Section("Antiaim", 8)) @@ -635,6 +698,19 @@ void CMenu::MenuHVH(int iTab) FToggle(Vars::AntiAim::AntiOverlap, FToggleEnum::Left); FToggle(Vars::AntiAim::InvalidShootPitch, FToggleEnum::Right); } EndSection(); + if (Vars::Debug::Options.Value) + { + if (Section("##Debug Antiaim")) + { + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FToggle(Vars::AntiAim::AntiAimLines, FToggleEnum::Left); + + EndPopup(); + } + } EndSection(); + } } /* Column 2 */ TableNextColumn(); @@ -814,7 +890,7 @@ void CMenu::MenuVisuals(int iTab) PopTransparent(1, 1); SetCursorPos(vOriginalPos + ImVec2(flWidth - H::Draw.Scale(26), H::Draw.Scale(2))); - bool bDelete = IconButton(ICON_MD_DELETE); + bool bDelete = IconButton(ICON_MD_DELETE), bDuplicate = false; SetCursorPos(vOriginalPos); bool bClicked = Button(std::format("##{}", iGroup).c_str(), { flWidth, flHeight }); @@ -841,20 +917,25 @@ void CMenu::MenuVisuals(int iTab) tGroup.m_sName = sInput; } - if (FButton("Duplicate")) + PushDisabled(F::Groups.m_vGroups.size() >= sizeof(int) * 8); { - auto it2 = F::Groups.m_vGroups.insert(it + 1, tGroup); - it2->m_sName += " duplicate"; + bDuplicate = FButton("Duplicate"); } + PopDisabled(); PopStyleVar(); EndPopup(); } - if (!bDelete) - ++it; - else + if (bDelete) it = F::Groups.m_vGroups.erase(it); + else if (bDuplicate) + { + it = F::Groups.m_vGroups.insert(it + 1, tGroup); + it->m_sName += " duplicate"; + } + else + ++it; } } EndSection(); @@ -977,29 +1058,7 @@ void CMenu::MenuVisuals(int iTab) if (Section("Misc", 8)) { FToggle("Offscreen arrows", &tGroup.m_bOffscreenArrows, FToggleEnum::Left); - SameLine(GetWindowWidth() - H::Draw.Scale(33)); - if (IconButton(ICON_MD_KEYBOARD_ARROW_DOWN)) - OpenPopup("OffscreenArrows"); - - FToggle("Pickup timer", &tGroup.m_bPickupTimer); - - FToggle("Backtrack", &tGroup.m_iBacktrack, BacktrackEnum::Enabled, FToggleEnum::Left); - SameLine(GetWindowWidth() - H::Draw.Scale(33)); - if (IconButton(ICON_MD_KEYBOARD_ARROW_DOWN)) - OpenPopup("Backtrack"); - - FToggle("Trajectory", &tGroup.m_iTrajectory, TrajectoryEnum::Enabled, FToggleEnum::Left); - SameLine(GetWindowWidth() - H::Draw.Scale(33)); - if (IconButton(ICON_MD_KEYBOARD_ARROW_DOWN)) - OpenPopup("Trajectory"); - - FToggle("Sightlines", &tGroup.m_iSightlines, SightlinesEnum::Enabled, FToggleEnum::Left); - SameLine(GetWindowWidth() - H::Draw.Scale(33)); - if (IconButton(ICON_MD_KEYBOARD_ARROW_DOWN)) - OpenPopup("Sightlines"); - - SetNextWindowSize({ H::Draw.Scale(300), 0 }); - if (FBeginPopup("OffscreenArrows")) + if (FPopupButton("OffscreenArrows")) { FSlider("Offset", &tGroup.m_iOffscreenArrowsOffset, 0, 1000, 25, "%i", FSliderEnum::Precision); FSlider("Max distance", &tGroup.m_flOffscreenArrowsMaxDistance, 0.f, 5000.f, 50.f, "%g", FSliderEnum::Min | FSliderEnum::Precision); @@ -1007,11 +1066,11 @@ void CMenu::MenuVisuals(int iTab) EndPopup(); } - SetNextWindowSize({ H::Draw.Scale(300), 0 }); - if (FBeginPopup("Backtrack")) - { - SetCursorPosY(GetCursorPosY() - H::Draw.Scale(8)); + FToggle("Pickup timer", &tGroup.m_bPickupTimer); + FToggle("Backtrack", &tGroup.m_iBacktrack, BacktrackEnum::Enabled, FToggleEnum::Left); + if (FPopupButton("Backtrack", {}, -8)) + { FDropdown("##Draw", &tGroup.m_iBacktrack, { "Last", "First", "##Divider", "Always" }, { BacktrackEnum::Last, BacktrackEnum::First, BacktrackEnum::Always }, FDropdownEnum::Multi | FDropdownEnum::NoSanitization, 0, "All"); FMDropdown("Material", &tGroup.m_vBacktrackChams, FDropdownEnum::Left); @@ -1033,19 +1092,17 @@ void CMenu::MenuVisuals(int iTab) EndPopup(); } - SetNextWindowSize({ H::Draw.Scale(300), 0 }); - if (FBeginPopup("Trajectory")) + FToggle("Trajectory", &tGroup.m_iTrajectory, TrajectoryEnum::Enabled, FToggleEnum::Left); + if (FPopupButton("Trajectory", {}, -8)) { - SetCursorPosY(GetCursorPosY() - H::Draw.Scale(8)); - FDropdown("Flags", &tGroup.m_iTrajectory, { "Predict", "##Divider", "Radius", "Trace", "Sphere", "##Divider", "Path" }, { TrajectoryEnum::Predict, TrajectoryEnum::Radius, TrajectoryEnum::Trace, TrajectoryEnum::Sphere, TrajectoryEnum::Path }, FDropdownEnum::Multi | FDropdownEnum::NoSanitization); FToggle("Ignore Z", &tGroup.m_iTrajectory, SightlinesEnum::IgnoreZ); EndPopup(); } - SetNextWindowSize({ H::Draw.Scale(300), 0 }); - if (FBeginPopup("Sightlines")) + FToggle("Sightlines", &tGroup.m_iSightlines, SightlinesEnum::Enabled, FToggleEnum::Left); + if (FPopupButton("Sightlines")) { FToggle("Ignore Z", &tGroup.m_iSightlines, SightlinesEnum::IgnoreZ); @@ -1104,8 +1161,14 @@ void CMenu::MenuVisuals(int iTab) { if (Section("##Debug")) { - FToggle(Vars::Visuals::Thirdperson::Scale, FToggleEnum::Left); - FToggle(Vars::Visuals::Thirdperson::Collide, FToggleEnum::Right); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FToggle(Vars::Visuals::Thirdperson::Scale, FToggleEnum::Left); + FToggle(Vars::Visuals::Thirdperson::Collide, FToggleEnum::Right); + + EndPopup(); + } } EndSection(); } if (Section("Effects")) @@ -1238,14 +1301,20 @@ void CMenu::MenuVisuals(int iTab) { if (Section("##Debug")) { - FColorPicker(Vars::Colors::IndicatorGood, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextGood, FColorPickerEnum::Right); - FColorPicker(Vars::Colors::IndicatorBad, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextBad, FColorPickerEnum::Right); - FColorPicker(Vars::Colors::IndicatorMid, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextMid, FColorPickerEnum::Right); - FColorPicker(Vars::Colors::IndicatorMisc, FColorPickerEnum::Left); - FColorPicker(Vars::Colors::IndicatorTextMisc, FColorPickerEnum::Right); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FColorPicker(Vars::Colors::IndicatorGood, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextGood, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::IndicatorBad, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextBad, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::IndicatorMid, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextMid, FColorPickerEnum::Right); + FColorPicker(Vars::Colors::IndicatorMisc, FColorPickerEnum::Left); + FColorPicker(Vars::Colors::IndicatorTextMisc, FColorPickerEnum::Right); + + EndPopup(); + } } EndSection(); } @@ -1283,26 +1352,32 @@ void CMenu::MenuMisc(int iTab) FToggle(Vars::Misc::Movement::Bunnyhop, FToggleEnum::Left); FToggle(Vars::Misc::Movement::EdgeJump, FToggleEnum::Right); FToggle(Vars::Misc::Movement::AutoJumpbug, FToggleEnum::Left); // this is unreliable without setups, do not depend on it! - FToggle(Vars::Misc::Movement::NoPush, FToggleEnum::Right); + FToggle(Vars::Misc::Movement::BreakJump, FToggleEnum::Right); FToggle(Vars::Misc::Movement::AutoRocketJump, FToggleEnum::Left); FToggle(Vars::Misc::Movement::AutoCTap, FToggleEnum::Right); FToggle(Vars::Misc::Movement::FastStop, FToggleEnum::Left); FToggle(Vars::Misc::Movement::FastAccelerate, FToggleEnum::Right); FToggle(Vars::Misc::Movement::DuckSpeed, FToggleEnum::Left); - FToggle(Vars::Misc::Movement::MovementLock, FToggleEnum::Right); - FToggle(Vars::Misc::Movement::BreakJump, FToggleEnum::Left); FToggle(Vars::Misc::Movement::ShieldTurnRate, FToggleEnum::Right); + FToggle(Vars::Misc::Movement::NoPush, FToggleEnum::Left); + FToggle(Vars::Misc::Movement::MovementLock, FToggleEnum::Right); } EndSection(); if (Vars::Debug::Options.Value) { if (Section("##Debug")) { - FSlider(Vars::Misc::Movement::AutoRocketJumpChokeGrounded, FToggleEnum::Left); - FSlider(Vars::Misc::Movement::AutoRocketJumpChokeAir, FToggleEnum::Right); - FSlider(Vars::Misc::Movement::AutoRocketJumpSkipGround, FToggleEnum::Left); - FSlider(Vars::Misc::Movement::AutoRocketJumpSkipAir, FToggleEnum::Right); - FSlider(Vars::Misc::Movement::AutoRocketJumpTimingOffset, FToggleEnum::Left); - FSlider(Vars::Misc::Movement::AutoRocketJumpApplyAbove, FToggleEnum::Right); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FSlider(Vars::Misc::Movement::AutoRocketJumpChokeGrounded, FToggleEnum::Left); + FSlider(Vars::Misc::Movement::AutoRocketJumpChokeAir, FToggleEnum::Right); + FSlider(Vars::Misc::Movement::AutoRocketJumpSkipGround, FToggleEnum::Left); + FSlider(Vars::Misc::Movement::AutoRocketJumpSkipAir, FToggleEnum::Right); + FSlider(Vars::Misc::Movement::AutoRocketJumpTimingOffset, FToggleEnum::Left); + FSlider(Vars::Misc::Movement::AutoRocketJumpApplyAbove, FToggleEnum::Right); + + EndPopup(); + } } EndSection(); } if (Section("Automation")) @@ -1351,7 +1426,13 @@ void CMenu::MenuMisc(int iTab) { if (Section("##Debug AntiCheat")) { - FToggle(Vars::Misc::Game::AntiCheatCritHack); + FText("Debug", { 5, 5 }); + if (FPopupButton("Debug", { 0, -5 })) + { + FToggle(Vars::Misc::Game::AntiCheatCritHack); + + EndPopup(); + } } EndSection(); } if (Section("Queueing")) @@ -1543,6 +1624,11 @@ void CMenu::MenuLogs(int iTab) if (!I::EngineClient->IsPlayingDemo() && FBeginMenu("Votekick")) { + if (IsItemHovered() && IsMouseDown(ImGuiMouseButton_Left)) + { + I::ClientState->SendStringCmd(std::format("callvote Kick \"{}\"", tPlayer.m_iUserID).c_str()); + CloseCurrentPopup(); + } if (FSelectable("No reason")) I::ClientState->SendStringCmd(std::format("callvote Kick \"{} other\"", tPlayer.m_iUserID).c_str()); if (FSelectable("Cheating")) @@ -1767,7 +1853,7 @@ void CMenu::MenuLogs(int iTab) static int iID = -1; static PriorityLabel_t tTag = {}; - auto vTable = WidgetTable(3, H::Draw.Scale(56), { GetWindowWidth() / 2, GetWindowWidth() / 2 - H::Draw.Scale(90) - GetStyle().WindowPadding.x }); + auto vTable = WidgetTable(3, H::Draw.Scale(48), { GetWindowWidth() / 2, GetWindowWidth() / 2 - H::Draw.Scale(90) - GetStyle().WindowPadding.x }); if (BeginWidgetTable(0, vTable)) { @@ -1800,7 +1886,7 @@ void CMenu::MenuLogs(int iTab) // create/modify button bool bCreate = false, bClear = false; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(95), H::Draw.Scale(8) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(95), 0 }); PushDisabled(tTag.m_sName.empty()); { bCreate = FButton(iID != -1 ? ICON_MD_SETTINGS : ICON_MD_ADD, FButtonEnum::None, { 40, 40 }, 0, F::Render.IconFont); @@ -1808,7 +1894,7 @@ void CMenu::MenuLogs(int iTab) PopDisabled(); // clear button - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(47), H::Draw.Scale(8) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(47), 0 }); bClear = FButton(ICON_MD_CLEAR, FButtonEnum::None, { 40, 40 }, 0, F::Render.IconFont); if (bCreate) @@ -2023,14 +2109,14 @@ void CMenu::MenuLogs(int iTab) // display tags int iPriorities = 0, iLabels = 0; - for (auto& pair : vPriorities) + for (auto& [it, _tTag] : vPriorities) { - fDrawTag(pair.first, pair.second, iPriorities); + fDrawTag(it, _tTag, iPriorities); iPriorities++; } - for (auto& pair : vLabels) + for (auto& [it, _tTag] : vLabels) { - fDrawTag(pair.first, pair.second, iLabels); + fDrawTag(it, _tTag, iLabels); iLabels++; } SetCursorPos({ 0, H::Draw.Scale(60 + 36 * std::max(iPriorities, iLabels)) }); DebugDummy({ 0, H::Draw.Scale(28) }); @@ -2171,7 +2257,7 @@ void CMenu::MenuLogs(int iTab) if (FBeginPopupModal("ImportPlayerlist")) { FText("Import"); - FText("As", FTextEnum::Right | FTextEnum::SameLine); + FText("As", {}, FTextEnum::Right | FTextEnum::SameLine); for (int i = 0; i < vTags.size(); i++) { @@ -2491,7 +2577,7 @@ void CMenu::MenuSettings(int iTab) if (FButton(ICON_MD_FOLDER, FButtonEnum::Fit | FButtonEnum::SameLine, { 40, 40 }, 0, F::Render.IconFont)) ShellExecuteA(NULL, NULL, sPath.c_str(), NULL, NULL, SW_SHOWNORMAL); - vRowSizes.clear(); + pRowSizes->clear(); std::vector> vConfigs = {}; bool bDefaultFound = false; @@ -2647,7 +2733,7 @@ void CMenu::MenuSettings(int iTab) { if (Section("Settings", 8)) { - auto vTable = WidgetTable(3, H::Draw.Scale(24)); + auto vTable = WidgetTable(3, H::Draw.Scale(16)); if (BeginWidgetTable(0, vTable)) { @@ -2673,7 +2759,7 @@ void CMenu::MenuSettings(int iTab) if (bParent) SetMouseCursor(ImGuiMouseCursor_Hand); - auto vTable = WidgetTable(2, H::Draw.Scale(104)); + auto vTable = WidgetTable(2, H::Draw.Scale(96)); if (BeginWidgetTable(0, vTable)) { @@ -2708,7 +2794,7 @@ void CMenu::MenuSettings(int iTab) if (tBind.m_iParent != DEFAULT_BIND) bParent = F::Binds.m_vBinds.size() > tBind.m_iParent; - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(96), H::Draw.Scale(56) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(96), H::Draw.Scale(48) }); PushDisabled(!bParent || !(tBind.m_iType == BindEnum::Key ? tBind.m_iKey : true)); { bool bMatch = iBind != DEFAULT_BIND && F::Binds.m_vBinds.size() > iBind; @@ -2717,7 +2803,7 @@ void CMenu::MenuSettings(int iTab) PopDisabled(); // clear button - SetCursorPos({ GetWindowWidth() - H::Draw.Scale(48), H::Draw.Scale(56) }); + SetCursorPos({ GetWindowWidth() - H::Draw.Scale(48), H::Draw.Scale(48) }); bClear = FButton(ICON_MD_CLEAR, FButtonEnum::None, { 40, 40 }, 0, F::Render.IconFont); if (bCreate) @@ -3176,7 +3262,7 @@ void CMenu::MenuSettings(int iTab) sCurrentMaterial = ""; SetCursorPosY(H::Draw.Scale(52)); PushStyleColor(ImGuiCol_Text, F::Render.Inactive.Value); - FText(std::format("{}: {}", bLockedMaterial ? "Viewing" : "Editing", sCurrentMaterial).c_str(), FTextEnum::Right); + FText(std::format("{}: {}", bLockedMaterial ? "Viewing" : "Editing", sCurrentMaterial).c_str(), {}, FTextEnum::Right); PopStyleColor(); // Text editor @@ -3230,24 +3316,11 @@ void CMenu::MenuSettings(int iTab) // Extra case 3: { - if (Section("Debug", 8)) + if (Section("Functions")) { - FToggle(Vars::Debug::Info, FToggleEnum::Left); - FToggle(Vars::Debug::Logging, FToggleEnum::Right); - FToggle(Vars::Debug::Options, FToggleEnum::Left); - FToggle(Vars::Debug::DrawHitboxes, FToggleEnum::Right); - FToggle(Vars::Debug::AntiAimLines, FToggleEnum::Left); - FToggle(Vars::Debug::CrashLogging, FToggleEnum::Right); -#ifdef DEBUG_TRACES - FToggle(Vars::Debug::VisualizeTraces, FToggleEnum::Left); - FToggle(Vars::Debug::VisualizeTraceHits, FToggleEnum::Right); -#endif - } EndSection(); - if (Section("Buttons")) - { - if (FButton("cl_fullupdate", FButtonEnum::Left)) + if (FButton("Fullupdate", FButtonEnum::Left)) I::EngineClient->ClientCmd_Unrestricted("cl_fullupdate"); - if (FButton("retry", FButtonEnum::Right | FButtonEnum::SameLine)) + if (FButton("Retry", FButtonEnum::Right | FButtonEnum::SameLine)) I::EngineClient->ClientCmd_Unrestricted("retry"); if (FButton("Console", FButtonEnum::Left)) I::EngineClient->ClientCmd_Unrestricted("toggleconsole"); @@ -3291,40 +3364,24 @@ void CMenu::MenuSettings(int iTab) } } } EndSection(); + if (Section("Debug", 8)) + { + FToggle(Vars::Debug::Info, FToggleEnum::Left); + FToggle(Vars::Debug::Logging, FToggleEnum::Right); + FToggle(Vars::Debug::Options, FToggleEnum::Left); + FToggle(Vars::Debug::CrashLogging, FToggleEnum::Right); + +#ifdef DEBUG_TRACES + FToggle(Vars::Debug::VisualizeTraces, FToggleEnum::Left); + FToggle(Vars::Debug::VisualizeTraceHits, FToggleEnum::Right); +#endif + } EndSection(); if (Vars::Debug::Options.Value && I::EngineClient->IsConnected()) { - if (Section("##Debug", -8)) + if (Section("##Debug")) { - if (FButton("Restore lines", FButtonEnum::Left)) - { - for (auto& tLine : G::LineStorage) - tLine.m_flTime = I::GlobalVars->curtime + 60.f; - } - if (FButton("Restore paths", FButtonEnum::Right | FButtonEnum::SameLine)) - { - for (auto& tPath : G::PathStorage) - tPath.m_flTime = I::GlobalVars->curtime + 60.f; - } - if (FButton("Restore boxes", FButtonEnum::Left)) - { - for (auto& tBox : G::BoxStorage) - tBox.m_flTime = I::GlobalVars->curtime + 60.f; - } - if (FButton("Restore spheres", FButtonEnum::Right | FButtonEnum::SameLine)) - { - for (auto& tSphere : G::SphereStorage) - tSphere.m_flTime = I::GlobalVars->curtime + 60.f; - } - if (FButton("Restore swept", FButtonEnum::Left)) - { - for (auto& tSwept : G::SweptStorage) - tSwept.m_flTime = I::GlobalVars->curtime + 60.f; - } - if (FButton("Restore triangles", FButtonEnum::Right | FButtonEnum::SameLine)) - { - for (auto& tTriangle : G::TriangleStorage) - tTriangle.m_flTime = I::GlobalVars->curtime + 60.f; - } + FToggle(Vars::Debug::DrawHitboxes); + if (FButton("Restore visuals", FButtonEnum::Left)) { for (auto& tLine : G::LineStorage) @@ -3349,6 +3406,66 @@ void CMenu::MenuSettings(int iTab) G::SweptStorage.clear(); G::TriangleStorage.clear(); } + + if (FButton("Restore lines", FButtonEnum::Left)) + { + for (auto& tLine : G::LineStorage) + tLine.m_flTime = I::GlobalVars->curtime + 60.f; + } + if (FButton("Clear lines", FButtonEnum::Right | FButtonEnum::SameLine)) + { + G::LineStorage.clear(); + } + + if (FButton("Restore paths", FButtonEnum::Left)) + { + for (auto& tPath : G::PathStorage) + tPath.m_flTime = I::GlobalVars->curtime + 60.f; + } + if (FButton("Clear paths", FButtonEnum::Right | FButtonEnum::SameLine)) + { + G::PathStorage.clear(); + } + + if (FButton("Restore boxes", FButtonEnum::Left)) + { + for (auto& tBox : G::BoxStorage) + tBox.m_flTime = I::GlobalVars->curtime + 60.f; + } + if (FButton("Clear boxes", FButtonEnum::Right | FButtonEnum::SameLine)) + { + G::BoxStorage.clear(); + } + + if (FButton("Restore spheres", FButtonEnum::Left)) + { + for (auto& tSphere : G::SphereStorage) + tSphere.m_flTime = I::GlobalVars->curtime + 60.f; + } + if (FButton("Clear spheres", FButtonEnum::Right | FButtonEnum::SameLine)) + { + G::SphereStorage.clear(); + } + + if (FButton("Restore swept", FButtonEnum::Left)) + { + for (auto& tSwept : G::SweptStorage) + tSwept.m_flTime = I::GlobalVars->curtime + 60.f; + } + if (FButton("Clear swept", FButtonEnum::Right | FButtonEnum::SameLine)) + { + G::SweptStorage.clear(); + } + + if (FButton("Restore triangles", FButtonEnum::Left)) + { + for (auto& tTriangle : G::TriangleStorage) + tTriangle.m_flTime = I::GlobalVars->curtime + 60.f; + } + if (FButton("Clear triangles", FButtonEnum::Right | FButtonEnum::SameLine)) + { + G::TriangleStorage.clear(); + } } EndSection(); } /* @@ -3541,9 +3658,9 @@ void CMenu::MenuSearch(std::string sSearch) SetCursorPos({ GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, GetRowPos() + H::Draw.Scale(8) }); i = 0; } - else if (iTypeEnum == WidgetEnum::FSlider && iLastEnum == WidgetEnum::FDropdown && (i % 2) && !vRowSizes.empty()) + else if (iTypeEnum == WidgetEnum::FSlider && iLastEnum == WidgetEnum::FDropdown && (i % 2) && !pRowSizes->empty()) { - auto& tRow = vRowSizes.front(); + auto& tRow = pRowSizes->front(); tRow.m_vPos.y += H::Draw.Scale(13), tRow.m_vSize.y -= H::Draw.Scale(13); SetCursorPos({ GetWindowWidth() / 2 + GetStyle().WindowPadding.x / 2, GetRowPos() }); i = 0; @@ -3669,20 +3786,33 @@ void CMenu::MenuSearch(std::string sSearch) } #pragma endregion +#pragma region Draggables +static inline void SquareConstraints(ImGuiSizeCallbackData* data) +{ + //data->DesiredSize.x = data->DesiredSize.y = std::max(data->DesiredSize.x, data->DesiredSize.y); + data->DesiredSize.x = data->DesiredSize.y = (data->DesiredSize.x + data->DesiredSize.y) / 2; +} + +static inline void OptionalConstraints(ImGuiSizeCallbackData* data) +{ + if (U::KeyHandler.Down(VK_SHIFT)) + SquareConstraints(data); +} + struct DragBoxStorage_t { DragBox_t m_tDragBox; float m_flScale; }; static std::unordered_map s_mDragBoxStorage = {}; -void CMenu::AddDraggable(const char* sLabel, ConfigVar& var, bool bShouldDraw, ImVec2 vSize) +void CMenu::AddDraggable(const char* sLabel, ConfigVar& tVar, bool bShouldDraw, ImVec2 vSize) { using namespace ImGui; if (!bShouldDraw) return; - auto tDragBox = FGet(var, true); + auto tDragBox = FGet(tVar, true); auto uHash = FNV1A::Hash32(sLabel); bool bContains = s_mDragBoxStorage.contains(uHash); @@ -3703,7 +3833,7 @@ void CMenu::AddDraggable(const char* sLabel, ConfigVar& var, bool bSh tDragBox.x = vWindowPos.x + vSize.x / 2, tDragBox.y = vWindowPos.y; tStorage = { tDragBox, H::Draw.Scale() }; - FSet(var, tDragBox); + FSet(tVar, tDragBox); PushFont(F::Render.FontBold); ImVec2 vTextSize = FCalcTextSize(sLabel); @@ -3723,14 +3853,14 @@ struct WindowBoxStorage_t float m_flScale; }; static std::unordered_map s_mWindowBoxStorage = {}; -void CMenu::AddResizableDraggable(const char* sLabel, ConfigVar& var, bool bShouldDraw, ImVec2 vMinSize, ImVec2 vMaxSize, ImGuiSizeCallback fCustomCallback) +void CMenu::AddResizableDraggable(const char* sLabel, ConfigVar& tVar, bool bShouldDraw, ImGuiSizeCallback fCustomCallback, ImVec2 vMinSize, ImVec2 vMaxSize) { using namespace ImGui; if (!bShouldDraw) return; - auto tWindowBox = FGet(var, true); + auto tWindowBox = FGet(tVar, true); auto uHash = FNV1A::Hash32(sLabel); bool bContains = s_mWindowBoxStorage.contains(uHash); @@ -3755,7 +3885,7 @@ void CMenu::AddResizableDraggable(const char* sLabel, ConfigVar& va tWindowBox.w = vWinSize.x, tWindowBox.h = vWinSize.y; tWindowBox.x = vWindowPos.x + tWindowBox.w / 2, tWindowBox.y = vWindowPos.y; tStorage = { tWindowBox, H::Draw.Scale() }; - FSet(var, tWindowBox); + FSet(tVar, tWindowBox); PushFont(F::Render.FontBold); ImVec2 vTextSize = FCalcTextSize(sLabel); @@ -3895,7 +4025,7 @@ void CMenu::DrawBinds() float flWidth = flNameWidth + flInfoWidth + flStateWidth + (m_bIsOpen ? H::Draw.Scale(113) : H::Draw.Scale(14)); float flHeight = H::Draw.Scale(18 * vInfo.size() + (Vars::Menu::BindWindowTitle.Value ? 42 : 12)); - SetNextWindowSize({ flWidth, flHeight }); + SetNextWindowSize({ flWidth, flHeight }, ImGuiCond_Always); PushStyleVar(ImGuiStyleVar_WindowMinSize, { H::Draw.Scale(40), H::Draw.Scale(40) }); if (Begin("Binds", nullptr, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoSavedSettings)) { @@ -4007,12 +4137,7 @@ void CMenu::DrawBinds() } PopStyleVar(); } - -static inline void SquareConstraints(ImGuiSizeCallbackData* data) -{ - //data->DesiredSize.x = data->DesiredSize.y = std::max(data->DesiredSize.x, data->DesiredSize.y); - data->DesiredSize.x = data->DesiredSize.y = (data->DesiredSize.x + data->DesiredSize.y) / 2; -} +#pragma endregion static inline void ManageVars() { @@ -4054,7 +4179,7 @@ void CMenu::Render() AddDraggable("Ping", Vars::Menu::PingDisplay, FGet(Vars::Menu::Indicators) & Vars::Menu::IndicatorsEnum::Ping); AddDraggable("Conditions", Vars::Menu::ConditionsDisplay, FGet(Vars::Menu::Indicators) & Vars::Menu::IndicatorsEnum::Conditions); AddDraggable("Seed prediction", Vars::Menu::SeedPredictionDisplay, FGet(Vars::Menu::Indicators) & Vars::Menu::IndicatorsEnum::SeedPrediction); - AddResizableDraggable("Camera", Vars::Visuals::Simulation::ProjectileWindow, FGet(Vars::Visuals::Simulation::ProjectileCamera)); + AddResizableDraggable("Camera", Vars::Visuals::Simulation::ProjectileWindow, FGet(Vars::Visuals::Simulation::ProjectileCamera), OptionalConstraints); F::Render.Cursor = GetMouseCursor(); m_bWindowHovered = IsWindowHovered(ImGuiHoveredFlags_AnyWindow | ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.h b/Amalgam/src/Features/ImGui/Menu/Menu.h index 62a85140..88f9ccf6 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.h +++ b/Amalgam/src/Features/ImGui/Menu/Menu.h @@ -26,8 +26,8 @@ private: void MenuSettings(int iTab = 0); void MenuSearch(std::string sSearch); - void AddDraggable(const char* sLabel, ConfigVar& var, bool bShouldDraw = true, ImVec2 vSize = { H::Draw.Scale(100), H::Draw.Scale(40) }); - void AddResizableDraggable(const char* sLabel, ConfigVar& var, bool bShouldDraw = true, ImVec2 vMinSize = { H::Draw.Scale(100), H::Draw.Scale(100) }, ImVec2 vMaxSize = { H::Draw.Scale(1000), H::Draw.Scale(1000) }, ImGuiSizeCallback fCustomCallback = nullptr); + void AddDraggable(const char* sLabel, ConfigVar& tVar, bool bShouldDraw = true, ImVec2 vSize = { H::Draw.Scale(100), H::Draw.Scale(40) }); + void AddResizableDraggable(const char* sLabel, ConfigVar& tVar, bool bShouldDraw = true, ImGuiSizeCallback fCustomCallback = nullptr, ImVec2 vMinSize = { H::Draw.Scale(100), H::Draw.Scale(100) }, ImVec2 vMaxSize = { H::Draw.Scale(1000), H::Draw.Scale(1000) }); void DrawBinds(); std::deque m_vOutput = {}; diff --git a/Amalgam/src/Features/Output/Output.cpp b/Amalgam/src/Features/Output/Output.cpp index cf4bb3b7..57f896fb 100644 --- a/Amalgam/src/Features/Output/Output.cpp +++ b/Amalgam/src/Features/Output/Output.cpp @@ -7,7 +7,7 @@ static std::string s_sRed = Color_t(255, 100, 100).ToHex(); static std::string s_sGreen = Color_t(100, 255, 100).ToHex(); static std::string s_sYellow = Color_t(200, 169, 0).ToHex(); -static inline void OutputInfo(int iFlags, const char* sName, const char* sOutput, const char* sChat) +static inline void OutputInfo(int iFlags, const char* sName, const char* sOutput, const char* sColor) { int iTo = (iFlags & Vars::Logging::LogToEnum::Console ? OUTPUT_CONSOLE : 0) | (iFlags & Vars::Logging::LogToEnum::Debug ? OUTPUT_DEBUG : 0) @@ -19,7 +19,7 @@ static inline void OutputInfo(int iFlags, const char* sName, const char* sOutput iTo = (iFlags & Vars::Logging::LogToEnum::Chat ? OUTPUT_CHAT : 0); if (iTo) - SDK::Output(Vars::Menu::CheatTag.Value.c_str(), sChat, Vars::Menu::Theme::Accent.Value, iTo, -1, "", ""); + SDK::Output(Vars::Menu::CheatTag.Value.c_str(), sColor, Vars::Menu::Theme::Accent.Value, iTo, -1, "", ""); } // Event info @@ -127,15 +127,13 @@ void COutput::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) try { - sID.replace(0, 5, ""); - sID.pop_back(); + sID.replace(0, 5, ""); sID.pop_back(); uint32_t uAccountID = std::stoul(sID); if (H::Entities.InParty(uAccountID)) // ignore party return; auto sName = pEvent->GetString("name"); - TagsOnJoin(sName, uAccountID); - AliasOnJoin(sName, uAccountID); + InfoOnJoin(sName, uAccountID); } catch (...) {} @@ -149,22 +147,8 @@ void COutput::Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal) if (I::EngineClient->GetPlayerForUserID(pEvent->GetInt("userid")) != I::EngineClient->GetLocalPlayer()) return; - m_bInfoOnJoin = false; - auto pResource = H::Entities.GetResource(); - if (!pResource) - return; - - for (int n = 1; n <= I::EngineClient->GetMaxClients(); n++) - { - if (!pResource->m_bValid(n) || pResource->IsFakePlayer(n) || n == I::EngineClient->GetLocalPlayer() - || H::Entities.InParty(n)) // ignore party - continue; - - auto sName = pResource->GetName(n); - uint32_t uAccountID = pResource->m_iAccountID(n); - TagsOnJoin(sName, uAccountID); - AliasOnJoin(sName, uAccountID); - } + if (AllInfoOnJoin()) + m_bInfoOnJoin = false; } } } @@ -186,9 +170,10 @@ void COutput::UserMessage(bf_read& msgData) int iTeam = msgData.ReadByte(); /*int iVoteID =*/ msgData.ReadLong(); int iCaller = msgData.ReadByte(); - char sReason[256]; msgData.ReadString(sReason, sizeof(sReason)); - char sTarget[256]; msgData.ReadString(sTarget, sizeof(sTarget)); - int iTarget = msgData.ReadByte() >> 1; + char sIssue[256]; msgData.ReadString(sIssue, sizeof(sIssue)); + char sParam[256]; msgData.ReadString(sParam, sizeof(sParam)); + /*bool bYesNo =*/ msgData.ReadOneBit(); + int iTarget = msgData.ReadByte(); msgData.Seek(0); if (!iCaller || !iTarget) return; @@ -196,12 +181,29 @@ void COutput::UserMessage(bf_read& msgData) bool bSameTeam = iTeam == pLocal->m_iTeamNum(); auto sCallerName = F::PlayerUtils.GetPlayerName(iCaller, pResource->GetName(iCaller)); auto sTargetName = F::PlayerUtils.GetPlayerName(iTarget, pResource->GetName(iTarget)); + auto sReason = "no reason"; + switch (FNV1A::Hash32(sIssue)) + { + case FNV1A::Hash32Const("#TF_vote_kick_player_cheating"): sReason = "cheating"; break; + case FNV1A::Hash32Const("#TF_vote_kick_player_idle"): sReason = "idle"; break; + case FNV1A::Hash32Const("#TF_vote_kick_player_scamming"): sReason = "scamming"; break; + } OutputInfo(Vars::Logging::VoteStart::LogTo.Value, "Vote Start", - std::format("{}{} called a vote on {}", (bSameTeam ? "" : "[Enemy] "), (sCallerName), (sTargetName)).c_str(), - std::format("{}{}{}\x1 called a vote on {}{}", (bSameTeam ? "" : "[Enemy] "), (s_sYellow), (sCallerName), (s_sYellow), (sTargetName)).c_str() + std::format("{}{} called a vote on {} ({})", (bSameTeam ? "" : "[Enemy] "), (sCallerName), (sTargetName), (sReason)).c_str(), + std::format("{}{}{}\x1 called a vote on {}{}\x1 ({})", (bSameTeam ? "" : "[Enemy] "), (s_sYellow), (sCallerName), (s_sYellow), (sTargetName), (sReason)).c_str() ); } +// Move +void COutput::Move() +{ + if (m_bInfoOnJoin && I::EngineClient->IsPlayingDemo() && I::EngineClient->IsConnected() && I::EngineClient->IsInGame()) + { + if (AllInfoOnJoin()) + m_bInfoOnJoin = false; + } +} + // Cheat detection void COutput::CheatDetection(const char* sName, const char* sAction, const char* sReason) { @@ -214,6 +216,35 @@ void COutput::CheatDetection(const char* sName, const char* sAction, const char* ); } +// Info +bool COutput::AllInfoOnJoin() +{ + auto pResource = H::Entities.GetResource(); + if (!pResource) + return false; + + for (int n = 1; n <= I::EngineClient->GetMaxClients(); n++) + { + if (!pResource->m_bValid(n) || !pResource->m_bConnected(n) || pResource->IsFakePlayer(n) || n == I::EngineClient->GetLocalPlayer() + || H::Entities.InParty(n)) // ignore party + continue; + + auto sName = pResource->m_szName(n); + if (!sName) + return false; + + uint32_t uAccountID = pResource->m_iAccountID(n); + InfoOnJoin(sName, uAccountID); + } + + return true; +} +void COutput::InfoOnJoin(const char* sName, uint32_t uAccountID) +{ + TagsOnJoin(sName, uAccountID); + AliasOnJoin(sName, uAccountID); +} + // Tags void COutput::TagsOnJoin(const char* sName, uint32_t uAccountID) { diff --git a/Amalgam/src/Features/Output/Output.h b/Amalgam/src/Features/Output/Output.h index cec06d2e..9d439353 100644 --- a/Amalgam/src/Features/Output/Output.h +++ b/Amalgam/src/Features/Output/Output.h @@ -9,6 +9,7 @@ private: public: void Event(IGameEvent* pEvent, uint32_t uHash, CTFPlayer* pLocal); void UserMessage(bf_read& msgData); + void Move(); void CheatDetection(const char* sName, const char* sAction, const char* sReason); void TagsChanged(const char* sName, const char* sAction, const char* sColor, const char* sTag); @@ -19,6 +20,8 @@ public: void ReportResolver(int iIndex, const char* sAction, const char* sAxis, const char* sValue); void ReportResolver(const char* sMessage); + bool AllInfoOnJoin(); + void InfoOnJoin(const char* sName, uint32_t uAccountID); void TagsOnJoin(const char* sName, uint32_t uAccountID); void AliasOnJoin(const char* sName, uint32_t uAccountID); }; diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp index 8162f8a5..c9b60c4e 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.cpp @@ -247,4 +247,30 @@ void CAntiAim::Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bo pCmd->viewangles.y = vAngles.y; MinWalk(pLocal, pCmd); +} + +void CAntiAim::Draw(CTFPlayer* pLocal) +{ + if (!pLocal->IsAlive() || pLocal->IsAGhost() || !I::Input->CAM_IsThirdPerson() || !AntiAimOn()) + return; + + if (Vars::AntiAim::AntiAimLines.Value) + { + const auto& vOrigin = pLocal->GetAbsOrigin(); + + Vec3 vScreen1, vScreen2; + if (SDK::W2S(vOrigin, vScreen1)) + { + if (SDK::W2S(vOrigin + Math::RotatePoint({ 50, 0, 0 }, {}, { 0, vRealAngles.y, 0 }), vScreen2)) + H::Draw.Line(vScreen1.x, vScreen1.y, vScreen2.x, vScreen2.y, { 0, 255, 0, 255 }); + if (SDK::W2S(vOrigin + Math::RotatePoint({ 50, 0, 0 }, {}, { 0, vFakeAngles.y, 0 }), vScreen2)) + H::Draw.Line(vScreen1.x, vScreen1.y, vScreen2.x, vScreen2.y, { 255, 0, 0, 255 }); + } + + for (auto& vPair : vEdgeTrace) + { + if (SDK::W2S(vPair.first, vScreen1) && SDK::W2S(vPair.second, vScreen2)) + H::Draw.Line(vScreen1.x, vScreen1.y, vScreen2.x, vScreen2.y, { 255, 255, 255, 255 }); + } + } } \ No newline at end of file diff --git a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h index 3ce74d01..146f500e 100644 --- a/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h +++ b/Amalgam/src/Features/PacketManip/AntiAim/AntiAim.h @@ -17,6 +17,7 @@ public: bool YawOn(); bool ShouldRun(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd); void Run(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, bool bSendPacket); + void Draw(CTFPlayer* pLocal); inline int AntiAimTicks() { return 2; } diff --git a/Amalgam/src/Features/Players/PlayerCore.cpp b/Amalgam/src/Features/Players/PlayerCore.cpp index 1a23d00a..4fc990e3 100644 --- a/Amalgam/src/Features/Players/PlayerCore.cpp +++ b/Amalgam/src/Features/Players/PlayerCore.cpp @@ -18,6 +18,8 @@ void CPlayerlistCore::SavePlayerlist() if (!F::PlayerUtils.m_bSave || F::PlayerUtils.m_bLoad) // terrible if we end up saving while loading return; + F::PlayerUtils.m_bSave = false; + try { boost::property_tree::ptree tWrite; @@ -72,7 +74,6 @@ void CPlayerlistCore::SavePlayerlist() write_json(F::Configs.m_sCorePath + "Players.json", tWrite); - F::PlayerUtils.m_bSave = false; SDK::Output("Amalgam", "Saved playerlist", DEFAULT_COLOR, OUTPUT_CONSOLE | OUTPUT_TOAST | OUTPUT_MENU | OUTPUT_DEBUG); } catch (...) @@ -169,11 +170,12 @@ void CPlayerlistCore::LoadPlayerlist() else SDK::Output("Amalgam", "Playerlist aliases not found", ALTERNATE_COLOR, OUTPUT_CONSOLE | OUTPUT_MENU | OUTPUT_DEBUG); - F::PlayerUtils.m_bLoad = false; SDK::Output("Amalgam", "Loaded playerlist", DEFAULT_COLOR, OUTPUT_CONSOLE | OUTPUT_TOAST | OUTPUT_MENU | OUTPUT_DEBUG); } catch (...) { SDK::Output("Amalgam", "Load playerlist failed", ALTERNATE_COLOR, OUTPUT_CONSOLE | OUTPUT_MENU | OUTPUT_DEBUG); } + + F::PlayerUtils.m_bLoad = false; } \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.h b/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.h index a5dbde90..ffa79676 100644 --- a/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.h +++ b/Amalgam/src/Features/Visuals/OffscreenArrows/OffscreenArrows.h @@ -20,4 +20,4 @@ public: void Draw(CTFPlayer* pLocal); }; -ADD_FEATURE(COffscreenArrows, Arrows); \ No newline at end of file +ADD_FEATURE(COffscreenArrows, OffscreenArrows); \ No newline at end of file diff --git a/Amalgam/src/Features/Visuals/Visuals.cpp b/Amalgam/src/Features/Visuals/Visuals.cpp index e7403094..b9fdfb3b 100644 --- a/Amalgam/src/Features/Visuals/Visuals.cpp +++ b/Amalgam/src/Features/Visuals/Visuals.cpp @@ -4,7 +4,6 @@ #include "../Aimbot/AimbotProjectile/AimbotProjectile.h" #include "../Ticks/Ticks.h" #include "../Backtrack/Backtrack.h" -#include "../PacketManip/AntiAim/AntiAim.h" #include "../Simulation/ProjectileSimulation/ProjectileSimulation.h" #include "CameraWindow/CameraWindow.h" #include "../Players/PlayerUtils.h" @@ -267,32 +266,6 @@ void CVisuals::DrawPickupTimers() } } -void CVisuals::DrawAntiAim(CTFPlayer* pLocal) -{ - if (!pLocal->IsAlive() || pLocal->IsAGhost() || !I::Input->CAM_IsThirdPerson()) - return; - - if (F::AntiAim.AntiAimOn() && Vars::Debug::AntiAimLines.Value) - { - const auto& vOrigin = pLocal->GetAbsOrigin(); - - Vec3 vScreen1, vScreen2; - if (SDK::W2S(vOrigin, vScreen1)) - { - if (SDK::W2S(vOrigin + Math::RotatePoint({ 50, 0, 0 }, {}, { 0, F::AntiAim.vRealAngles.y, 0 }), vScreen2)) - H::Draw.Line(vScreen1.x, vScreen1.y, vScreen2.x, vScreen2.y, { 0, 255, 0, 255 }); - if (SDK::W2S(vOrigin + Math::RotatePoint({ 50, 0, 0 }, {}, { 0, F::AntiAim.vFakeAngles.y, 0 }), vScreen2)) - H::Draw.Line(vScreen1.x, vScreen1.y, vScreen2.x, vScreen2.y, { 255, 0, 0, 255 }); - } - - for (auto& vPair : F::AntiAim.vEdgeTrace) - { - if (SDK::W2S(vPair.first, vScreen1) && SDK::W2S(vPair.second, vScreen2)) - H::Draw.Line(vScreen1.x, vScreen1.y, vScreen2.x, vScreen2.y, { 255, 255, 255, 255 }); - } - } -} - #define PAIR(x) { x, #x } void CVisuals::DrawDebugInfo(CTFPlayer* pLocal) { diff --git a/Amalgam/src/Features/Visuals/Visuals.h b/Amalgam/src/Features/Visuals/Visuals.h index 9f0bd3f9..0d1aa392 100644 --- a/Amalgam/src/Features/Visuals/Visuals.h +++ b/Amalgam/src/Features/Visuals/Visuals.h @@ -56,7 +56,6 @@ public: void ProjectileTrace(CTFPlayer* pPlayer, CTFWeaponBase* pWeapon, const bool bInterp = true); void DrawPickupTimers(); - void DrawAntiAim(CTFPlayer* pLocal); void DrawDebugInfo(CTFPlayer* pLocal); #ifdef DEBUG_TEXT diff --git a/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp b/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp index 7fc0d874..189e3de2 100644 --- a/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp +++ b/Amalgam/src/Hooks/CBaseHudChatLine_InsertAndColorizeText.cpp @@ -53,7 +53,7 @@ MAKE_HOOK(CBaseHudChatLine_InsertAndColorizeText, S::CBaseHudChatLine_InsertAndC std::vector> vReplace; for (int n = 1; n <= I::EngineClient->GetMaxClients(); n++) { - if (!pResource->m_bValid(n)) + if (!pResource->m_bValid(n) || !pResource->m_bConnected(n)) continue; int iType; const char* sReplace = F::PlayerUtils.GetPlayerName(n, nullptr, &iType); diff --git a/Amalgam/src/Hooks/CHLClient_FrameStageNotify.cpp b/Amalgam/src/Hooks/CHLClient_FrameStageNotify.cpp index 304fa2ea..27e16afc 100644 --- a/Amalgam/src/Hooks/CHLClient_FrameStageNotify.cpp +++ b/Amalgam/src/Hooks/CHLClient_FrameStageNotify.cpp @@ -50,7 +50,7 @@ MAKE_HOOK(CHLClient_FrameStageNotify, U::Memory.GetVirtual(I::Client, 35), void, F::ESP.Store(pLocal); F::Chams.Store(pLocal); F::Glow.Store(pLocal); - F::Arrows.Store(); + F::OffscreenArrows.Store(); F::Visuals.Store(); F::CheaterDetection.Run(); diff --git a/Amalgam/src/Hooks/CL_Move.cpp b/Amalgam/src/Hooks/CL_Move.cpp index ccd6d63a..e617399c 100644 --- a/Amalgam/src/Hooks/CL_Move.cpp +++ b/Amalgam/src/Hooks/CL_Move.cpp @@ -8,6 +8,7 @@ #include "../Features/Backtrack/Backtrack.h" #include "../Features/Misc/Misc.h" #include "../Features/Visuals/Visuals.h" +#include "../Features/Output/Output.h" MAKE_SIGNATURE(CL_Move, "engine.dll", "40 55 53 48 8D AC 24 ? ? ? ? B8 ? ? ? ? E8 ? ? ? ? 48 2B E0 83 3D", 0x0); @@ -34,4 +35,5 @@ MAKE_HOOK(CL_Move, S::CL_Move(), void, F::PlayerCore.Run(); F::AutoQueue.Run(); F::Visuals.Tick(); + F::Output.Move(); } \ No newline at end of file diff --git a/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp b/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp index 30e90671..520c7558 100644 --- a/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp +++ b/Amalgam/src/Hooks/CL_ProcessPacketEntities.cpp @@ -14,7 +14,7 @@ MAKE_HOOK(CL_ProcessPacketEntities, S::CL_ProcessPacketEntities(), bool, { DEBUG_RETURN(CL_ProcessPacketEntities, entmsg); - if (entmsg->m_bIsDelta) // we won't need to restore + if (entmsg->m_bIsDelta || I::EngineClient->IsPlayingDemo()) // we won't need to restore return CALL_ORIGINAL(entmsg); auto pLocal = H::Entities.GetLocal(); diff --git a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp index f5d0fcfd..f3dceb2b 100644 --- a/Amalgam/src/Hooks/IEngineVGui_Paint.cpp +++ b/Amalgam/src/Hooks/IEngineVGui_Paint.cpp @@ -1,5 +1,9 @@ #include "../SDK/SDK.h" +#include "../Features/Visuals/Notifications/Notifications.h" +#include "../Features/Visuals/ESP/ESP.h" +#include "../Features/Visuals/OffscreenArrows/OffscreenArrows.h" +#include "../Features/Visuals/CameraWindow/CameraWindow.h" #include "../Features/Visuals/Visuals.h" #include "../Features/Ticks/Ticks.h" #include "../Features/CritHack/CritHack.h" @@ -8,10 +12,7 @@ #include "../Features/Visuals/PlayerConditions/PlayerConditions.h" #include "../Features/NoSpread/NoSpreadHitscan/NoSpreadHitscan.h" #include "../Features/Aimbot/Aimbot.h" -#include "../Features/Visuals/ESP/ESP.h" -#include "../Features/Visuals/OffscreenArrows/OffscreenArrows.h" -#include "../Features/Visuals/CameraWindow/CameraWindow.h" -#include "../Features/Visuals/Notifications/Notifications.h" +#include "../Features/PacketManip/AntiAim/AntiAim.h" #include "../Features/Aimbot/AutoHeal/AutoHeal.h" MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVirtual(I::EngineVGui, 14), void, @@ -31,11 +32,11 @@ MAKE_HOOK(IEngineVGui_Paint, U::Memory.GetVirtual(I::EngineVGui, 14), void, if (auto pLocal = H::Entities.GetLocal()) { F::CameraWindow.Draw(); - F::Visuals.DrawAntiAim(pLocal); + F::AntiAim.Draw(pLocal); F::Visuals.DrawPickupTimers(); F::ESP.Draw(); - F::Arrows.Draw(pLocal); + F::OffscreenArrows.Draw(pLocal); F::Aimbot.Draw(pLocal); #ifdef DEBUG_VACCINATOR diff --git a/Amalgam/src/SDK/Definitions/Interfaces.h b/Amalgam/src/SDK/Definitions/Interfaces.h index a67fed09..e9f82cdc 100644 --- a/Amalgam/src/SDK/Definitions/Interfaces.h +++ b/Amalgam/src/SDK/Definitions/Interfaces.h @@ -25,6 +25,7 @@ #include "Interfaces/IInput.h" #include "Interfaces/IInputSystem.h" #include "Interfaces/IKeyValuesSystem.h" +#include "Interfaces/ILocalize.h" #include "Interfaces/IMaterialSystem.h" #include "Interfaces/IMatSystemSurface.h" #include "Interfaces/IMemAlloc.h" diff --git a/Amalgam/src/SDK/SDK.cpp b/Amalgam/src/SDK/SDK.cpp index 985e0ec9..56613a8d 100644 --- a/Amalgam/src/SDK/SDK.cpp +++ b/Amalgam/src/SDK/SDK.cpp @@ -6,7 +6,7 @@ #pragma warning (disable : 6385) -MAKE_SIGNATURE(CAttributeManager_AttribHookFloat, "client.dll", "4C 8B DC 49 89 5B ? 49 89 6B ? 56 57 41 54 41 56 41 57 48 83 EC ? 48 8B 3D ? ? ? ? 4C 8D 35", 0x0); +MAKE_SIGNATURE(CAttributeManager_AttribHookValue_Float, "client.dll", "4C 8B DC 49 89 5B ? 49 89 6B ? 56 57 41 54 41 56 41 57 48 83 EC ? 48 8B 3D ? ? ? ? 4C 8D 35", 0x0); static BOOL CALLBACK TeamFortressWindow(HWND hWindow, LPARAM lParam) { @@ -125,20 +125,20 @@ std::string SDK::GetTime() return buffer; } -std::wstring SDK::ConvertUtf8ToWide(const std::string& source) +std::wstring SDK::ConvertUtf8ToWide(const std::string& sSource) { - int size = MultiByteToWideChar(CP_UTF8, 0, source.data(), -1, nullptr, 0); - std::wstring result(size, 0); - MultiByteToWideChar(CP_UTF8, 0, source.data(), -1, result.data(), size); - result.pop_back(); return result; + int iSize = MultiByteToWideChar(CP_UTF8, 0, sSource.data(), -1, nullptr, 0); + std::wstring sResult(iSize, 0); + MultiByteToWideChar(CP_UTF8, 0, sSource.data(), -1, sResult.data(), iSize); + sResult.pop_back(); return sResult; } -std::string SDK::ConvertWideToUTF8(const std::wstring& source) +std::string SDK::ConvertWideToUTF8(const std::wstring& sSource) { - int size = WideCharToMultiByte(CP_UTF8, 0, source.data(), -1, nullptr, 0, nullptr, nullptr); - std::string result(size, 0); - WideCharToMultiByte(CP_UTF8, 0, source.data(), -1, result.data(), size, nullptr, nullptr); - result.pop_back(); return result; + int iSize = WideCharToMultiByte(CP_UTF8, 0, sSource.data(), -1, nullptr, 0, nullptr, nullptr); + std::string sResult(iSize, 0); + WideCharToMultiByte(CP_UTF8, 0, sSource.data(), -1, sResult.data(), iSize, nullptr, nullptr); + sResult.pop_back(); return sResult; } HWND SDK::GetTeamFortressWindow() @@ -707,7 +707,7 @@ float SDK::MaxSpeed(CTFPlayer* pPlayer, bool bIncludeCrouch, bool bIgnoreSpecial float SDK::AttribHookValue(float value, const char* name, void* econent, void* buffer, bool isGlobalConstString) { - return S::CAttributeManager_AttribHookFloat.Call(value, name, econent, buffer, isGlobalConstString); + return S::CAttributeManager_AttribHookValue_Float.Call(value, name, econent, buffer, isGlobalConstString); } void SDK::FixMovement(CUserCmd* pCmd, const Vec3& vCurAngle, const Vec3& vTargetAngle) diff --git a/Amalgam/src/SDK/SDK.h b/Amalgam/src/SDK/SDK.h index 6d8ce856..24f3b75c 100644 --- a/Amalgam/src/SDK/SDK.h +++ b/Amalgam/src/SDK/SDK.h @@ -81,8 +81,8 @@ namespace SDK std::string GetDate(); std::string GetTime(); - std::wstring ConvertUtf8ToWide(const std::string& source); - std::string ConvertWideToUTF8(const std::wstring& source); + std::wstring ConvertUtf8ToWide(const std::string& sSource); + std::string ConvertWideToUTF8(const std::wstring& sSource); HWND GetTeamFortressWindow(); bool IsGameWindowInFocus(); diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index 408dc228..8314f3f3 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -265,7 +265,7 @@ NAMESPACE_BEGIN(Vars) CVarEnum(Ignore, "Ignore", 0b00000001000, DROPDOWN_MULTI, nullptr, VA_LIST("Friends", "Party", "Unprioritized", "Invulnerable", "Invisible", "Unsimulated", "Dead ringer", "Vaccinator", "Disguised", "Taunting", "Team"), Friends = 1 << 0, Party = 1 << 1, Unprioritized = 1 << 2, Invulnerable = 1 << 3, Invisible = 1 << 4, Unsimulated = 1 << 5, DeadRinger = 1 << 6, Vaccinator = 1 << 7, Disguised = 1 << 8, Taunting = 1 << 9, Team = 1 << 10); - CVar(AimFOV, "Aim FOV", 30.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 180.f); + CVar(AimFOV, "Aim FOV", 180.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 180.f); CVar(MaxTargets, "Max targets", 2, SLIDER_MIN, 1, 6); CVar(IgnoreInvisible, "Ignore invisible", 50.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 10.f, "%g%%"); CVar(AssistStrength, "Assist strength", 25.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 1.f, "%g%%"); @@ -322,7 +322,7 @@ NAMESPACE_BEGIN(Vars) CVarEnum(Modifiers, VA_LIST("Modifiers", "Projectile modifiers"), 0b0010, DROPDOWN_MULTI, nullptr, VA_LIST("Charge weapon", "Cancel charge", "Use arm time", "Air splash", "Lob angles"), ChargeWeapon = 1 << 0, CancelCharge = 1 << 1, UseArmTime = 1 << 2, AirSplash = 1 << 3, LobAngles = 1 << 4); - CVar(MaxSimulationTime, "Max simulation time", 2.f, SLIDER_MIN | SLIDER_PRECISION, 0.1f, 2.5f, 0.25f, "%gs"); + CVar(MaxSimulationTime, "Max simulation time", 1.f, SLIDER_MIN | SLIDER_PRECISION, 0.1f, 2.5f, 0.25f, "%gs"); CVar(HitChance, "Hit chance", 0.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 10.f, "%g%%"); CVar(AutodetRadius, "Autodet radius", 90.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 10.f, "%g%%"); CVar(SplashRadius, "Splash radius", 90.f, SLIDER_CLAMP | SLIDER_PRECISION, 0.f, 100.f, 10.f, "%g%%"); @@ -376,6 +376,7 @@ NAMESPACE_BEGIN(Vars) CVar(DirectTraceInterval, "Direct trace interval", 1, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 20); CVar(SplashTraceInterval, "Splash trace interval", 10, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 20); CVar(LobTraceInterval, "Lob trace interval", 20, NOSAVE | DEBUGVAR | SLIDER_MIN, 1, 20); + CVar(IntervalRetest, "Interval retest", true, NOSAVE | DEBUGVAR); CVar(DeltaCount, "Delta count", 5, NOSAVE | DEBUGVAR, 1, 5); CVarEnum(DeltaMode, "Delta mode", 0, NOSAVE | DEBUGVAR, nullptr, @@ -388,8 +389,8 @@ NAMESPACE_BEGIN(Vars) NAMESPACE_BEGIN(Melee) CVar(AutoBackstab, "Auto backstab", true); - CVar(IgnoreRazorback, "Ignore razorback", true); - CVar(SwingPrediction, "Swing prediction", false); + CVar(IgnoreRazorback, "Ignore razorback", false); + CVar(SwingPrediction, "Swing prediction", true); CVar(WhipTeam, "Whip team", false); CVar(SwingOffset, "Swing offset", -1, NOSAVE | DEBUGVAR, -1, 1); @@ -492,6 +493,8 @@ NAMESPACE_BEGIN(Vars) CVar(MinWalk, "Minwalk", true); CVar(AntiOverlap, "Anti-overlap", false); CVar(InvalidShootPitch, "Hide pitch on shot", false); + + CVar(AntiAimLines, "Antiaim lines", false, NOSAVE); NAMESPACE_END(AntiAim) NAMESPACE_BEGIN(Resolver) @@ -628,7 +631,7 @@ NAMESPACE_BEGIN(Vars) NAMESPACE_END(Beams) NAMESPACE_BEGIN(Line) - CVar(Enabled, "Line tracers", false, VISUAL); + CVar(TracersEnabled, "Tracers enabled", false, VISUAL); CVar(DrawDuration, VA_LIST("Draw duration", "Line draw duration"), 5.f, VISUAL | SLIDER_MIN | SLIDER_PRECISION, 0.f, 10.f); NAMESPACE_END(Line) @@ -714,15 +717,15 @@ NAMESPACE_BEGIN(Vars) CVar(Bunnyhop, "Bunnyhop", false); CVar(EdgeJump, "Edge jump", false); CVar(AutoJumpbug, "Auto jumpbug", false); - CVar(NoPush, "No push", false); + CVar(BreakJump, "Break jump", false); CVar(AutoRocketJump, "Auto rocket jump", false); CVar(AutoCTap, "Auto ctap", false); CVar(FastStop, "Fast stop", false); CVar(FastAccelerate, "Fast accelerate", false); CVar(DuckSpeed, "Duck speed", false); - CVar(MovementLock, "Movement lock", false); - CVar(BreakJump, "Break jump", false); CVar(ShieldTurnRate, "Shield turn rate", false); + CVar(NoPush, "No push", false); + CVar(MovementLock, "Movement lock", false); CVar(AutoRocketJumpChokeGrounded, "Choke grounded", 1, NOSAVE | DEBUGVAR, 0, 3); CVar(AutoRocketJumpChokeAir, "Choke air", 1, NOSAVE | DEBUGVAR, 0, 3); @@ -878,12 +881,13 @@ NAMESPACE_BEGIN(Vars) CVar(Info, "Debug info", false, NOSAVE); CVar(Logging, "Debug logging", false, NOSAVE); CVar(Options, "Debug options", false, NOSAVE); - CVar(DrawHitboxes, "Show hitboxes", false, NOSAVE); - CVar(AntiAimLines, "Antiaim lines", false); - CVar(CrashLogging, "Crash logging", true); + CVar(CrashLogging, "Crash logging", true, NOBIND); + #ifdef DEBUG_TRACES CVar(VisualizeTraces, "Visualize traces", false, NOSAVE); CVar(VisualizeTraceHits, "Visualize trace hits", false, NOSAVE); #endif + + CVar(DrawHitboxes, "Show hitboxes", false, NOSAVE); NAMESPACE_END(Debug) NAMESPACE_END(Vars) \ No newline at end of file diff --git a/Amalgam/src/Utils/Hooks/Hooks.cpp b/Amalgam/src/Utils/Hooks/Hooks.cpp index 47a881c1..5232833b 100644 --- a/Amalgam/src/Utils/Hooks/Hooks.cpp +++ b/Amalgam/src/Utils/Hooks/Hooks.cpp @@ -2,6 +2,7 @@ #include "../../Core/Core.h" #include "../../Hooks/Direct3DDevice9.h" +#include CHook::CHook(const std::string& sName, void* pInitFunc) { @@ -14,7 +15,7 @@ bool CHooks::Initialize() MH_Initialize(); WndProc::Initialize(); - for (auto& [_, pHook] : m_mHooks) + for (auto& pHook : m_mHooks | std::views::values) reinterpret_cast(pHook->m_pInitFunc)(); m_bFailed = MH_EnableHook(MH_ALL_HOOKS) != MH_OK;