mirror of
https://github.com/rei-2/Amalgam
synced 2026-10-10 04:43:09 +08:00
alter bhop functionality
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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<CTFGrapplingHook>()->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)
|
||||
|
||||
Reference in New Issue
Block a user