diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp index bfa157e8..edcca707 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.cpp @@ -116,110 +116,108 @@ static inline std::vector GetTargets(CTFPlayer* pLocal, CTFWeaponBase* int CAimbotMelee::GetSwingTime(CTFWeaponBase* pWeapon, bool bVar) { - if (pWeapon->GetWeaponID() == TF_WEAPON_KNIFE) - return 0; - int iSmackTicks = ceilf(pWeapon->GetSmackDelay() / TICK_INTERVAL); - if (bVar) - iSmackTicks = std::max(iSmackTicks + Vars::Aimbot::Melee::SwingOffset.Value, 0); - return iSmackTicks; + return pWeapon->GetWeaponID() == TF_WEAPON_KNIFE ? 0 + : bVar ? Vars::Aimbot::Melee::SwingTicks.Value + : ceilf(pWeapon->GetSmackDelay() / TICK_INTERVAL); } void CAimbotMelee::UpdateInfo(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserCmd* pCmd, std::vector vTargets) { m_mRecordMap.clear(); m_mPaths.clear(); - m_iDoubletapTicks = F::Ticks.GetTicks(pWeapon); m_vEyePos = pLocal->GetShootPos(); m_flRange = pWeapon->GetSwingRange(); + m_iSimulatedTicks = GetSwingTime(pWeapon), m_iSwingTicks = GetSwingTime(pWeapon, false); + m_iDoubletapTicks = F::Ticks.GetTicks(pWeapon); + m_bShouldSwing = m_iDoubletapTicks <= m_iSwingTicks || Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); + m_bSimulatedLocal = false; - int iSimTicks = GetSwingTime(pWeapon), iSwingTicks = GetSwingTime(pWeapon, false); - - if ((Vars::Aimbot::Melee::SwingPrediction.Value && iSimTicks || m_iDoubletapTicks) && G::CanPrimaryAttack && pWeapon->m_flSmackTime() < 0.f) + if ((!Vars::Aimbot::Melee::SwingPrediction.Value || !m_iSimulatedTicks) && !m_iDoubletapTicks || !G::CanPrimaryAttack || pWeapon->m_flSmackTime() > 0.f) { - std::unordered_map mMoveStorage; - - F::MoveSim.Initialize(pLocal, mMoveStorage[I::EngineClient->GetLocalPlayer()], false, !m_iDoubletapTicks); - for (auto& tTarget : vTargets) - F::MoveSim.Initialize(tTarget.m_pEntity, mMoveStorage[tTarget.m_pEntity->entindex()], false); - - int iMax = std::max(iSimTicks, m_iDoubletapTicks); - int iTicks = iMax; bool bSwung = false; - for (int i = 0; i < iTicks; i++) // intended for plocal to collide with targets - { - { - auto& tMoveStorage = mMoveStorage[I::EngineClient->GetLocalPlayer()]; - - if (!bSwung && (!m_iDoubletapTicks || Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity() || iMax - i <= iSwingTicks)) - { - iTicks = std::min(i + iSwingTicks, iMax), bSwung = true; - if (!iSwingTicks) - break; - - if (pLocal->InCond(TF_COND_SHIELD_CHARGE)) - { // demo charge fix for swing pred - tMoveStorage.m_MoveData.m_flMaxSpeed = tMoveStorage.m_MoveData.m_flClientMaxSpeed = SDK::MaxSpeed(pLocal, false, true); - pLocal->m_flMaxspeed() = tMoveStorage.m_MoveData.m_flMaxSpeed; - pLocal->RemoveCond(TF_COND_SHIELD_CHARGE); - } - } - if (m_iDoubletapTicks && Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity()) - F::Ticks.AntiWarp(pLocal, pCmd->viewangles.y, tMoveStorage.m_MoveData.m_flForwardMove, tMoveStorage.m_MoveData.m_flSideMove, iMax - i - 1); - - F::MoveSim.RunTick(tMoveStorage); - m_mRecordMap[I::EngineClient->GetLocalPlayer()].emplace_front( - pLocal->m_flSimulationTime() + TICKS_TO_TIME(i + 1), - tMoveStorage.m_MoveData.m_vecAbsOrigin, - pLocal->m_vecMins(), pLocal->m_vecMaxs() - ); - } - - if (i < iSimTicks - m_iDoubletapTicks) - { - for (auto& tTarget : vTargets) - { - auto& tMoveStorage = mMoveStorage[tTarget.m_pEntity->entindex()]; - if (tMoveStorage.m_bFailed) - continue; - - F::MoveSim.RunTick(tMoveStorage); - m_mRecordMap[tTarget.m_pEntity->entindex()].emplace_front( - !Vars::Aimbot::Melee::SwingPredictLag.Value || tMoveStorage.m_bPredictNetworked ? tTarget.m_pEntity->m_flSimulationTime() + TICKS_TO_TIME(i + 1) : 0.f, - Vars::Aimbot::Melee::SwingPredictLag.Value ? tMoveStorage.m_vPredictedOrigin : tMoveStorage.m_MoveData.m_vecAbsOrigin, - tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs() - ); - } - } - } - m_vEyePos = mMoveStorage[I::EngineClient->GetLocalPlayer()].m_MoveData.m_vecAbsOrigin + pLocal->m_vecViewOffset(); - m_flRange = pWeapon->GetSwingRange(); - - if (Vars::Visuals::Prediction::SwingLines.Value && Vars::Visuals::Prediction::PlayerPath.Value) - { - for (auto& [iIndex, tMoveStorage] : mMoveStorage) - m_mPaths[iIndex] = tMoveStorage.m_vPath; - - const bool bAlwaysDraw = !Vars::Aimbot::General::AutoShoot.Value || Vars::Debug::Info.Value; - if (bAlwaysDraw) - { - G::LineStorage.clear(); - G::BoxStorage.clear(); - G::PathStorage.clear(); - - for (auto& vPath : m_mPaths | std::views::values) - { - float flDuration = Vars::Visuals::Prediction::PlayerDrawDuration.Value; - if (Vars::Colors::PlayerPathIgnoreZ.Value.a) - G::PathStorage.emplace_back(vPath, !flDuration ? -int(vPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value); - if (Vars::Colors::PlayerPath.Value.a) - G::PathStorage.emplace_back(vPath, !flDuration ? -int(vPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true); - } - } - } - - for (auto& tMoveStorage : mMoveStorage | std::views::values) - F::MoveSim.Restore(tMoveStorage); + m_iSimulatedTicks = m_iSwingTicks = 0; + return; } - m_bShouldSwing = m_iDoubletapTicks <= iSwingTicks || Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity(); + std::unordered_map mMoveStorage; + + F::MoveSim.Initialize(pLocal, mMoveStorage[pLocal->entindex()], false, !m_iDoubletapTicks); + for (auto& tTarget : vTargets) + F::MoveSim.Initialize(tTarget.m_pEntity, mMoveStorage[tTarget.m_pEntity->entindex()], false); + + int iMax = std::max(m_iSimulatedTicks, m_iDoubletapTicks), iTicks = iMax; bool bSwung = false; + Vec3 vLocalOrigin = mMoveStorage[pLocal->entindex()].m_MoveData.m_vecAbsOrigin; + for (int i = 0; i < iTicks; i++) // intended for plocal to collide with targets + { + { + auto& tMoveStorage = mMoveStorage[pLocal->entindex()]; + if (!bSwung && (!m_iDoubletapTicks || Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity() || iMax - i <= m_iSwingTicks)) + { + iTicks = std::min(i + m_iSwingTicks, iMax), bSwung = true; + if (!m_iSwingTicks) + break; + + if (pLocal->InCond(TF_COND_SHIELD_CHARGE)) + { // demo charge fix for swing pred + tMoveStorage.m_MoveData.m_flMaxSpeed = tMoveStorage.m_MoveData.m_flClientMaxSpeed = SDK::MaxSpeed(pLocal, false, true); + pLocal->m_flMaxspeed() = tMoveStorage.m_MoveData.m_flMaxSpeed; + pLocal->RemoveCond(TF_COND_SHIELD_CHARGE); + } + } + if (m_iDoubletapTicks && Vars::Doubletap::AntiWarp.Value && pLocal->m_hGroundEntity()) + F::Ticks.AntiWarp(pLocal, pCmd->viewangles.y, tMoveStorage.m_MoveData.m_flForwardMove, tMoveStorage.m_MoveData.m_flSideMove, iMax - i - 1); + + F::MoveSim.RunTick(tMoveStorage); + + vLocalOrigin = tMoveStorage.m_MoveData.m_vecAbsOrigin; + m_bSimulatedLocal = true; + } + + if (i < m_iSimulatedTicks - m_iDoubletapTicks) + { + for (auto& tTarget : vTargets) + { + auto& tMoveStorage = mMoveStorage[tTarget.m_pEntity->entindex()]; + if (tMoveStorage.m_bFailed) + continue; + + F::MoveSim.RunTick(tMoveStorage); + if (Vars::Aimbot::Melee::SwingPredictLag.Value && !tMoveStorage.m_bPredictNetworked) + continue; + + Vec3 vOrigin = Vars::Aimbot::Melee::SwingPredictLag.Value ? tMoveStorage.m_vPredictedOrigin : tMoveStorage.m_MoveData.m_vecAbsOrigin; + m_mRecordMap[tTarget.m_pEntity->entindex()].emplace_front( + tTarget.m_pEntity->m_flSimulationTime() + TICKS_TO_TIME(i + 1), vOrigin, tTarget.m_pEntity->m_vecMins(), tTarget.m_pEntity->m_vecMaxs() + ); + } + } + } + m_vEyePos = vLocalOrigin + pLocal->m_vecViewOffset(); + m_flRange = pWeapon->GetSwingRange(); + + if (Vars::Visuals::Prediction::SwingLines.Value && Vars::Visuals::Prediction::PlayerPath.Value) + { + for (auto& [iIndex, tMoveStorage] : mMoveStorage) + m_mPaths[iIndex] = tMoveStorage.m_vPath; + + const bool bAlwaysDraw = !Vars::Aimbot::General::AutoShoot.Value || Vars::Debug::Info.Value; + if (bAlwaysDraw) + { + G::LineStorage.clear(); + G::BoxStorage.clear(); + G::PathStorage.clear(); + + for (auto& vPath : m_mPaths | std::views::values) + { + float flDuration = Vars::Visuals::Prediction::PlayerDrawDuration.Value; + if (Vars::Colors::PlayerPathIgnoreZ.Value.a) + G::PathStorage.emplace_back(vPath, !flDuration ? -int(vPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value); + if (Vars::Colors::PlayerPath.Value.a) + G::PathStorage.emplace_back(vPath, !flDuration ? -int(vPath.size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true); + } + } + } + + for (auto& tMoveStorage : mMoveStorage | std::views::values) + F::MoveSim.Restore(tMoveStorage); } bool CAimbotMelee::CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEyeAngles) @@ -244,7 +242,7 @@ bool CAimbotMelee::CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEy const float flSqCompDist = 0.0884f; if (auto pCmd = G::CurrentUserCmd; - m_mRecordMap[pLocal->entindex()].empty() && pCmd->viewangles != vEyeAngles && G::CanPrimaryAttack) + !m_bSimulatedLocal && pCmd->viewangles != vEyeAngles && G::CanPrimaryAttack) { // repredict, prevent prediction error potentially causing miss CUserCmd tOldCmd = *pCmd; Vec3 vOldAngles = I::EngineClient->GetViewAngles(); @@ -291,14 +289,14 @@ bool CAimbotMelee::CanBackstab(CBaseEntity* pTarget, CTFPlayer* pLocal, Vec3 vEy }; Vec3 vTargetAngles = { 0.f, H::Entities.GetEyeAngles(pTarget->entindex()).y, 0.f }; - if (!Vars::Aimbot::Melee::BackstabAccountPing.Value) + if (!(Vars::Aimbot::Melee::BackstabFlags.Value & Vars::Aimbot::Melee::BackstabFlagsEnum::AccountPing)) { if (!fTestDots(vTargetAngles)) return false; } else { - if (Vars::Aimbot::Melee::BackstabDoubleTest.Value && !fTestDots(vTargetAngles)) + if (Vars::Aimbot::Melee::BackstabFlags.Value & Vars::Aimbot::Melee::BackstabFlagsEnum::DoubleTest && !fTestDots(vTargetAngles)) return false; vTargetAngles.y += H::Entities.GetDeltaAngles(pTarget->entindex()).y; @@ -337,7 +335,23 @@ int CAimbotMelee::CanHit(Target_t& tTarget, CTFPlayer* pLocal, CTFWeaponBase* pW { for (auto& tRecord : vSimRecords) vRecords.push_back(&tRecord); - vRecords = F::Backtrack.GetValidRecords(vRecords, pLocal, true, -TICKS_TO_TIME(vSimRecords.size())); + switch (Vars::Aimbot::Melee::SwingValidateMode.Value) + { + case Vars::Aimbot::Melee::SwingValidateModeEnum::Both: + if (m_iSimulatedTicks != m_iSwingTicks) + { + vRecords = F::Backtrack.GetValidRecords(vRecords, pLocal, true, -TICKS_TO_TIME(m_iSimulatedTicks)); + vRecords = F::Backtrack.GetValidRecords(vRecords, pLocal, true, -TICKS_TO_TIME(m_iSwingTicks)); + break; + } + [[fallthrough]]; + case Vars::Aimbot::Melee::SwingValidateModeEnum::Swing: + vRecords = F::Backtrack.GetValidRecords(vRecords, pLocal, true, -TICKS_TO_TIME(m_iSwingTicks)); + break; + case Vars::Aimbot::Melee::SwingValidateModeEnum::Simulated: + vRecords = F::Backtrack.GetValidRecords(vRecords, pLocal, true, -TICKS_TO_TIME(m_iSimulatedTicks)); + break; + } } if (vRecords.empty()) return false; @@ -508,12 +522,12 @@ static inline void DrawVisuals(CTFPlayer* pLocal, CTFWeaponBase* pWeapon, CUserC float flDuration = Vars::Visuals::Prediction::PlayerDrawDuration.Value; if (Vars::Colors::PlayerPathIgnoreZ.Value.a) { - G::PathStorage.emplace_back(mPaths[I::EngineClient->GetLocalPlayer()], !flDuration ? -int(mPaths[I::EngineClient->GetLocalPlayer()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value); + G::PathStorage.emplace_back(mPaths[pLocal->entindex()], !flDuration ? -int(mPaths[pLocal->entindex()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value); G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], !flDuration ? -int(mPaths[tTarget.m_pEntity->entindex()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPathIgnoreZ.Value, Vars::Visuals::Prediction::PlayerPath.Value); } if (Vars::Colors::PlayerPath.Value.a) { - G::PathStorage.emplace_back(mPaths[I::EngineClient->GetLocalPlayer()], !flDuration ? -int(mPaths[I::EngineClient->GetLocalPlayer()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true); + G::PathStorage.emplace_back(mPaths[pLocal->entindex()], !flDuration ? -int(mPaths[pLocal->entindex()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true); G::PathStorage.emplace_back(mPaths[tTarget.m_pEntity->entindex()], !flDuration ? -int(mPaths[tTarget.m_pEntity->entindex()].size()) : I::GlobalVars->curtime + flDuration, Vars::Colors::PlayerPath.Value, Vars::Visuals::Prediction::PlayerPath.Value, true); } } diff --git a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h index d374c076..0b6b2a4f 100644 --- a/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h +++ b/Amalgam/src/Features/Aimbot/AimbotMelee/AimbotMelee.h @@ -20,7 +20,10 @@ private: Vec3 m_vEyePos = {}; float m_flRange = 0.f; bool m_bShouldSwing = false; + bool m_bSimulatedLocal = false; + int m_iSwingTicks = 0; + int m_iSimulatedTicks = 0; int m_iDoubletapTicks = 0; std::unordered_map> m_mRecordMap; diff --git a/Amalgam/src/Features/ImGui/Menu/Menu.cpp b/Amalgam/src/Features/ImGui/Menu/Menu.cpp index 4da71d1b..a705c947 100644 --- a/Amalgam/src/Features/ImGui/Menu/Menu.cpp +++ b/Amalgam/src/Features/ImGui/Menu/Menu.cpp @@ -414,10 +414,10 @@ void CMenu::MenuAimbot(int iTab) FText("Debug", { 5, 5 }); if (FPopupButton("Debug", { 0, -5 })) { - FSlider(Vars::Aimbot::Melee::SwingOffset, FSliderEnum::Left); + FSlider(Vars::Aimbot::Melee::SwingTicks, FSliderEnum::Left); FToggle(Vars::Aimbot::Melee::SwingPredictLag, FToggleEnum::Right); - FToggle(Vars::Aimbot::Melee::BackstabAccountPing, FToggleEnum::Left); - FToggle(Vars::Aimbot::Melee::BackstabDoubleTest, FToggleEnum::Right); + FDropdown(Vars::Aimbot::Melee::SwingValidateMode, FDropdownEnum::Left); + FDropdown(Vars::Aimbot::Melee::BackstabFlags, FDropdownEnum::Right); EndPopup(); } diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp index ab9e5d4c..7354fd56 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.cpp @@ -32,6 +32,17 @@ void CMovementSimulation::Reset(MoveStorage& tMoveStorage) } } +static inline int GetMoveMode(CTFPlayer* pPlayer) +{ + if (pPlayer->IsSwimming()) + return MoveEnum::Swim; + + if (pPlayer->IsOnGround()) + return MoveEnum::Ground; + + return MoveEnum::Air; +} + static inline void HandleMovement(CTFPlayer* pPlayer, MoveData* pLastRecord, MoveData& tCurRecord, std::deque& vRecords) { bool bLocal = pPlayer->entindex() == I::EngineClient->GetLocalPlayer(); @@ -63,7 +74,7 @@ static inline void HandleMovement(CTFPlayer* pPlayer, MoveData* pLastRecord, Mov if (pPlayer->InCond(TF_COND_SHIELD_CHARGE)) { - G::DummyCmd.forwardmove = 450.f; + G::DummyCmd.forwardmove = 520.f; G::DummyCmd.sidemove = 0.f; SDK::FixMovement(&G::DummyCmd, bLocal ? G::CurrentUserCmd->viewangles : pPlayer->GetEyeAngles(), {}); tCurRecord.m_vDirection.x = G::DummyCmd.forwardmove; @@ -71,27 +82,24 @@ static inline void HandleMovement(CTFPlayer* pPlayer, MoveData* pLastRecord, Mov return; } + tCurRecord.m_bInputDirection = bLocal; switch (tCurRecord.m_iMode) { case MoveEnum::Ground: - { - if (bLocal && Vars::Misc::Movement::Bunnyhop.Value && G::OriginalCmd.buttons & IN_JUMP) - { - float flMaxSpeed = SDK::MaxSpeed(pPlayer, true); - tCurRecord.m_vDirection = tCurRecord.m_vVelocity.Normalized2D() * flMaxSpeed; - } + if (!bLocal) + break; + else if (Vars::Misc::Movement::AutoStrafe.Value || Vars::Misc::Movement::Bunnyhop.Value && G::OriginalCmd.buttons & IN_JUMP) + tCurRecord.m_vDirection = tCurRecord.m_vVelocity.Normalized2D() * 520.f, tCurRecord.m_bInputDirection = false; break; - } case MoveEnum::Air: - { - float flMaxSpeed = SDK::MaxSpeed(pPlayer, true); - tCurRecord.m_vDirection = tCurRecord.m_vVelocity.Normalized2D() * flMaxSpeed; + if (!bLocal) + break; + else if (Vars::Misc::Movement::AutoStrafe.Value || tCurRecord.m_vDirection.To2D().IsZero() || tCurRecord.m_vVelocity.To2D() == pLastRecord->m_vVelocity.To2D()) + tCurRecord.m_vDirection = tCurRecord.m_vVelocity.Normalized2D() * 520.f, tCurRecord.m_bInputDirection = false; break; - } case MoveEnum::Swim: - { - tCurRecord.m_vDirection *= 2; - } + if (!bLocal) + tCurRecord.m_vDirection = tCurRecord.m_vVelocity.Normalized() * 520.f, tCurRecord.m_bInputDirection = false; } } @@ -120,7 +128,7 @@ void CMovementSimulation::Store() vRecords.emplace_front( vDirection, pPlayer->m_flSimulationTime(), - pPlayer->IsSwimming() ? MoveEnum::Swim : pPlayer->IsOnGround() ? MoveEnum::Ground : MoveEnum::Air, + GetMoveMode(pPlayer), vVelocity, vOrigin ); @@ -168,7 +176,7 @@ void CMovementSimulation::StorePlayer(CTFPlayer* pPlayer, CMoveData& tMoveData, vRecords.emplace_front( vDirection, flTime, - pPlayer->IsSwimming() ? MoveEnum::Swim : pPlayer->IsOnGround() ? MoveEnum::Ground : MoveEnum::Air, + GetMoveMode(pPlayer), vVelocity, vOrigin ); @@ -271,7 +279,7 @@ void CMovementSimulation::SetupMoveData(MoveStorage& tMoveStorage) tMoveStorage.m_MoveData.m_vecViewAngles = H::Entities.GetEyeAngles(iIndex); } - const auto& vRecords = m_mRecords[tMoveStorage.m_pPlayer->entindex()]; + const auto& vRecords = m_mRecords[iIndex]; if (!vRecords.empty()) { auto& tRecord = vRecords.front(); @@ -532,6 +540,22 @@ bool CMovementSimulation::StrafePrediction(MoveStorage& tMoveStorage, bool bHitc } } + if (tMoveStorage.m_flAverageYaw && !tMoveStorage.m_bDirectMove) + { + const auto& vRecords = m_mRecords[tMoveStorage.m_pPlayer->entindex()]; + if (!vRecords.empty()) + { + auto& tRecord = vRecords.front(); + Vec3 vDirection = tRecord.m_vVelocity; + if (!vDirection.IsZero() && tRecord.m_bInputDirection) + { // fix inputs for turning + int iSign = sign(tMoveStorage.m_flAverageYaw); + float flForward = tMoveStorage.m_MoveData.m_flForwardMove, flSide = tMoveStorage.m_MoveData.m_flSideMove; + tMoveStorage.m_MoveData.m_flForwardMove = -flSide * iSign, tMoveStorage.m_MoveData.m_flSideMove = flForward * iSign; + } + } + } + return true; } @@ -629,8 +653,6 @@ void CMovementSimulation::RunTick(MoveStorage& tMoveStorage, bool bPath, RunTick } tMoveStorage.m_MoveData.m_vecViewAngles.y += tMoveStorage.m_flAverageYaw * flMult + flCorrection; } - else if (!tMoveStorage.m_bDirectMove) - tMoveStorage.m_MoveData.m_flForwardMove = tMoveStorage.m_MoveData.m_flSideMove = 0.f; float flOldSpeed = tMoveStorage.m_MoveData.m_flClientMaxSpeed; if (tMoveStorage.m_pPlayer->m_bDucked() && tMoveStorage.m_pPlayer->IsOnGround() && !tMoveStorage.m_pPlayer->IsSwimming()) @@ -664,7 +686,7 @@ void CMovementSimulation::RunTick(MoveStorage& tMoveStorage, bool bPath, RunTick && !tMoveStorage.m_MoveData.m_flForwardMove && !tMoveStorage.m_MoveData.m_flSideMove && tMoveStorage.m_MoveData.m_vecVelocity.Length2D() > tMoveStorage.m_MoveData.m_flMaxSpeed * 0.015f) { - Vec3 vDirection = tMoveStorage.m_MoveData.m_vecVelocity.Normalized2D() * 450.f; + Vec3 vDirection = tMoveStorage.m_MoveData.m_vecVelocity.Normalized2D() * 520.f; G::DummyCmd.forwardmove = vDirection.x, G::DummyCmd.sidemove = -vDirection.y; SDK::FixMovement(&G::DummyCmd, {}, tMoveStorage.m_MoveData.m_vecViewAngles); tMoveStorage.m_MoveData.m_flForwardMove = G::DummyCmd.forwardmove, tMoveStorage.m_MoveData.m_flSideMove = G::DummyCmd.sidemove; diff --git a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h index ad9bf13c..75ad6110 100644 --- a/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h +++ b/Amalgam/src/Features/Simulation/MovementSimulation/MovementSimulation.h @@ -36,6 +36,7 @@ struct MoveData int m_iMode = 0; Vec3 m_vVelocity = {}; Vec3 m_vOrigin = {}; + bool m_bInputDirection = false; }; class CMovementSimulation diff --git a/Amalgam/src/SDK/Definitions/Types.h b/Amalgam/src/SDK/Definitions/Types.h index cb7cd558..d4b9c2f4 100644 --- a/Amalgam/src/SDK/Definitions/Types.h +++ b/Amalgam/src/SDK/Definitions/Types.h @@ -40,27 +40,27 @@ public: inline Vec2(float X = 0.f, float Y = 0.f) { - x = X; y = Y; + x = X, y = Y; } inline Vec2(float* v) { - x = v[0]; y = v[1]; + x = v[0], y = v[1]; } inline Vec2(const float* v) { - x = v[0]; y = v[1]; + x = v[0], y = v[1]; } inline Vec2(const Vec2& v) { - x = v.x; y = v.y; + x = v.x, y = v.y; } inline Vec2& operator=(const Vec2& v) { - x = v.x; y = v.y; return *this; + x = v.x, y = v.y; return *this; } inline float& operator[](int i) @@ -90,42 +90,42 @@ public: inline Vec2& operator+=(const Vec2& v) { - x += v.x; y += v.y; return *this; + x += v.x, y += v.y; return *this; } inline Vec2& operator-=(const Vec2& v) { - x -= v.x; y -= v.y; return *this; + x -= v.x, y -= v.y; return *this; } inline Vec2& operator*=(const Vec2& v) { - x *= v.x; y *= v.y; return *this; + x *= v.x, y *= v.y; return *this; } inline Vec2& operator/=(const Vec2& v) { - x /= v.x; y /= v.y; return *this; + x /= v.x, y /= v.y; return *this; } inline Vec2& operator+=(float v) { - x += v; y += v; return *this; + x += v, y += v; return *this; } inline Vec2& operator-=(float v) { - x -= v; y -= v; return *this; + x -= v, y -= v; return *this; } inline Vec2& operator*=(float v) { - x *= v; y *= v; return *this; + x *= v, y *= v; return *this; } inline Vec2& operator/=(float v) { - x /= v; y /= v; return *this; + x /= v, y /= v; return *this; } inline Vec2 operator+(const Vec2& v) const @@ -195,7 +195,12 @@ public: inline void Set(float X = 0.f, float Y = 0.f) { - x = X; y = Y; + x = X, y = Y; + } + + inline void Set(const Vec2& v) + { + x = v.x, y = v.y; } inline Vec2 Pow(float flPower) const @@ -357,32 +362,32 @@ public: inline Vec3(float X = 0.f, float Y = 0.f, float Z = 0.f) { - x = X; y = Y; z = Z; + x = X, y = Y, z = Z; } inline Vec3(float* v) { - x = v[0]; y = v[1]; z = v[2]; + x = v[0], y = v[1], z = v[2]; } inline Vec3(const float* v) { - x = v[0]; y = v[1]; z = v[2]; + x = v[0], y = v[1], z = v[2]; } inline Vec3(const Vec3& v) { - x = v.x; y = v.y; z = v.z; + x = v.x, y = v.y, z = v.z; } inline Vec3(const Vec2& v) { - x = v.x; y = v.y; z = 0.f; + x = v.x, y = v.y, z = 0.f; } inline Vec3& operator=(const Vec3& v) { - x = v.x; y = v.y; z = v.z; return *this; + x = v.x, y = v.y, z = v.z; return *this; } inline float& operator[](int i) @@ -412,42 +417,42 @@ public: inline Vec3& operator+=(const Vec3& v) { - x += v.x; y += v.y; z += v.z; return *this; + x += v.x, y += v.y, z += v.z; return *this; } inline Vec3& operator-=(const Vec3& v) { - x -= v.x; y -= v.y; z -= v.z; return *this; + x -= v.x, y -= v.y, z -= v.z; return *this; } inline Vec3& operator*=(const Vec3& v) { - x *= v.x; y *= v.y; z *= v.z; return *this; + x *= v.x, y *= v.y, z *= v.z; return *this; } inline Vec3& operator/=(const Vec3& v) { - x /= v.x; y /= v.y; z /= v.z; return *this; + x /= v.x, y /= v.y, z /= v.z; return *this; } inline Vec3& operator+=(float v) { - x += v; y += v; z += v; return *this; + x += v, y += v, z += v; return *this; } inline Vec3& operator-=(float v) { - x -= v; y -= v; z -= v; return *this; + x -= v, y -= v, z -= v; return *this; } inline Vec3& operator*=(float v) { - x *= v; y *= v; z *= v; return *this; + x *= v, y *= v, z *= v; return *this; } inline Vec3& operator/=(float v) { - x /= v; y /= v; z /= v; return *this; + x /= v, y /= v, z /= v; return *this; } inline Vec3 operator+(const Vec3& v) const @@ -517,7 +522,22 @@ public: inline void Set(float X = 0.f, float Y = 0.f, float Z = 0.f) { - x = X; y = Y; z = Z; + x = X, y = Y, z = Z; + } + + inline void Set(const Vec3& v) + { + x = v.x, y = v.y, z = v.z; + } + + inline void Set(const Vec2& v) + { + x = v.x, y = v.y; + } + + inline void Set2D(const Vec3& v) + { + x = v.x, y = v.y; } inline Vec3 To2D() const diff --git a/Amalgam/src/SDK/Vars.h b/Amalgam/src/SDK/Vars.h index 3197b04e..71a2485b 100644 --- a/Amalgam/src/SDK/Vars.h +++ b/Amalgam/src/SDK/Vars.h @@ -394,10 +394,14 @@ NAMESPACE_BEGIN(Vars) CVar(SwingPrediction, "Swing prediction", true); CVar(WhipTeam, "Whip team", false); - CVar(SwingOffset, "Swing offset", -1, NOSAVE | DEBUGVAR, -1, 1); + CVar(SwingTicks, "Swing ticks", 13, NOSAVE | DEBUGVAR | SLIDER_MIN, 0, 14); CVar(SwingPredictLag, "Swing predict lag", true, NOSAVE | DEBUGVAR); - CVar(BackstabAccountPing, "Backstab account ping", true, NOSAVE | DEBUGVAR); - CVar(BackstabDoubleTest, "Backstab double test", true, NOSAVE | DEBUGVAR); + CVarEnum(SwingValidateMode, "Swing validate mode", 0, NOSAVE | DEBUGVAR, nullptr, + VA_LIST("Both", "Swing", "Simulated"), + Both, Swing, Simulated); + CVarEnum(BackstabFlags, "Backstab flags", 0b11, NOSAVE | DEBUGVAR | DROPDOWN_MULTI, nullptr, + VA_LIST("Account ping", "Double test"), + AccountPing = 1 << 0, DoubleTest = 1 << 1); NAMESPACE_END(Melee) NAMESPACE_BEGIN(Healing)