From cc9d19dca4b1f9afbf1f0a048168fc20f4ede145 Mon Sep 17 00:00:00 2001 From: rei-2 <174158077+rei-2@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:30:24 -0400 Subject: [PATCH] fix feet yaw/animation issue --- .../Hooks/CClientModeShared_CreateMove.cpp | 22 +++++++++++++++++-- Amalgam/src/Hooks/CPrediction_RunCommand.cpp | 18 --------------- Amalgam/src/SDK/Globals.h | 1 - 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp index b7caf374..6aa372a9 100644 --- a/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp +++ b/Amalgam/src/Hooks/CClientModeShared_CreateMove.cpp @@ -145,11 +145,29 @@ MAKE_HOOK(CClientModeShared_CreateMove, U::Memory.GetVFunc(I::ClientModeShared, } F::Ticks.ManagePacket(pCmd, pSendPacket); F::AntiAim.Run(pLocal, pWeapon, pCmd, *pSendPacket); - G::Choking = !*pSendPacket; if (*pSendPacket) F::FakeAngle.Run(pLocal); - G::ViewAngles = pCmd->viewangles; + if (pLocal) + { + static std::vector vAngles; + vAngles.push_back(pCmd->viewangles); + auto pAnimState = pLocal->GetAnimState(); + if (pAnimState && *pSendPacket) + { + float flOldFrametime = I::GlobalVars->frametime; + I::GlobalVars->frametime = TICK_INTERVAL; + for (auto& vAngle : vAngles) + { + pAnimState->Update(vAngle.y, vAngle.x); + pLocal->FrameAdvance(TICK_INTERVAL); + } + I::GlobalVars->frametime = flOldFrametime; + vAngles.clear(); + } + } + + G::Choking = !*pSendPacket; G::LastUserCmd = pCmd; //const bool bShouldSkip = G::PSilentAngles || G::SilentAngles || G::AntiAim || G::AvoidingBackstab; diff --git a/Amalgam/src/Hooks/CPrediction_RunCommand.cpp b/Amalgam/src/Hooks/CPrediction_RunCommand.cpp index aa360623..ca6a276c 100644 --- a/Amalgam/src/Hooks/CPrediction_RunCommand.cpp +++ b/Amalgam/src/Hooks/CPrediction_RunCommand.cpp @@ -2,28 +2,10 @@ #include "../Features/EnginePrediction/EnginePrediction.h" -static std::vector vAngles; - MAKE_HOOK(CPrediction_RunCommand, U::Memory.GetVFunc(I::Prediction, 17), void, __fastcall, void* rcx, CTFPlayer* pPlayer, CUserCmd* pCmd, IMoveHelper* pMoveHelper) { F::EnginePrediction.ScalePlayers(H::Entities.GetLocal()); CALL_ORIGINAL(rcx, pPlayer, pCmd, pMoveHelper); F::EnginePrediction.RestorePlayers(); - - // credits: KGB - if (pCmd->hasbeenpredicted || G::Recharge) - return; - - auto pAnimState = pPlayer->GetAnimState(); - vAngles.push_back(G::ViewAngles); - if (!pAnimState || G::Choking) - return; - - for (auto& vAngle : vAngles) - { - pAnimState->Update(vAngle.y, vAngle.x); - pPlayer->FrameAdvance(TICK_INTERVAL); - } - vAngles.clear(); } \ No newline at end of file diff --git a/Amalgam/src/SDK/Globals.h b/Amalgam/src/SDK/Globals.h index 0a90cdc5..58ddea60 100644 --- a/Amalgam/src/SDK/Globals.h +++ b/Amalgam/src/SDK/Globals.h @@ -61,7 +61,6 @@ namespace G inline std::pair Target = { 0, 0 }; inline Vec3 AimPosition = {}; - inline Vec3 ViewAngles = {}; inline bool SilentAngles = false; inline bool PSilentAngles = false;