Модератор форума
-
Автор темы
- #1
C++:
#include "Resolver.h"
#include "..\Aimbot\Aimbot.h"
#include "..\Aimbot\Autowall.h"
#include "..\Aimbot\LagComp.h"
#include "..\..\Utils\Utils.h"
#include "..\..\SDK\IVEngineClient.h"
#include "..\..\SDK\Hitboxes.h"
#include "..\..\SDK\PlayerInfo.h"
#include "..\..\Utils\Math.h"
#include "..\..\Menu\Menu.h""
#include "..\..\Menu\config.h"
#include "..\..\SDK\CEntity.h"
#include "..\Visuals\EventLogging.h"
#include <array>
Resolver g_Resolver;
/*
my attempt at fixing desync and i was pretty successful
it can resolve static desync pretty perfectly
and can resolve some jitter desync but
it still gets rekt by other things
*/
void Resolver::AnimationFix(C_BaseEntity* pEnt)
{
//who needs structs or classes not me lol
static float oldSimtime[65];
static float storedSimtime[65];
static float ShotTime[65];
static float SideTime[65][3];
static int LastDesyncSide[65];
static bool Delaying[65];
static AnimationLayer StoredLayers[64][15];
static C_AnimState* StoredAnimState[65];
static float StoredPosParams[65][24];
static Vector oldEyeAngles[65];
static float oldGoalfeetYaw[65];
float* PosParams = (float*)((uintptr_t)pEnt + 0x2774);
bool update = false;
bool shot = false;
static bool jittering[65];
auto* AnimState = pEnt->AnimState();
if (!AnimState || !pEnt->AnimOverlays() || !PosParams)
return;
auto RemapVal = [](float val, float A, float B, float C, float D) -> float
{
if (A == B)
return val >= B ? D : C;
return C + (D - C) * (val - A) / (B - A);
};
if (storedSimtime[pEnt->EntIndex()] != pEnt->GetSimulationTime())
{
jittering[pEnt->EntIndex()] = false;
pEnt->ClientAnimations(true);
pEnt->UpdateClientAnimation();
memcpy(StoredPosParams[pEnt->EntIndex()], PosParams, sizeof(float) * 24);
memcpy(StoredLayers[pEnt->EntIndex()], pEnt->AnimOverlays(), (sizeof(AnimationLayer) * pEnt->NumOverlays()));
oldGoalfeetYaw[pEnt->EntIndex()] = AnimState->m_flGoalFeetYaw;
if (pEnt->GetActiveWeapon() && !pEnt->IsKnifeorNade())
{
if (ShotTime[pEnt->EntIndex()] != pEnt->GetActiveWeapon()->GetLastShotTime())
{
shot = true;
ShotTime[pEnt->EntIndex()] = pEnt->GetActiveWeapon()->GetLastShotTime();
}
else
shot = false;
}
else
{
shot = false;
ShotTime[pEnt->EntIndex()] = 0.f;
}
float angToLocal = g_Math.NormalizeYaw(g_Math.CalcAngle(Globals::LocalPlayer->GetOrigin(), pEnt->GetOrigin()).y);
float Back = g_Math.NormalizeYaw(angToLocal);
float DesyncFix = 0;
float Resim = g_Math.NormalizeYaw((0.24f / (pEnt->GetSimulationTime() - oldSimtime[pEnt->EntIndex()])) * (oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));
if (Resim > 58.f)
Resim = 58.f;
if (Resim < -58.f)
Resim = -58.f;
if (Resim > 89.f)
Resim = 89.f;
if (Resim < -89.f)
Resim = -89.f;
if (pEnt->GetVelocity().Length2D() > 0.5f && !shot)
{
float Delta = g_Math.NormalizeYaw(g_Math.NormalizeYaw(g_Math.CalcAngle(Vector(0, 0, 0), pEnt->GetVelocity()).y) - g_Math.NormalizeYaw(g_Math.NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim));
int CurrentSide = 0;
if (Delta < 0)
{
CurrentSide = 1;
SideTime[pEnt->EntIndex()][1] = g_pGlobalVars->curtime;
}
else if (Delta > 0)
{
CurrentSide = 2;
SideTime[pEnt->EntIndex()][2] = g_pGlobalVars->curtime;
}
if (LastDesyncSide[pEnt->EntIndex()] == 1)
{
Resim += (58.f - Resim);
DesyncFix += (58.f - Resim);
Resim += (89.f - Resim);
DesyncFix += (89.f - Resim);
}
if (LastDesyncSide[pEnt->EntIndex()] == 2)
{
Resim += (-58.f - Resim);
DesyncFix += (-58.f - Resim);
Resim += (89.f - Resim);
DesyncFix += (89.f - Resim);
}
if (LastDesyncSide[pEnt->EntIndex()] != CurrentSide)
{
Delaying[pEnt->EntIndex()] = true;
if (.5f < (g_pGlobalVars->curtime - SideTime[pEnt->EntIndex()][LastDesyncSide[pEnt->EntIndex()]]))
{
LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
Delaying[pEnt->EntIndex()] = false;
}
}
if (!Delaying[pEnt->EntIndex()])
LastDesyncSide[pEnt->EntIndex()] = CurrentSide;
}
else if (!shot)
{
float Brute = UseFreestandAngle[pEnt->EntIndex()] ? g_Math.NormalizeYaw(Back + FreestandAngle[pEnt->EntIndex()]) : pEnt->GetLowerBodyYaw();
float Delta = g_Math.NormalizeYaw(g_Math.NormalizeYaw(Brute - g_Math.NormalizeYaw(g_Math.NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60))) + Resim));
if (Delta > 58.f)
Delta = 58.f;
if (Delta < -58.f)
Delta = -58.f;
if (Delta > 89.f)
Delta = 89.f;
if (Delta < -89.f)
Delta = -89.f;
Resim += Delta;
DesyncFix += Delta;
if (Resim > 58.f)
Resim = 58.f;
if (Resim < -58.f)
Resim = -58.f;
if (Resim > 89.f)
Resim = 89.f;
if (Resim < -89.f)
Resim = -89.f;
}
float Equalized = g_Math.NormalizeYaw(g_Math.NormalizeYaw(AnimState->m_flGoalFeetYaw + RemapVal(PosParams[11], 0, 1, -60, 60)) + Resim);
float JitterDelta = fabs(g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));
if (JitterDelta >= 70.f && !shot)
jittering[pEnt->EntIndex()] = true;
if (pEnt != Globals::LocalPlayer && pEnt->GetTeam() != Globals::LocalPlayer->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && g_Menu.Config.Resolver)
{
if (jittering[pEnt->EntIndex()])
AnimState->m_flGoalFeetYaw = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y + DesyncFix);
else
AnimState->m_flGoalFeetYaw = Equalized;
pEnt->SetLowerBodyYaw(AnimState->m_flGoalFeetYaw);
}
StoredAnimState[pEnt->EntIndex()] = AnimState;
oldEyeAngles[pEnt->EntIndex()] = pEnt->GetEyeAngles();
oldSimtime[pEnt->EntIndex()] = storedSimtime[pEnt->EntIndex()];
storedSimtime[pEnt->EntIndex()] = pEnt->GetSimulationTime();
update = true;
}
pEnt->ClientAnimations(false);
if (pEnt != Globals::LocalPlayer && pEnt->GetTeam() != Globals::LocalPlayer->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && g_Menu.Config.Resolver)
pEnt->SetLowerBodyYaw(AnimState->m_flGoalFeetYaw);
AnimState = StoredAnimState[pEnt->EntIndex()];
memcpy((void*)PosParams, &StoredPosParams[pEnt->EntIndex()], (sizeof(float) * 24));
memcpy(pEnt->AnimOverlays(), StoredLayers[pEnt->EntIndex()], (sizeof(AnimationLayer) * pEnt->NumOverlays()));
if (pEnt != Globals::LocalPlayer && pEnt->GetTeam() != Globals::LocalPlayer->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND) && g_Menu.Config.Resolver && jittering[pEnt->EntIndex()])
pEnt->SetAbsAngles(Vector(0, pEnt->GetEyeAngles().y, 0));
else
pEnt->SetAbsAngles(Vector(0, oldGoalfeetYaw[pEnt->EntIndex()], 0));
*reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA30) = g_pGlobalVars->framecount;
*reinterpret_cast<int*>(uintptr_t(pEnt) + 0xA28) = 0;
}
void Resolver::CreateAnimationState(C_AnimState* state)
{
using CreateAnimState_t = void(__thiscall*)(C_AnimState*, C_BaseEntity*);
static auto CreateAnimState = (CreateAnimState_t)Utils::FindSignature("client.dll", "55 8B EC 56 8B F1 B9 ? ? ? ? C7 46");
if (!CreateAnimState)
return;
CreateAnimState(state, Globals::LocalPlayer);
}
void update_Fake_state(C_AnimState* state, Vector ang) {
using fn = void(__vectorcall*)(void*, void*, float, float, float, void*);
static auto ret = reinterpret_cast<fn>(Utils::FindSignature("client.dll", "55 8B EC 83 E4 F8 83 EC 18 56 57 8B F9 F3 0F 11 54 24"));
if (!ret)
return;
ret(state, NULL, NULL, ang.y, ang.x, NULL);
}
void Resolver::manage_fake_state()
{
if (!Globals::LocalPlayer || !Globals::LocalPlayer->IsAlive())
return;
if (!c_config::get().desync_chams)
return;
if (m_fake_spawntime != Globals::LocalPlayer->m_flSpawnTime() || m_should_update_fake)
{
init_fake_anim = false;
m_fake_spawntime = Globals::LocalPlayer->m_flSpawnTime();
m_should_update_fake = false;
}
if (!init_fake_anim)
{
m_fake_state = static_cast<C_AnimState*> (g_pMemalloc->Alloc(sizeof(C_AnimState)));
if (m_fake_state != nullptr)
CreateAnimationState(m_fake_state);
init_fake_anim = true;
}
float frametime = g_pGlobalVars->frametime;
if (Globals::bSendPacket)
{
std::array<AnimationLayer, 13> networked_layers;
std::memcpy(&networked_layers, Globals::LocalPlayer->AnimOverlays(), sizeof(AnimationLayer) * 13);
auto backup_abs_angles = Globals::LocalPlayer->GetAbsAngles();
auto backup_poses = Globals::LocalPlayer->m_flPoseParameter2();
if (Globals::LocalPlayer->GetFlags2() & FL_ONGROUND)
Globals::LocalPlayer->GetFlags2() |= FL_ONGROUND;
else
{
if (Globals::LocalPlayer->AnimOverlays()[4].m_flWeight != 1.f && Globals::LocalPlayer->AnimOverlays()[5].m_flWeight != 0.f)
Globals::LocalPlayer->GetFlags2() |= FL_ONGROUND;
if (Globals::LocalPlayer->GetFlags2() & FL_ONGROUND)
Globals::LocalPlayer->GetFlags2() &= ~FL_ONGROUND;
}
*reinterpret_cast<int*>(Globals::LocalPlayer + 0xA68) = g_pGlobalVars->frametime;
g_pGlobalVars->frametime = 23.91753135f; // :^)
update_Fake_state(m_fake_state, Globals::pCmd->viewangles);
Globals::should_setup_local_bones = true;
m_got_fake_matrix = Globals::LocalPlayer->SetupBones(Globals::fakematrix, 128, 524032 - 66666/*g_Menu.Config.nightmodeval*/, false);
const auto org_tmp = Globals::LocalPlayer->GetRenderOrigin();
if (m_got_fake_matrix)
{
for (auto& i : Globals::fakematrix)
{
i[0][3] -= org_tmp.x;
i[1][3] -= org_tmp.y;
i[2][3] -= org_tmp.z;
}
}
std::memcpy(Globals::LocalPlayer->AnimOverlays(), &networked_layers, sizeof(AnimationLayer) * 13);
Globals::LocalPlayer->m_flPoseParameter2() = backup_poses;
Globals::LocalPlayer->GetAbsAngles() = backup_abs_angles;
}
g_pGlobalVars->frametime = frametime;
}
void FixPitch(C_BaseEntity* pEnt)
{
float last_simtime[64] = { 0.f };
float stored_pitch_1[64] = { 0.f };
float fixed_pitch[64] = { 0.f };
bool has_been_set[64] = { false };
const auto local = Globals::LocalPlayer;
if (!local)
return;
if (!c_config::get().pitchresolver) return;
for (auto i = 0; i < g_pEngine->GetMaxClients(); ++i)
{
const auto eye = pEnt->GetEyeAnglesPointer();
auto pitch = 0.f;
if (stored_pitch_1[i] == FLT_MAX || !has_been_set[i])
{
stored_pitch_1[i] = eye->x;
has_been_set[i] = true;
}
if (stored_pitch_1[i] - eye->x < 30 && stored_pitch_1[i] - eye->x > -30)
{
pitch = eye->x;
}
else
{
pitch = stored_pitch_1[i];
}
pEnt->GetEyeAnglesPointer()->x = pitch;
}
}
bool IsBoneVisible(C_BaseEntity* Target, int Bone)
{
Vector vEnd;
vEnd = Target->GetBonePosition(Bone);
C_Trace Trace;
C_TraceFilter Filter(Target);
Filter.pSkip1 = Globals::LocalPlayer;
g_pTrace->TraceRay(C_Ray(Globals::LocalPlayer->GetEyePosition(), vEnd), mask_shot, &Filter, &Trace);
if (Trace.m_pEnt && Trace.m_pEnt->GetTeam() != Globals::LocalPlayer->GetTeam() && !(Trace.m_pEnt->GetHealth() <= 0) && !(Trace.m_pEnt->IsDormant()))
{
if (Trace.physicsBone <= 128 && Trace.physicsBone > 0)
{
return true;
}
}
return false;
}
bool IsPlayerVisible(C_BaseEntity* target)
{
for (int i = 0; i < 128; i++)
{
if (IsBoneVisible(target, i))
{
return true;
}
}
return false;
}
void HandleHits(C_BaseEntity* pEnt)
{
auto NetChannel = g_pEngine->GetNetChannelInfo();
std::stringstream ss;
std::string info;
if (!NetChannel)
return;
static float predTime[65];
static bool init[65];
if (Globals::Shot[pEnt->EntIndex()])
{
if (init[pEnt->EntIndex()])
{
g_Resolver.pitchHit[pEnt->EntIndex()] = pEnt->GetEyeAngles().x;
predTime[pEnt->EntIndex()] = g_pGlobalVars->curtime + NetChannel->GetAvgLatency(FLOW_INCOMING) + NetChannel->GetAvgLatency(FLOW_OUTGOING) + TICKS_TO_TIME(1) + TICKS_TO_TIME(g_pEngine->GetNetChannel()->m_nChokedPackets);
init[pEnt->EntIndex()] = false;
}
if (g_pGlobalVars->curtime > predTime[pEnt->EntIndex()] && !Globals::Hit[pEnt->EntIndex()])
{
if (c_config::get().event_logger[3])
{
if (Globals::LocalPlayer->GetVelocity().Length() >= 52) {
if (Globals::LocalPlayer->IsAlive()) {
ss << "{spag.bol V2} " << "Missed Shot | Reason: " << "Spread Innacuracy" << " | Speed: " << Globals::LocalPlayer->GetVelocity().Length2D() << " | Weapon: " << Globals::LocalPlayer->GetActiveWeapon()->GetName();
}
else {
ss << "{spag.bol V2} " << "Missed Shot | Reason: " << "Spread Innacuracy";
}
}
else {
if (Globals::LocalPlayer->IsAlive()) {
ss << "{spag.bol V2} " << "Missed Shot | Reason: " << "Incorrect Resolve" << " | Speed: " << Globals::LocalPlayer->GetVelocity().Length2D() << " | Weapon: " << Globals::LocalPlayer->GetActiveWeapon()->GetName();
}
else {
ss << "{spag.bol V2} " << "Missed Shot | Reason: " << "Incorrect Resolve";
}
}
c_event_logs::get().add(ss.str(), Color(255, 255, 255, 255));
info += "echo ";
info += ss.str();
g_pEngine->ExecuteClientCmd(info.c_str());
}
Globals::MissedShots[pEnt->EntIndex()] += 1;
Globals::Shot[pEnt->EntIndex()] = false;
}
else if (g_pGlobalVars->curtime <= predTime[pEnt->EntIndex()] && Globals::Hit[pEnt->EntIndex()])
{
if (c_config::get().event_logger[3]) {
if (Globals::LocalPlayer->IsAlive()) {
ss << "{spag.bol V2} " << "Hit Shot | Reason: " << "Correct Resolve" << " | Speed: " << Globals::LocalPlayer->GetVelocity().Length2D() << " | Weapon: " << Globals::LocalPlayer->GetActiveWeapon()->GetName();
}
else {
ss << "{spag.bol V2} " << "Hit Shot | Reason: " << "Correct Resolve";
}
}
c_event_logs::get().add(ss.str(), Color(255, 255, 255, 255));
info += "echo ";
info += ss.str();
g_pEngine->ExecuteClientCmd(info.c_str());
Globals::Shot[pEnt->EntIndex()] = false;
}
}
else
init[pEnt->EntIndex()] = true;
Globals::Hit[pEnt->EntIndex()] = false;
}
void Resolver::OnCreateMove() // cancer v2
{
if (!c_config::get().aimbot_resolver)
return;
if (!Globals::LocalPlayer->IsAlive())
return;
if (!Globals::LocalPlayer->GetActiveWeapon() || Globals::LocalPlayer->IsKnifeorNade())
return;
for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
{
C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
if (!pPlayerEntity
|| !pPlayerEntity->IsAlive()
|| pPlayerEntity->IsDormant()
|| pPlayerEntity == Globals::LocalPlayer
|| pPlayerEntity->GetTeam() == Globals::LocalPlayer->GetTeam())
{
UseFreestandAngle[i] = false;
continue;
}
if (abs(pPlayerEntity->GetVelocity().Length2D()) > 29.f)
UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
if (abs(pPlayerEntity->GetVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
{
bool Autowalled = false, HitSide1 = false, HitSide2 = false;
float angToLocal = g_Math.CalcAngle(Globals::LocalPlayer->GetOrigin(), pPlayerEntity->GetOrigin()).y;
Vector ViewPoint = Globals::LocalPlayer->GetOrigin() + Vector(0, 0, 90);
Vector2D Side1 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal))),(45 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
Vector2D Side2 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
Vector2D Side3 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal))),(50 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
Vector2D Side4 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
Vector Origin = pPlayerEntity->GetOrigin();
Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
for (int side = 0; side < 2; side++)
{
Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
if (g_Autowall.CanHitFloatingPoint(OriginAutowall, ViewPoint))
{
if (side == 0)
{
HitSide1 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = 90;
}
else if (side == 1)
{
HitSide2 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = -90;
}
Autowalled = true;
}
else
{
for (int side222 = 0; side222 < 2; side222++)
{
Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };
if (g_Autowall.CanHitFloatingPoint(OriginAutowall222, OriginAutowall2))
{
if (side222 == 0)
{
HitSide1 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = 90;
}
else if (side222 == 1)
{
HitSide2 = true;
FreestandAngle[pPlayerEntity->EntIndex()] = -90;
}
Autowalled = true;
}
}
}
}
if (Autowalled)
{
if (HitSide1 && HitSide2)
UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
else
UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
}
}
}
}
float AngleNormalize(float angle)
{
angle = fmodf(angle, 360.0f);
if (angle > 180)
{
angle -= 360;
}
if (angle < -180)
{
angle += 360;
}
return angle;
}
void Resolver::HandleBackUpResolve(C_BaseEntity* pEnt) {
if (!c_config::get().aimbot_resolver)
return;
if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
return;
auto animstate = pEnt->AnimState();
const auto player_animation_state = pEnt->AnimState();
float newFeetYaw = 1.f;
auto eyeYaw = player_animation_state->m_flEyeYaw;
auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
float eye_feet_delta = fabs(eyeYaw - lbyYaw);
float flMaxYawModifier = player_animation_state->pad10[516] * eyeYaw;
float flMinYawModifier = player_animation_state->pad10[512] * eyeYaw;
if (!player_animation_state)
return;
float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
auto v28 = 0.f;
if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
{
v28 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 0.0f);
}
else
{
v28 = 0x3F800000;
}
float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * flMaxYawModifier;
float flYawModifier = v49 + 1.0;
if (player_animation_state->m_fDuckAmount > 0.0)
{
float v53 = 0.0f;
if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
{
v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
}
else
{
v53 = 0.0f;
}
}
if (eye_feet_delta <= flMaxYawModifier)
{
if (flMinYawModifier > eye_feet_delta)
{
newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
}
}
else
{
newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
}
float v136 = fmod(newFeetYaw, 360.0);
if (v136 > 180.0)
{
v136 = v136 - 360.0;
}
if (v136 < 180.0)
{
v136 = v136 + 360.0;
}
v28 = v49++;
{ // inlined max_desync_delta //Didnt need this a second time but it was being gay
float v9 = fabs(animstate->m_iLastClientSideAnimationUpdateFramecount - animstate->m_flLastClientSideAnimationUpdateTime);
float speedfraction = 0.0;
if (animstate->m_flFeetSpeedForwardsOrSideWays < 0.0)
speedfraction = 0.0;
else
speedfraction = animstate->m_flFeetSpeedForwardsOrSideWays;
float v2 = (animstate->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
float v18 = v2;
float v3 = v2 + 1.0;
float v23 = v3;
if (animstate->m_fDuckAmount > 0.0)
{
float v29 = 0.0;
if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
v29 = 0.0;
else
v29 = fminf((animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
}
if (Globals::LocalPlayer)
{
for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
{
if (pEnt)// dormant
{
float v28 = pEnt->GetEyeAngles().y == 0.0 ? -58 : 58;
if (v28)
return;
float v27 = pEnt->GetEyeAngles().y == 0.0 ? -89 : 89;
if (v27)
return;
float v26 = pEnt->GetEyeAngles().y == 0.0 ? -79 : 79;
if (v26)
return;
float v25 = pEnt->GetEyeAngles().y == 0.0 ? -125 : 125;
if (v25)
return;
float v24 = pEnt->GetEyeAngles().y == 0.0 ? -78 : 78;
if (v24)
return;
}
float v8 = 0;
float v7 = 0;
float v6 = 0;
for (size_t i = 0; i < pEnt->GetNumAnimOverlays(); i++)
{
auto layer = pEnt->GetNumAnimOverlays();
if (!layer)
continue;
v6 = pEnt->GetLowerBodyYaw();
}
float v20 = (animstate->m_vVelocityX) * v23;
float a1 = (animstate->m_vVelocityY) * v23;
float v30 = 0.0;
float eye_angles_y = animstate->m_flEyeYaw;
float goal_feet_yaw = animstate->m_flGoalFeetYaw;
float v22 = fabs(eye_angles_y - goal_feet_yaw);
if (v20 < v22)
{
float v11 = fabs(v20);
v30 = eye_angles_y - v11;
}
else if (a1 > v22)
{
float v12 = fabs(a1);
v30 = v12 + eye_angles_y;
}
float v36 = std::fmodf((v30), 360.0);
if (v36 > 180.0)
v36 = v36 - 360.0;
if (v36 < 180.0)
v36 = v36 + 360.0;
animstate->m_flGoalFeetYaw = v36;
if (Globals::MissedShots[pEnt->EntIndex()] > 1) //if this comes with warning just ingore
{
int v19 = Globals::MissedShots[pEnt->EntIndex()] % 4;
switch (v19)
{
case 0:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
break;
case 1:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
break;
case 2:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
break;
case 3:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
break;
default:
return;
player_animation_state->m_flGoalFeetYaw = v136;
}
}
}
}
}
}
void bruhResolver(C_BaseEntity* ent)
{
if (!Globals::LocalPlayer->IsAlive())
return;
if (!c_config::get().resolvertype == 0)
return;
auto animstate = ent->AnimState();
auto v9 = (animstate->m_iLastClientSideAnimationUpdateFramecount - animstate->m_flLastClientSideAnimationUpdateTime);
auto speedfraction = 0.0f;
if (animstate->m_flFeetSpeedForwardsOrSideWays < 0.0f)
speedfraction = 0.0f;
else
speedfraction = fminf(animstate->m_flFeetSpeedForwardsOrSideWays, 0x3F800000);
auto v2 = (animstate->pad_0x0120() * -0.30000001 - 0.19999999) * speedfraction;
auto v18 = v2;
auto v3 = v2 + 1.0;
auto v23 = v3;
if (animstate->m_fDuckAmount > 0.0)
{
auto v29 = 0.0;
if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
v29 = 0.0;
else
v29 = fminf(animstate->m_flFeetSpeedUnknownForwardOrSideways, 0x3F800000);
}
auto localplayer_index = Globals::LocalPlayer->EntIndex();
auto localplayer = Globals::LocalPlayer;
if (localplayer)
{
auto fix_goal_feet_yaw = [](float rotation, float invertedrotation, float yawfeetdelta, float yaw, C_AnimState* state) // some shit i found on pastebin lol
{
if (yawfeetdelta < rotation)
{
if (invertedrotation > yawfeetdelta)
*(float*)(uintptr_t(state) + 0x80) = invertedrotation + yaw;
}
else
*(float*)(uintptr_t(state) + 0x80) = yaw - rotation;
};
auto get_rotation = [&](int rotation_type, C_AnimState* state) {
float v43 = *(float*)((uintptr_t)state + 0xA4);
float v54 = max(0, min(*reinterpret_cast<float*>((uintptr_t)state + 0xF8), 1));
float v55 = max(0, min(1, *reinterpret_cast<float*>((uintptr_t)state + 0xFC)));
float v56;
v56 = ((*reinterpret_cast<float*>((uintptr_t)state + 0x11C) * -0.30000001) - 0.19999999)* v54;
if (v43 > 0)
v56 += ((v43 * v55) * (0.5 - v56));
v56 = *(float*)((uintptr_t)state + rotation_type) * v56;
return v56;
};
float inverted = get_rotation(0x2B4, ent->AnimState());
float max = get_rotation(0x2B0, ent->AnimState());
float yawfeetdelta = ent->AnimState()->m_flEyeYaw - ent->AnimState()->m_flGoalFeetYaw;
float yaw = ent->GetEyeAngles().y;
if (c_config::get().fixfeet)
fix_goal_feet_yaw(max, inverted, yawfeetdelta, yaw, ent->AnimState());
float speed;
if (*(float*)(animstate + 0xF8) < 0.f)
{
speed = 0.0;
}
else
{
speed = fminf(*(DWORD*)(animstate + 0xF8), 1.0f);
}
float flYawModifier = (*(float*)(animstate + 0x11C) * -0.30000001 - 0.19999999) * speed;
flYawModifier += 1.0f;
if (*(float*)(animstate + 0xA4) > 0.0 && *(float*)(animstate + 0xFC) >= 0.0)
flYawModifier = fminf(*(float*)(uintptr_t(animstate) + 0xFC), 1.0f);
float m_flMaxBodyYaw = *(float*)(uintptr_t(animstate) + 0x334) * flYawModifier;
float m_flMinBodyYaw = *(float*)(uintptr_t(animstate) + 0x330) * flYawModifier;
float ResolvedYaw = animstate->m_flEyeYaw;
float delta = std::abs(animstate->m_flEyeYaw - animstate->m_flGoalFeetYaw);
if (m_flMaxBodyYaw < delta)
{
ResolvedYaw = animstate->m_flEyeYaw - std::abs(m_flMaxBodyYaw);
}
else if (m_flMinBodyYaw > delta)
{
ResolvedYaw = animstate->m_flEyeYaw + std::abs(m_flMinBodyYaw);
}
auto player = ent;
auto v8 = 0;
auto v7 = 0;
for (int a2a = 0; a2a < Globals::LocalPlayer->GetNumAnimOverlays(); ++a2a)
{
auto v32 = Globals::LocalPlayer->GetAnimOverlay4(a2a);
if (v32)
auto v6 = Globals::LocalPlayer;
}
auto v20 = animstate->flUpVelocity * v23;
auto a1 = animstate->m_vVelocityY * v23;
auto v30 = 0.0;
auto eye_angles_y = animstate->m_flEyeYaw;
auto goal_feet_yaw = animstate->m_flGoalFeetYaw;
auto v22 = (eye_angles_y - goal_feet_yaw);
if (v20 < v22)
{
auto v11 = v20;
auto v30 = eye_angles_y - v11;
}
else if (a1 > v22)
{
auto v12 = a1;
auto v30 = v12 + eye_angles_y;
}
float v36 = std::fmodf(v30, 360.0f);
if (v36 > 180.0f)
v36 = v36 - 360.0f;
if (v36 < 180.0f)
v36 = v36 + 360.0f;
float inverse = 0 - v36;
switch (Globals::MissedShot % 1)
{
case 0:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 53.0;
break;
case 1:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 53.0;
break;
case 2:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
break;
case 3:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
break;
case 4:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
break;
case 5:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
break;
case 6:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 86.0;
break;
case 7:
animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 86.0;
break;
}
switch (Globals::MissedShot % 1)
{
case 0:
ent->SetAbsAngles(Vector(0, v36, 0));
break;
case 1:
ent->SetAbsAngles(Vector(0, inverse, 0));
break;
case 2:
ent->SetAbsAngles(Vector(0, AngleNormalize(ResolvedYaw), 0));
break;
}
}
}
void Resolver::FrameStage(ClientFrameStage_t stage)
{
if (!Globals::LocalPlayer || !g_pEngine->IsInGame())
return;
static bool wasDormant[65];
for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
{
C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
if (!pPlayerEntity
|| !pPlayerEntity->IsAlive())
continue;
if (pPlayerEntity->IsDormant())
{
wasDormant[i] = true;
continue;
}
if (stage == FRAME_RENDER_START)
{
HandleHits(pPlayerEntity);
AnimationFix(pPlayerEntity);
HandleBackUpResolve(pPlayerEntity);
bruhResolver(pPlayerEntity);
FixPitch(pPlayerEntity);
}
if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
}
if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != Globals::LocalPlayer)
{
auto VarMap = reinterpret_cast<uintptr_t>(pPlayerEntity) + 36;
auto VarMapSize = *reinterpret_cast<int*>(VarMap + 20);
for (auto index = 0; index < VarMapSize; index++)
*reinterpret_cast<uintptr_t*>(*reinterpret_cast<uintptr_t*>(VarMap) + index * 12) = 0;
}
wasDormant[i] = false;
}
}