mirror of
https://github.com/rei-2/Amalgam
synced 2026-10-10 04:43:09 +08:00
misc changes and fixes
crash fixes fix some other oversights
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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<CTFPlayer>();
|
||||
}
|
||||
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<Setup_t>& 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<Point_t> 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<Vec3, Vec3>(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<Vec3, Vec3>(eyeTrace.startpos, eyeTrace.endpos), I::GlobalVars->curtime + 5.f, Color_t(255, 0, 255));
|
||||
G::LineStorage.emplace_back(std::pair<Vec3, Vec3>(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<Vec3, Vec3>(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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -133,6 +133,7 @@ bool CBacktrack::GetRecords(CBaseEntity* pEntity, std::vector<TickRecord*>& vRet
|
||||
return false;
|
||||
|
||||
auto& vRecords = m_mRecords[pEntity];
|
||||
vReturn.reserve(vRecords.size());
|
||||
for (auto& tRecord : vRecords)
|
||||
vReturn.push_back(&tRecord);
|
||||
return true;
|
||||
|
||||
@@ -114,31 +114,30 @@ namespace ImGui
|
||||
ImVec2 m_vPos;
|
||||
ImVec2 m_vSize;
|
||||
};
|
||||
static std::vector<Row_t> vRowSizes = {};
|
||||
static std::vector<Row_t> 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<std::string> 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<WidgetWindow_t> WidgetTable(int iCount, float flHeight, std::vector<float> vWidths = {}, int iWindowFlags = ImGuiChildFlags_AlwaysUseWindowPadding, int iChildFlags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)
|
||||
inline std::vector<WidgetWindow_t> WidgetTable(int iCount, float flHeight, std::vector<float> vWidths = {}, ImGuiChildFlags iWindowFlags = ImGuiChildFlags_AlwaysUseWindowPadding, ImGuiWindowFlags iChildFlags = ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)
|
||||
{
|
||||
std::vector<WidgetWindow_t> 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<WidgetWindow_t>& 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<int>& var, int iFlags = FKeybindEnum::None, std::vector<int> 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<int>& tVar, int iFlags = FKeybindEnum::None, std::vector<int> 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 <class T>
|
||||
inline int GetBind(ConfigVar<T>& var, bool bForce = false)
|
||||
inline int GetBind(ConfigVar<T>& 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 <class T>
|
||||
inline T GetParentValue(ConfigVar<T>& var, int iBind) // oh my god
|
||||
inline T GetParentValue(ConfigVar<T>& 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 <class T>
|
||||
inline T& FGet(ConfigVar<T>& var, bool bDisable = false)
|
||||
inline T& FGet(ConfigVar<T>& 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 <class T>
|
||||
inline void FSet(ConfigVar<T>& var, T val)
|
||||
inline void FSet(ConfigVar<T>& 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 <class T>
|
||||
inline void DrawBindInfo(ConfigVar<T>& var, T& val, const std::string& sBind, bool bNewPopup, bool& bLastHovered)
|
||||
inline void DrawBindInfo(ConfigVar<T>& 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<int> vValues = {};
|
||||
|
||||
std::vector<std::string> 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<type>& var, parameters, bool* pHovered = nullptr, int iBindOverride = -1, int iLabelOverride = -1) \
|
||||
inline bool function(ConfigVar<type>& 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<const char*> vEntries, std::vector<int> 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<std::pair<std::string, Color_t>>), 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<const char*> vEntries, std::vector<int> 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<std::pair<std::string, Color_t>>), 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))
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,8 +26,8 @@ private:
|
||||
void MenuSettings(int iTab = 0);
|
||||
void MenuSearch(std::string sSearch);
|
||||
|
||||
void AddDraggable(const char* sLabel, ConfigVar<DragBox_t>& var, bool bShouldDraw = true, ImVec2 vSize = { H::Draw.Scale(100), H::Draw.Scale(40) });
|
||||
void AddResizableDraggable(const char* sLabel, ConfigVar<WindowBox_t>& 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<DragBox_t>& tVar, bool bShouldDraw = true, ImVec2 vSize = { H::Draw.Scale(100), H::Draw.Scale(40) });
|
||||
void AddResizableDraggable(const char* sLabel, ConfigVar<WindowBox_t>& 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<Output_t> m_vOutput = {};
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -20,4 +20,4 @@ public:
|
||||
void Draw(CTFPlayer* pLocal);
|
||||
};
|
||||
|
||||
ADD_FEATURE(COffscreenArrows, Arrows);
|
||||
ADD_FEATURE(COffscreenArrows, OffscreenArrows);
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -53,7 +53,7 @@ MAKE_HOOK(CBaseHudChatLine_InsertAndColorizeText, S::CBaseHudChatLine_InsertAndC
|
||||
std::vector<std::pair<std::string, std::string>> 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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
+12
-12
@@ -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<float>(value, name, econent, buffer, isGlobalConstString);
|
||||
return S::CAttributeManager_AttribHookValue_Float.Call<float>(value, name, econent, buffer, isGlobalConstString);
|
||||
}
|
||||
|
||||
void SDK::FixMovement(CUserCmd* pCmd, const Vec3& vCurAngle, const Vec3& vTargetAngle)
|
||||
|
||||
@@ -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();
|
||||
|
||||
+15
-11
@@ -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)
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "../../Core/Core.h"
|
||||
#include "../../Hooks/Direct3DDevice9.h"
|
||||
#include <ranges>
|
||||
|
||||
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<void(__cdecl*)()>(pHook->m_pInitFunc)();
|
||||
|
||||
m_bFailed = MH_EnableHook(MH_ALL_HOOKS) != MH_OK;
|
||||
|
||||
Reference in New Issue
Block a user