Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Resolver.h"
- #include "..\Aimbot\Aimbot.h"
- #include "..\Aimbot\Autowall.h"
- #include "..\Aimbot\LagComp.h"
- #include "..\..\Utils\Utils.h"
- #include "..\..\SDK\ICvar.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"
- 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)
- {
- const auto player_animation_state = pEnt->AnimState();
- if (!player_animation_state)
- return;
- if (Globals::MissedShots[pEnt->EntIndex()] > 2) {
- switch (Globals::MissedShots[pEnt->EntIndex()] % 4) {
- case 0: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 60; break;
- case 1: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 60; break;
- case 2: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 60; break;
- case 3: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 60; break;
- }
- float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
- pEnt->UpdateClientAnimation();
- auto old_curtime = g_pGlobalVars->curtime;
- auto old_frametime = g_pGlobalVars->frametime;
- auto curtime = g_pGlobalVars->curtime;
- auto frametime = g_pGlobalVars->frametime;
- auto frametimne = (g_pGlobalVars->frametime);
- auto absoluteframtime = (g_pGlobalVars->absoluteframetime);
- auto interp_amount = (g_pGlobalVars->interpolationAmount);
- auto framecount = g_pGlobalVars->framecount;
- auto tickcount = g_pGlobalVars->tickcount;
- g_pGlobalVars->realtime = pEnt->GetSimulationTime();
- g_pGlobalVars->curtime = pEnt->GetSimulationTime();
- g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
- g_pGlobalVars->absoluteframetime = g_pGlobalVars->intervalPerTick;
- g_pGlobalVars->framecount = pEnt->GetSimulationTime();
- g_pGlobalVars->tickcount = pEnt->GetSimulationTime();
- g_pGlobalVars->interpolationAmount = 0.0f;
- g_pGlobalVars->curtime = pEnt->GetSimulationTime();
- g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
- player_animation_state->m_iLastClientSideAnimationUpdateFramecount >= pEnt->GetSimulationTime();
- player_animation_state->m_iLastClientSideAnimationUpdateFramecount = pEnt->GetSimulationTime() - 1;
- pEnt->UpdateClientAnimation();
- g_pGlobalVars->curtime = old_curtime;
- g_pGlobalVars->frametime = old_frametime;
- (g_pGlobalVars->realtime) = g_pGlobalVars->realtime;
- (g_pGlobalVars->curtime) = curtime;
- (g_pGlobalVars->frametime) = frametimne;
- (g_pGlobalVars->absoluteframetime) = absoluteframtime;
- g_pGlobalVars->framecount = framecount;
- g_pGlobalVars->tickcount = tickcount;
- }
- }
- float flAngleMod(float flAngle)
- {
- return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
- }
- float ApproachAngle(float target, float value, float speed)
- {
- target = flAngleMod(target);
- value = flAngleMod(value);
- float delta = target - value;
- // Speed is assumed to be positive
- if (speed < 0)
- speed = -speed;
- if (delta < -180)
- delta += 360;
- else if (delta > 180)
- delta -= 360;
- if (delta > speed)
- value += speed;
- else if (delta < -speed)
- value -= speed;
- else
- value = target;
- return value;
- }
- /*
- */
- void update_state(C_AnimState* state, Vector angles) {
- using Fn = void(__vectorcall*)(void*, void*, float, float, float, void*);
- static auto fn = reinterpret_cast<Fn>(Utils::FindSignature("client_panorama.dll", "55 8B EC 83 E4 F8 83 EC 18 56 57 8B F9 F3 0F 11 54 24"));
- fn(state, nullptr, 0.0f, angles[1], angles[0], nullptr);
- }
- // RESOLVER ADDITIONAL
- bool is_slow_walking(C_BaseEntity* entity) {
- float large = 0;
- float velocity_2D[64], old_velocity_2D[64];
- if (entity->GetVelocity().Length2D() != velocity_2D[entity->EntIndex()] && entity->GetVelocity().Length2D() != NULL) {
- old_velocity_2D[entity->EntIndex()] = velocity_2D[entity->EntIndex()];
- velocity_2D[entity->EntIndex()] = entity->GetVelocity().Length2D();
- }
- if (large == 0) return false;
- Vector velocity = entity->GetVelocity();
- Vector direction = entity->GetEyeAngles();
- float speed = velocity.Length();
- direction.y = entity->GetEyeAngles().y - direction.y;
- //method 1
- if (velocity_2D[entity->EntIndex()] > 1) {
- int tick_counter[64];
- if (velocity_2D[entity->EntIndex()] == old_velocity_2D[entity->EntIndex()])
- tick_counter[entity->EntIndex()] += 1;
- else
- tick_counter[entity->EntIndex()] = 0;
- while (tick_counter[entity->EntIndex()] > (1 / g_pGlobalVars->intervalPerTick) * fabsf(0.1f))//should give use 100ms in ticks if their speed stays the same for that long they are definetely up to something..
- return true;
- }
- return false;
- }
- float max_desync_angle(C_BaseEntity* entity) {
- auto animstate = uintptr_t(entity->AnimState());
- float duckammount = *(float*)(animstate + 0xA4);
- float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));
- float speedfactor = max(0, min(1, *reinterpret_cast<float*> (animstate + 0xFC)));
- float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001) - 0.19999999) * speedfraction;
- float unk2 = unk1 + 1.f;
- float unk3;
- if (duckammount > 0)
- unk2 += ((duckammount * speedfactor) * (0.5f - unk2));
- unk3 = *(float*)(animstate + 0x334) * unk2;
- return unk3;
- }
- bool solve_desync_simple(C_BaseEntity* e) // 979
- {
- if (!e || e->IsDormant() || !e->IsAlive())
- return false;
- for (size_t i = 0; i < e->NumOverlays(); i++)
- {
- auto layer = e->GetAnimOverlay4(i);
- if (!layer)
- continue;
- if (e->GetSequenceActivity(layer->m_nSequence) == 979)
- {
- if (layer->m_flWeight == 0.0f && (layer->m_flCycle == 0.0f || layer->m_flCycle != layer->m_flPrevCycle))
- return true;
- }
- }
- return false;
- }
- float NormalizeYaw180(float yaw)
- {
- if (yaw > 180)
- yaw -= (round(yaw / 360) * 360.f);
- else if (yaw < -180)
- yaw += (round(yaw / 360) * -360.f);
- return yaw;
- }
- inline float NormalizePitch(float pitch)
- {
- while (pitch > 89.f)
- pitch -= 180.f;
- while (pitch < -89.f)
- pitch += 180.f;
- return pitch;
- }
- float NormalizeX(float yaw)
- {
- if (yaw != yaw)
- yaw = 0.f;
- return fmod(yaw + 180.f, 360.f) - 180.f;
- }
- float approach(float cur, float target, float inc) {
- inc = abs(inc);
- if (cur < target)
- return min(cur + inc, target);
- if (cur > target)
- return max(cur - inc, target);
- return target;
- }
- bool delta_58(float first, float second)
- {
- if (first - second < 90.f && first - second > -90.f)
- {
- return true;
- }
- return false;
- }
- float angle_difference(float a, float b) {
- auto diff = NormalizeYaw180(a - b);
- if (diff < 180)
- return diff;
- return diff - 360;
- }
- bool delta_35(float first, float second)
- {
- if (first - second <= 27.f && first - second >= -27.f)
- {
- return true;
- }
- return false;
- }
- float approach_angle(float cur, float target, float inc) {
- auto diff = angle_difference(target, cur);
- return approach(cur, cur + diff, inc);
- }
- bool breaking_lby_animations(C_BaseEntity* e)
- {
- if (!e || e->IsDormant() || !e->IsAlive())
- return false;
- for (size_t i = 0; i < e->NumOverlays(); i++)
- {
- auto layer = e->GetAnimOverlay4(i);
- if (e->GetSequenceActivity(layer->m_nSequence) == 979)
- {
- if (layer->m_flCycle != layer->m_flCycle || layer->m_flWeight == 1.f)
- return true;
- }
- }
- return false;
- }
- float get_weighted_desync_delta(C_BaseEntity* player, float abs_angle, bool breaking_lby)
- {
- float delta = player->GetMaxDelta(player->AnimState()) + breaking_lby ? 30.f : 0.f;
- float relative = -abs_angle;
- float positive = abs_angle + delta;
- float negative = abs_angle - delta;
- float positive_delta = abs(g_Math.NormalizeYaw(relative - positive));
- float negative_delta = abs(g_Math.NormalizeYaw(relative - negative));
- return positive_delta > negative_delta ? -delta : delta;
- }
- float __fastcall ang_dif(float a1, float a2)
- {
- float val = fmodf(a1 - a2, 360.0);
- while (val < -180.0f) val += 360.0f;
- while (val > 180.0f) val -= 360.0f;
- return val;
- }
- Vector CalcAngle69(Vector dst, Vector src)
- {
- Vector angles;
- double delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z - dst.z) };
- double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
- angles.x = (float)(atan(delta[2] / hyp) * 180.0 / 3.14159265);
- angles.y = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f);
- angles.z = 0.0f;
- if (delta[0] >= 0.0)
- {
- angles.y += 180.0f;
- }
- return angles;
- }
- void NormalizeNumX(Vector& vIn, Vector& vOut)
- {
- float flLen = vIn.Length();
- if (flLen == 0) {
- vOut.Init(0, 0, 1);
- return;
- }
- flLen = 1 / flLen;
- vOut.Init(vIn.x * flLen, vIn.y * flLen, vIn.z * flLen);
- }
- float GetLBYRotatedYaw(float lby, float yaw)
- {
- float delta = NormalizeYaw180(yaw - lby);
- if (fabs(delta) < 25.f)
- return lby;
- if (delta > 0.f)
- return yaw + 25.f;
- return yaw;
- }
- void VectorAnglesBruteGay(const Vector& forward, Vector& angles)
- {
- float tmp, yaw, pitch;
- if (forward[1] == 0 && forward[0] == 0)
- {
- yaw = 0;
- if (forward[2] > 0) pitch = 270; else pitch = 90;
- }
- else
- {
- yaw = (atan2(forward[1], forward[0]) * 180 / M_PI);
- if (yaw < 0) yaw += 360; tmp = sqrt(forward[0] * forward[0] + forward[1] * forward[1]); pitch = (atan2(-forward[2], tmp) * 180 / M_PI);
- if (pitch < 0) pitch += 360;
- } angles[0] = pitch; angles[1] = yaw; angles[2] = 0;
- }
- void AngleVectors(const Vector& angles, Vector* forward)
- {
- Assert(s_bMathlibInitialized);
- Assert(forward);
- float sp, sy, cp, cy;
- sy = sin(DEG2RAD(angles[1]));
- cy = cos(DEG2RAD(angles[1]));
- sp = sin(DEG2RAD(angles[0]));
- cp = cos(DEG2RAD(angles[0]));
- forward->x = cp * cy;
- forward->y = cp * sy;
- forward->z = -sp;
- }
- // END OF HELPER
- void 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 flMaxYawModifier = player_animation_state->pad10[516] * flMaxYawModifier;
- float flMinYawModifier = player_animation_state->pad10[512] * flMaxYawModifier;
- 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);
- 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) * v49;
- 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
- 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 (pEnt)
- {
- 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 animLayer = pEnt->GetAnimOverlay4(i);
- if (!animLayer)
- continue;
- if (pEnt->GetSequenceActivity(animLayer->m_nSequence) == 979);
- auto 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()] > 2)
- {
- 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 OnetapResolver1(C_BaseEntity* entity)
- {
- if (!c_config::get().resolverchoices[0])
- return;
- if (entity->GetTeam() == Globals::LocalPlayer->GetTeam())
- return;
- // [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
- auto local_player = Globals::LocalPlayer;
- auto animstate = entity->AnimState();
- if (animstate)
- { // inlined max_desync_delta
- //auto v9 = absolute_mask(COERCE_INT(animstate->last_client_side_animation_update_framecount - animstate->last_client_side_animation_update_time));
- float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));
- speedfraction = 0.0;
- if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
- speedfraction = 0.0;
- else
- speedfraction = fminf(DWORD(animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
- float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001) - 0.19999999) * speedfraction;
- float unk2 = unk1 + 1.f;
- float unk3;
- if (animstate->m_fDuckAmount > 0.0)
- {
- int v29 = 0.0;
- if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
- v29 = 0.0;
- else
- v29 = fminf(DWORD(animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
- }
- //GetClientEnt = *(*g_EntityList + 12);// GetLocalPlayer
- //localplayer = GetClientEnt(g_EntityList, loc);
- if (local_player)
- {
- for (int i = 0; i <= 64; ++i)
- {
- auto animation_state = entity->AnimState();
- //player = GetClientEntity(g_EntityList, i);
- if (local_player->IsAlive() && local_player->IsDormant())// dormant
- {
- auto v28 = animation_state->m_flEyeYaw == 0.0 ? -58 : 58;
- if (v28)
- return;
- auto v27 = animation_state->m_flEyeYaw == 0.0 ? -89 : 89;
- if (v27)
- return;
- auto v26 = animation_state->m_flEyeYaw == 0.0 ? -79 : 79;
- if (v26)
- return;
- auto v25 = animation_state->m_flEyeYaw == 0.0 ? -125 : 125;
- if (v25)
- return;
- auto v24 = animation_state->m_flEyeYaw == 0.0 ? -78 : 78;
- if (v24)
- return;
- }
- }
- int v8 = 0;
- int v7 = 0;
- for (int a2a = 0; a2a < 64; ++a2a)
- {
- auto v32 = local_player->GetAnimOverlay4(a2a);
- //if (v32 && a== 979 && *(v32 + 44) != *(v32 + 28))
- // auto v6 = entity->GetLowerBodyYaw();
- auto v20 = BYTE(animstate->speed_2d) * unk2;
- auto a1 = BYTE(animstate->speed_2d) * unk2;
- int 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;
- v30 = eye_angles_y - v11;
- }
- else if (a1 > v22)
- {
- auto v12 = a1;
- v30 = v12 + eye_angles_y;
- }
- auto 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[entity->EntIndex()] > 2)//(global::missedshots > 2)
- {
- switch (Globals::MissedShots[entity->EntIndex()])
- {
- case 3:
- animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
- break;
- case 4:
- animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
- break;
- case 5:
- animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
- break;
- case 6:
- animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
- break;
- //case 7:
- //animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + animstate->m_flCurrentFeetYaw + 25.0;
- //case 8:
- //animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - animstate->m_flCurrentFeetYaw - 25.0;
- default:
- return;
- }
- }
- }
- }
- }
- }
- void onetap(C_BaseEntity* entity)
- {
- if (!c_config::get().aimbot_resolver)
- return;
- if (entity->GetTeam() == Globals::LocalPlayer->GetTeam())
- return;
- auto local_player = Globals::LocalPlayer;
- auto v3 = local_player;
- if (v3 != entity)
- {
- auto animstate = entity->AnimState();
- if (animstate)
- {
- if (animstate->m_fDuckAmount > 0.0)
- {
- auto v29 = 0.0;
- if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
- v29 = 0.0;
- else
- v29 = std::fminf((animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
- }
- if (Globals::MissedShots[entity->EntIndex()] <= 2)
- {
- 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);
- }
- animstate->m_flGoalFeetYaw = (g_Math.NormalizeYaw(ResolvedYaw));
- }
- else
- {
- switch (Globals::MissedShots[entity->EntIndex()] % 4)
- {
- case 0:
- animstate->m_flGoalFeetYaw += 59.0f;
- break;
- case 1:
- animstate->m_flGoalFeetYaw -= 59.0f;
- break;
- case 2:
- animstate->m_flGoalFeetYaw -= 78.0f;
- break;
- case 3:
- animstate->m_flGoalFeetYaw += 78.0f;
- break;
- case 4:
- animstate->m_flGoalFeetYaw -= animstate->m_flGoalFeetYaw ? -180 : 180;
- break;
- case 5:
- animstate->m_flGoalFeetYaw += animstate->m_flGoalFeetYaw ? -180 : 180;
- break;
- default:
- break;
- }
- }
- }
- /*else
- {
- switch (g_ctx.m_globals.missed_shots[entity->EntIndex()] % 3)
- {
- case 0:
- entity->m_angEyeAngles -= animstate->m_flGoalFeetYaw ? -58 : 58;
- break;
- case 1:
- entity->m_angEyeAngles += animstate->m_flGoalFeetYaw ? -58 : 58;
- break;
- case 2:
- entity->m_angEyeAngles -= animstate->m_flGoalFeetYaw ? -89 : 89;
- break;
- case 3:
- entity->m_angEyeAngles += animstate->m_flGoalFeetYaw ? -89 : 89;
- break;
- case 4:
- entity->m_angEyeAngles -= animstate->m_flGoalFeetYaw ? -78 : 78;
- break;
- case 5:
- entity->m_angEyeAngles += animstate->m_flGoalFeetYaw ? -78 : 78;
- break;
- default:
- break;
- }
- }
- */
- }
- }
- bool using_fake_angles[65];
- int missed_shots[65];
- void newResolver(C_BaseEntity* pEnt)
- {
- if (!c_config::get().aimbot_resolver)
- return;
- if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
- return;
- if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
- return;
- auto animstate = pEnt->AnimState();
- const auto player_animation_state = pEnt->AnimState();
- float flMaxYawModifier = player_animation_state->pad10[516] * flMaxYawModifier;
- float flMinYawModifier = player_animation_state->pad10[512] * flMaxYawModifier;
- 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);
- 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) * v49;
- 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
- 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;
- if (pEnt->GetSequence() == 979);// Íå åáó ïî÷åìó êîãäà îí äåëàë ïîä xy0 òóò áûëà îøèáêà, ÿ å¸ èñïðàâèë
- 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()] > 2)
- {
- 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;
- }
- }
- }
- }
- }
- }
- float polak_num_rand(float Min, float Max) // random number
- {
- return ((float(rand()) / float(RAND_MAX)) * (Max - Min)) + Min;
- }
- void PolakResolver(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;
- if (!player_animation_state)
- return;
- float v136 = fmod(newFeetYaw, 360.0);
- float v6 = 0;
- for (size_t i = 0; i < pEnt->GetNumAnimOverlays(); i++) // hi polak i hacked aimware
- {
- auto animLayer = pEnt->GetAnimOverlay4(i);
- if (!animLayer)
- continue;
- if (pEnt->GetSequenceActivity(animLayer->m_nSequence) == 979);
- auto v6 = pEnt->GetLowerBodyYaw();
- }
- int v19 = Globals::MissedShots[pEnt->EntIndex()] % 2; // p2c bruteforce
- switch (v19)
- {
- case 0:
- animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + polak_num_rand(0.0, 45.0);
- break;
- case 1:
- animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - polak_num_rand(0.0, 45.0);
- break;
- default:
- return;
- player_animation_state->m_flGoalFeetYaw = v136;
- }
- }
- void HandleHits(C_BaseEntity* pEnt)
- {
- auto NetChannel = g_pEngine->GetNetChannelInfo();
- 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()])
- {
- Globals::MissedShots[pEnt->EntIndex()] += 1;
- Globals::Shot[pEnt->EntIndex()] = false;
- }
- else if (g_pGlobalVars->curtime <= predTime[pEnt->EntIndex()] && Globals::Hit[pEnt->EntIndex()])
- 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;
- }
- // WE NEED THEM TO CHECK OUR PREVALUES OF RESOLVER
- /*
- NormalizeYaw180;
- solve_desync_simple;
- FlipYaw;
- breaking_lby_animations;
- CalcAngle69;
- NormalizeX;
- max_desync_angle;
- is_slow_walking;
- GetLBYRotatedYaw;
- NormalizePitch;
- */
- // END OF RESOLVER PREVALUES
- 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;
- }
- }
- }
- }
- 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);
- }
- if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
- newResolver(pPlayerEntity);
- // ResolveDesyncBruteforce(pPlayerEntity);
- }
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement