diff --git a/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.cpp b/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.cpp index bd8bdd10..fecef3b6 100644 --- a/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.cpp +++ b/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.cpp @@ -104,15 +104,15 @@ void CAntiCheatCompatibility::RespondCvarValue(INetMessage& msg) SDK::Output("Convar spoof", std::format("{}: {} ({})", pMsg->m_szCvarName, pMsg->m_szCvarValue, msg.ToString()).c_str(), Vars::Menu::Theme::Accent.Value, Vars::Debug::Logging.Value); } -void CAntiCheatCompatibility::BunnyHop(CUserCmd* pCmd, bool bCurGrounded, bool bLastGrounded) +void CAntiCheatCompatibility::BunnyHop(CUserCmd* pCmd, bool bCurrValid, bool bLastValid) { if (!Active()) return; // prevent more than 9 bhops occurring. if a server has this under that threshold they're retarded anyways - if (bCurGrounded) + if (bCurrValid) { - if (!bLastGrounded && pCmd->buttons & IN_JUMP) + if (!bLastValid && pCmd->buttons & IN_JUMP && !(G::LastUserCmd->buttons & IN_JUMP)) m_iJumps++; else m_iJumps = 0; diff --git a/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.h b/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.h index dd8ed273..8c2d5311 100644 --- a/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.h +++ b/Amalgam/src/Features/AntiCheatCompatibility/AntiCheatCompatibility.h @@ -24,7 +24,7 @@ private: public: void CreateMove(CUserCmd* pCmd, bool* pSendPacket); - void BunnyHop(CUserCmd* pCmd, bool bCurGrounded, bool bLastGrounded); + void BunnyHop(CUserCmd* pCmd, bool bCurrValid, bool bLastValid); void RespondCvarValue(INetMessage& msg); inline bool Active() { return Vars::Misc::Game::AntiCheatCompatibility.Value; } diff --git a/Amalgam/src/Features/Misc/Misc.cpp b/Amalgam/src/Features/Misc/Misc.cpp index ace72360..287f6f73 100644 --- a/Amalgam/src/Features/Misc/Misc.cpp +++ b/Amalgam/src/Features/Misc/Misc.cpp @@ -57,20 +57,16 @@ void CMisc::AutoJump(CTFPlayer* pLocal, CUserCmd* pCmd) if (auto pWeapon = H::Entities.GetWeapon(); pWeapon && pWeapon->GetWeaponID() == TF_WEAPON_GRAPPLINGHOOK && pWeapon->As()->m_hProjectile()) return; - static bool bStaticJump = false, bStaticGrounded = false, bLastAttempted = false; - const bool bLastJump = bStaticJump, bLastGrounded = bStaticGrounded; - const bool bCurJump = bStaticJump = pCmd->buttons & IN_JUMP, bCurGrounded = bStaticGrounded = pLocal->m_hGroundEntity(); + static bool bStaticAttempted = false, bStaticValid = false; + const bool bLastAttempted = bStaticAttempted, bLastValid = bStaticValid; + const bool bCurrAttempted = bStaticAttempted = G::OriginalCmd.buttons & IN_JUMP, bCurrValid = bStaticValid = pLocal->m_hGroundEntity() && !pLocal->IsDucking(); + const bool bManual = !(SDK::AttribHookValue(0, "parachute_attribute", pLocal) && !pLocal->InCond(TF_COND_PARACHUTE_ACTIVE) && !(G::OriginalCmd.buttons & IN_DUCK)); // evil we don't want to manual - if (bCurJump && bLastJump && (bCurGrounded ? !pLocal->IsDucking() : true)) - { - if (!(bCurGrounded && !bLastGrounded)) - pCmd->buttons &= ~IN_JUMP; - - if (!(pCmd->buttons & IN_JUMP) && bCurGrounded && !bLastAttempted) - pCmd->buttons |= IN_JUMP; - } - F::AntiCheatCompatibility.BunnyHop(pCmd, bCurGrounded, bLastGrounded); - bLastAttempted = pCmd->buttons & IN_JUMP; + if (!bCurrValid || bCurrValid && G::LastUserCmd->buttons & IN_JUMP) + pCmd->buttons &= ~IN_JUMP; + if (bCurrAttempted && !bLastAttempted && bManual) + pCmd->buttons |= IN_JUMP; + F::AntiCheatCompatibility.BunnyHop(pCmd, bCurrValid, bLastValid); } void CMisc::AutoJumpbug(CTFPlayer* pLocal, CUserCmd* pCmd)