SHARE
TWEET

Untitled

a guest Dec 5th, 2019 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Resolver.h"
  2. #include "..\Aimbot\Aimbot.h"
  3. #include "..\Aimbot\Autowall.h"
  4. #include "..\Aimbot\LagComp.h"
  5. #include "..\..\Utils\Utils.h"
  6. #include "..\..\SDK\ICvar.h"
  7. #include "..\..\SDK\IVEngineClient.h"
  8. #include "..\..\SDK\Hitboxes.h"
  9. #include "..\..\SDK\PlayerInfo.h"
  10. #include "..\..\Utils\Math.h"
  11. #include "..\..\Menu\Menu.h"
  12. #include "..\..\Menu\config.h"
  13. Resolver g_Resolver;
  14.  
  15. /*
  16. my attempt at fixing desync and i was pretty successful
  17. it can resolve static desync pretty perfectly
  18. and can resolve some jitter desync but
  19. it still gets rekt by other things
  20. */
  21.  
  22.  
  23. void Resolver::AnimationFix(C_BaseEntity* pEnt)
  24. {
  25.  
  26.     const auto player_animation_state = pEnt->AnimState();
  27.  
  28.  
  29.     if (!player_animation_state)
  30.         return;
  31.  
  32.     if (Globals::MissedShots[pEnt->EntIndex()] > 2) {
  33.         switch (Globals::MissedShots[pEnt->EntIndex()] % 4) {
  34.         case 0: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 60; break;
  35.         case 1: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 60; break;
  36.         case 2: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 60; break;
  37.         case 3: player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 60; break;
  38.         }
  39.         float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
  40.  
  41.  
  42.         pEnt->UpdateClientAnimation();
  43.         auto old_curtime = g_pGlobalVars->curtime;
  44.         auto old_frametime = g_pGlobalVars->frametime;
  45.         auto curtime = g_pGlobalVars->curtime;
  46.         auto frametime = g_pGlobalVars->frametime;
  47.         auto frametimne = (g_pGlobalVars->frametime);
  48.         auto absoluteframtime = (g_pGlobalVars->absoluteframetime);
  49.         auto interp_amount = (g_pGlobalVars->interpolationAmount);
  50.         auto framecount = g_pGlobalVars->framecount;
  51.         auto tickcount = g_pGlobalVars->tickcount;
  52.         g_pGlobalVars->realtime = pEnt->GetSimulationTime();
  53.         g_pGlobalVars->curtime = pEnt->GetSimulationTime();
  54.         g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
  55.         g_pGlobalVars->absoluteframetime = g_pGlobalVars->intervalPerTick;
  56.         g_pGlobalVars->framecount = pEnt->GetSimulationTime();
  57.         g_pGlobalVars->tickcount = pEnt->GetSimulationTime();
  58.         g_pGlobalVars->interpolationAmount = 0.0f;
  59.         g_pGlobalVars->curtime = pEnt->GetSimulationTime();
  60.         g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
  61.  
  62.         player_animation_state->m_iLastClientSideAnimationUpdateFramecount >= pEnt->GetSimulationTime();
  63.         player_animation_state->m_iLastClientSideAnimationUpdateFramecount = pEnt->GetSimulationTime() - 1;
  64.  
  65.         pEnt->UpdateClientAnimation();
  66.         g_pGlobalVars->curtime = old_curtime;
  67.         g_pGlobalVars->frametime = old_frametime;
  68.         (g_pGlobalVars->realtime) = g_pGlobalVars->realtime;
  69.         (g_pGlobalVars->curtime) = curtime;
  70.         (g_pGlobalVars->frametime) = frametimne;
  71.         (g_pGlobalVars->absoluteframetime) = absoluteframtime;
  72.         g_pGlobalVars->framecount = framecount;
  73.         g_pGlobalVars->tickcount = tickcount;
  74.     }
  75.  
  76. }
  77.  
  78. float flAngleMod(float flAngle)
  79. {
  80.     return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
  81. }
  82. float ApproachAngle(float target, float value, float speed)
  83. {
  84.     target = flAngleMod(target);
  85.     value = flAngleMod(value);
  86.  
  87.     float delta = target - value;
  88.  
  89.     // Speed is assumed to be positive
  90.     if (speed < 0)
  91.         speed = -speed;
  92.  
  93.     if (delta < -180)
  94.         delta += 360;
  95.     else if (delta > 180)
  96.         delta -= 360;
  97.  
  98.     if (delta > speed)
  99.         value += speed;
  100.     else if (delta < -speed)
  101.         value -= speed;
  102.     else
  103.         value = target;
  104.  
  105.     return value;
  106. }
  107. /*
  108.  
  109.  
  110. */
  111.  
  112. void update_state(C_AnimState* state, Vector angles) {
  113.     using Fn = void(__vectorcall*)(void*, void*, float, float, float, void*);
  114.     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"));
  115.     fn(state, nullptr, 0.0f, angles[1], angles[0], nullptr);
  116. }
  117.  
  118. // RESOLVER ADDITIONAL
  119.  
  120. bool is_slow_walking(C_BaseEntity* entity) {
  121.     float large = 0;
  122.     float velocity_2D[64], old_velocity_2D[64];
  123.     if (entity->GetVelocity().Length2D() != velocity_2D[entity->EntIndex()] && entity->GetVelocity().Length2D() != NULL) {
  124.         old_velocity_2D[entity->EntIndex()] = velocity_2D[entity->EntIndex()];
  125.         velocity_2D[entity->EntIndex()] = entity->GetVelocity().Length2D();
  126.     }
  127.     if (large == 0) return false;
  128.     Vector velocity = entity->GetVelocity();
  129.     Vector direction = entity->GetEyeAngles();
  130.  
  131.     float speed = velocity.Length();
  132.     direction.y = entity->GetEyeAngles().y - direction.y;
  133.     //method 1
  134.     if (velocity_2D[entity->EntIndex()] > 1) {
  135.         int tick_counter[64];
  136.         if (velocity_2D[entity->EntIndex()] == old_velocity_2D[entity->EntIndex()])
  137.             tick_counter[entity->EntIndex()] += 1;
  138.         else
  139.             tick_counter[entity->EntIndex()] = 0;
  140.  
  141.         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..
  142.             return true;
  143.     }
  144.  
  145.  
  146.     return false;
  147. }
  148.  
  149. float max_desync_angle(C_BaseEntity* entity) {
  150.  
  151.     auto animstate = uintptr_t(entity->AnimState());
  152.  
  153.     float duckammount = *(float*)(animstate + 0xA4);
  154.     float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));
  155.  
  156.     float speedfactor = max(0, min(1, *reinterpret_cast<float*> (animstate + 0xFC)));
  157.  
  158.     float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001) - 0.19999999) * speedfraction;
  159.     float unk2 = unk1 + 1.f;
  160.     float unk3;
  161.  
  162.     if (duckammount > 0)
  163.         unk2 += ((duckammount * speedfactor) * (0.5f - unk2));
  164.  
  165.     unk3 = *(float*)(animstate + 0x334) * unk2;
  166.  
  167.     return unk3;
  168. }
  169.  
  170. bool solve_desync_simple(C_BaseEntity* e) // 979
  171. {
  172.     if (!e || e->IsDormant() || !e->IsAlive())
  173.         return false;
  174.  
  175.     for (size_t i = 0; i < e->NumOverlays(); i++)
  176.     {
  177.         auto layer = e->GetAnimOverlay4(i);
  178.         if (!layer)
  179.             continue;
  180.  
  181.         if (e->GetSequenceActivity(layer->m_nSequence) == 979)
  182.         {
  183.             if (layer->m_flWeight == 0.0f && (layer->m_flCycle == 0.0f || layer->m_flCycle != layer->m_flPrevCycle))
  184.                 return true;
  185.         }
  186.     }
  187.     return false;
  188. }
  189.  
  190. float NormalizeYaw180(float yaw)
  191. {
  192.     if (yaw > 180)
  193.         yaw -= (round(yaw / 360) * 360.f);
  194.     else if (yaw < -180)
  195.         yaw += (round(yaw / 360) * -360.f);
  196.  
  197.     return yaw;
  198. }
  199.  
  200. inline float NormalizePitch(float pitch)
  201. {
  202.     while (pitch > 89.f)
  203.         pitch -= 180.f;
  204.     while (pitch < -89.f)
  205.         pitch += 180.f;
  206.  
  207.     return pitch;
  208. }
  209.  
  210. float NormalizeX(float yaw)
  211. {
  212.     if (yaw != yaw)
  213.         yaw = 0.f;
  214.  
  215.     return fmod(yaw + 180.f, 360.f) - 180.f;
  216. }
  217.  
  218. float approach(float cur, float target, float inc) {
  219.     inc = abs(inc);
  220.  
  221.     if (cur < target)
  222.         return min(cur + inc, target);
  223.     if (cur > target)
  224.         return max(cur - inc, target);
  225.  
  226.     return target;
  227. }
  228. bool delta_58(float first, float second)
  229. {
  230.     if (first - second < 90.f && first - second > -90.f)
  231.     {
  232.         return true;
  233.     }
  234.     return false;
  235. }
  236. float angle_difference(float a, float b) {
  237.     auto diff = NormalizeYaw180(a - b);
  238.  
  239.     if (diff < 180)
  240.         return diff;
  241.     return diff - 360;
  242. }
  243. bool delta_35(float first, float second)
  244. {
  245.     if (first - second <= 27.f && first - second >= -27.f)
  246.     {
  247.         return true;
  248.     }
  249.     return false;
  250. }
  251. float approach_angle(float cur, float target, float inc) {
  252.     auto diff = angle_difference(target, cur);
  253.     return approach(cur, cur + diff, inc);
  254. }
  255.  
  256. bool breaking_lby_animations(C_BaseEntity* e)
  257. {
  258.     if (!e || e->IsDormant() || !e->IsAlive())
  259.         return false;
  260.  
  261.     for (size_t i = 0; i < e->NumOverlays(); i++)
  262.     {
  263.         auto layer = e->GetAnimOverlay4(i);
  264.         if (e->GetSequenceActivity(layer->m_nSequence) == 979)
  265.         {
  266.             if (layer->m_flCycle != layer->m_flCycle || layer->m_flWeight == 1.f)
  267.                 return true;
  268.         }
  269.     }
  270.  
  271.     return false;
  272. }
  273.  
  274.  
  275. float get_weighted_desync_delta(C_BaseEntity* player, float abs_angle, bool breaking_lby)
  276. {
  277.     float delta = player->GetMaxDelta(player->AnimState()) + breaking_lby ? 30.f : 0.f;
  278.  
  279.     float relative = -abs_angle;
  280.     float positive = abs_angle + delta;
  281.     float negative = abs_angle - delta;
  282.  
  283.     float positive_delta = abs(g_Math.NormalizeYaw(relative - positive));
  284.     float negative_delta = abs(g_Math.NormalizeYaw(relative - negative));
  285.  
  286.     return positive_delta > negative_delta ? -delta : delta;
  287. }
  288.  
  289. float __fastcall ang_dif(float a1, float a2)
  290. {
  291.     float val = fmodf(a1 - a2, 360.0);
  292.     while (val < -180.0f) val += 360.0f;
  293.     while (val > 180.0f) val -= 360.0f;
  294.     return val;
  295. }
  296.  
  297. Vector CalcAngle69(Vector dst, Vector src)
  298. {
  299.     Vector angles;
  300.     double delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z - dst.z) };
  301.     double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
  302.     angles.x = (float)(atan(delta[2] / hyp) * 180.0 / 3.14159265);
  303.     angles.y = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f);
  304.     angles.z = 0.0f;
  305.  
  306.     if (delta[0] >= 0.0)
  307.     {
  308.         angles.y += 180.0f;
  309.     }
  310.     return angles;
  311. }
  312.  
  313. void NormalizeNumX(Vector& vIn, Vector& vOut)
  314. {
  315.     float flLen = vIn.Length();
  316.     if (flLen == 0) {
  317.         vOut.Init(0, 0, 1);
  318.         return;
  319.     }
  320.     flLen = 1 / flLen;
  321.     vOut.Init(vIn.x * flLen, vIn.y * flLen, vIn.z * flLen);
  322. }
  323.  
  324.  
  325. float GetLBYRotatedYaw(float lby, float yaw)
  326. {
  327.     float delta = NormalizeYaw180(yaw - lby);
  328.     if (fabs(delta) < 25.f)
  329.         return lby;
  330.  
  331.     if (delta > 0.f)
  332.         return yaw + 25.f;
  333.  
  334.     return yaw;
  335. }
  336.  
  337. void VectorAnglesBruteGay(const Vector& forward, Vector& angles)
  338. {
  339.     float tmp, yaw, pitch;
  340.     if (forward[1] == 0 && forward[0] == 0)
  341.     {
  342.         yaw = 0;
  343.         if (forward[2] > 0) pitch = 270; else pitch = 90;
  344.     }
  345.     else
  346.     {
  347.         yaw = (atan2(forward[1], forward[0]) * 180 / M_PI);
  348.         if (yaw < 0) yaw += 360; tmp = sqrt(forward[0] * forward[0] + forward[1] * forward[1]); pitch = (atan2(-forward[2], tmp) * 180 / M_PI);
  349.         if (pitch < 0) pitch += 360;
  350.     } angles[0] = pitch; angles[1] = yaw; angles[2] = 0;
  351. }
  352.  
  353. void AngleVectors(const Vector& angles, Vector* forward)
  354. {
  355.     Assert(s_bMathlibInitialized);
  356.     Assert(forward);
  357.  
  358.     float   sp, sy, cp, cy;
  359.  
  360.     sy = sin(DEG2RAD(angles[1]));
  361.     cy = cos(DEG2RAD(angles[1]));
  362.  
  363.     sp = sin(DEG2RAD(angles[0]));
  364.     cp = cos(DEG2RAD(angles[0]));
  365.  
  366.     forward->x = cp * cy;
  367.     forward->y = cp * sy;
  368.     forward->z = -sp;
  369. }
  370.  
  371.  
  372. // END OF HELPER
  373.  
  374.  
  375. void HandleBackUpResolve(C_BaseEntity* pEnt) {
  376.  
  377.     if (!c_config::get().aimbot_resolver)
  378.         return;
  379.  
  380.     if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
  381.         return;
  382.  
  383.  
  384.     auto animstate = pEnt->AnimState();
  385.  
  386.     const auto player_animation_state = pEnt->AnimState();
  387.  
  388.  
  389.     float flMaxYawModifier = player_animation_state->pad10[516] * flMaxYawModifier;
  390.     float flMinYawModifier = player_animation_state->pad10[512] * flMaxYawModifier;
  391.  
  392.     float newFeetYaw = 1.f;
  393.  
  394.     auto eyeYaw = player_animation_state->m_flEyeYaw;
  395.  
  396.     auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
  397.  
  398.     float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  399.  
  400.  
  401.     if (!player_animation_state)
  402.         return;
  403.  
  404.     float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
  405.  
  406.     auto v28 = 0.f;
  407.  
  408.     if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  409.     {
  410.         v28 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 0.0f);
  411.     }
  412.     else
  413.     {
  414.         v28 = 0x3F800000;
  415.     }
  416.  
  417.     float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v49;
  418.  
  419.     float flYawModifier = v49 + 1.0;
  420.  
  421.     if (player_animation_state->m_fDuckAmount > 0.0)
  422.     {
  423.         float v53 = 0.0f;
  424.  
  425.         if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  426.         {
  427.             v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  428.         }
  429.         else
  430.         {
  431.             v53 = 0.0f;
  432.         }
  433.     }
  434.  
  435.     if (eye_feet_delta <= flMaxYawModifier)
  436.     {
  437.         if (flMinYawModifier > eye_feet_delta)
  438.         {
  439.             newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  440.         }
  441.     }
  442.     else
  443.     {
  444.         newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  445.     }
  446.  
  447.  
  448.     float v136 = fmod(newFeetYaw, 360.0);
  449.  
  450.     if (v136 > 180.0)
  451.     {
  452.         v136 = v136 - 360.0;
  453.     }
  454.  
  455.     if (v136 < 180.0)
  456.     {
  457.         v136 = v136 + 360.0;
  458.     }
  459.  
  460.     v28 = v49++;
  461.  
  462.     {                                             // inlined max_desync_delta
  463.         float v9 = fabs(animstate->m_iLastClientSideAnimationUpdateFramecount - animstate->m_flLastClientSideAnimationUpdateTime);
  464.         float speedfraction = 0.0;
  465.         if (animstate->m_flFeetSpeedForwardsOrSideWays < 0.0)
  466.             speedfraction = 0.0;
  467.         else
  468.             speedfraction = animstate->m_flFeetSpeedForwardsOrSideWays;
  469.  
  470.         float v2 = (animstate->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
  471.         float v18 = v2;
  472.         float v3 = v2 + 1.0;
  473.         float v23 = v3;
  474.         if (animstate->m_fDuckAmount > 0.0)
  475.         {
  476.             float v29 = 0.0;
  477.             if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
  478.                 v29 = 0.0;
  479.             else
  480.                 v29 = fminf((animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
  481.         }
  482.  
  483.         if (pEnt)
  484.         {
  485.             for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  486.             {
  487.  
  488.                 if (pEnt)// dormant
  489.                 {
  490.                     float v28 = pEnt->GetEyeAngles().y == 0.0 ? -58 : 58;
  491.                     if (v28)
  492.                         return;
  493.                     float v27 = pEnt->GetEyeAngles().y == 0.0 ? -89 : 89;
  494.                     if (v27)
  495.                         return;
  496.                     float v26 = pEnt->GetEyeAngles().y == 0.0 ? -79 : 79;
  497.                     if (v26)
  498.                         return;
  499.                     float v25 = pEnt->GetEyeAngles().y == 0.0 ? -125 : 125;
  500.                     if (v25)
  501.                         return;
  502.                     float v24 = pEnt->GetEyeAngles().y == 0.0 ? -78 : 78;
  503.                     if (v24)
  504.                         return;
  505.                 }
  506.                 float v8 = 0;
  507.                 float v7 = 0;
  508.                 float v6 = 0;
  509.                 for (size_t i = 0; i < pEnt->GetNumAnimOverlays(); i++)
  510.                 {
  511.                     auto animLayer = pEnt->GetAnimOverlay4(i);
  512.                     if (!animLayer)
  513.                         continue;
  514.                     if (pEnt->GetSequenceActivity(animLayer->m_nSequence) == 979);
  515.                     auto v6 = pEnt->GetLowerBodyYaw();
  516.                 }
  517.                 float v20 = (animstate->m_vVelocityX) * v23;
  518.                 float a1 = (animstate->m_vVelocityY) * v23;
  519.                 float v30 = 0.0;
  520.                 float eye_angles_y = animstate->m_flEyeYaw;
  521.                 float goal_feet_yaw = animstate->m_flGoalFeetYaw;
  522.                 float v22 = fabs(eye_angles_y - goal_feet_yaw);
  523.                 if (v20 < v22)
  524.                 {
  525.                     float v11 = fabs(v20);
  526.                     v30 = eye_angles_y - v11;
  527.                 }
  528.                 else if (a1 > v22)
  529.                 {
  530.                     float v12 = fabs(a1);
  531.                     v30 = v12 + eye_angles_y;
  532.                 }
  533.                 float v36 = std::fmodf((v30), 360.0);
  534.                 if (v36 > 180.0)
  535.                     v36 = v36 - 360.0;
  536.                 if (v36 < 180.0)
  537.                     v36 = v36 + 360.0;
  538.                 animstate->m_flGoalFeetYaw = v36;
  539.                 if (Globals::MissedShots[pEnt->EntIndex()] > 2)
  540.                 {
  541.                     int v19 = Globals::MissedShots[pEnt->EntIndex()] % 4;
  542.                     switch (v19)
  543.                     {
  544.                     case 0:
  545.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
  546.                         break;
  547.                     case 1:
  548.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
  549.                         break;
  550.                     case 2:
  551.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
  552.                         break;
  553.                     case 3:
  554.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
  555.                         break;
  556.                     default:
  557.                         return;
  558.  
  559.  
  560.  
  561.  
  562.                         player_animation_state->m_flGoalFeetYaw = v136;
  563.                     }
  564.                 }
  565.             }
  566.  
  567.         }
  568.     }
  569. }
  570.  
  571.  
  572.  
  573. void OnetapResolver1(C_BaseEntity* entity)
  574. {
  575.     if (!c_config::get().resolverchoices[0])
  576.         return;
  577.  
  578.     if (entity->GetTeam() == Globals::LocalPlayer->GetTeam())
  579.         return;
  580.  
  581.     // [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
  582.     auto local_player = Globals::LocalPlayer;
  583.     auto animstate = entity->AnimState();
  584.     if (animstate)
  585.     {                                             // inlined max_desync_delta
  586.         //auto v9 = absolute_mask(COERCE_INT(animstate->last_client_side_animation_update_framecount - animstate->last_client_side_animation_update_time));
  587.         float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));
  588.         speedfraction = 0.0;
  589.         if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
  590.             speedfraction = 0.0;
  591.         else
  592.             speedfraction = fminf(DWORD(animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
  593.         float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001) - 0.19999999) * speedfraction;
  594.         float unk2 = unk1 + 1.f;
  595.         float unk3;
  596.         if (animstate->m_fDuckAmount > 0.0)
  597.         {
  598.             int v29 = 0.0;
  599.             if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
  600.                 v29 = 0.0;
  601.             else
  602.                 v29 = fminf(DWORD(animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
  603.         }
  604.         //GetClientEnt = *(*g_EntityList + 12);// GetLocalPlayer
  605.         //localplayer = GetClientEnt(g_EntityList, loc);
  606.         if (local_player)
  607.         {
  608.             for (int i = 0; i <= 64; ++i)
  609.             {
  610.                 auto animation_state = entity->AnimState();
  611.  
  612.                 //player = GetClientEntity(g_EntityList, i);
  613.                 if (local_player->IsAlive() && local_player->IsDormant())// dormant
  614.                 {
  615.                     auto v28 = animation_state->m_flEyeYaw == 0.0 ? -58 : 58;
  616.                     if (v28)
  617.                         return;
  618.                     auto v27 = animation_state->m_flEyeYaw == 0.0 ? -89 : 89;
  619.                     if (v27)
  620.                         return;
  621.                     auto v26 = animation_state->m_flEyeYaw == 0.0 ? -79 : 79;
  622.                     if (v26)
  623.                         return;
  624.                     auto v25 = animation_state->m_flEyeYaw == 0.0 ? -125 : 125;
  625.                     if (v25)
  626.                         return;
  627.                     auto v24 = animation_state->m_flEyeYaw == 0.0 ? -78 : 78;
  628.                     if (v24)
  629.                         return;
  630.                 }
  631.             }
  632.             int v8 = 0;
  633.             int v7 = 0;
  634.             for (int a2a = 0; a2a < 64; ++a2a)
  635.             {
  636.                 auto v32 = local_player->GetAnimOverlay4(a2a);
  637.                 //if (v32 && a== 979 && *(v32 + 44) != *(v32 + 28))
  638.                 //  auto v6 = entity->GetLowerBodyYaw();
  639.  
  640.                 auto v20 = BYTE(animstate->speed_2d) * unk2;
  641.                 auto a1 = BYTE(animstate->speed_2d) * unk2;
  642.                 int v30 = 0.0;
  643.                 auto eye_angles_y = animstate->m_flEyeYaw;
  644.                 auto goal_feet_yaw = animstate->m_flGoalFeetYaw;
  645.                 auto v22 = eye_angles_y - goal_feet_yaw;
  646.                 if (v20 < v22)
  647.                 {
  648.                     auto v11 = v20;
  649.                     v30 = eye_angles_y - v11;
  650.                 }
  651.                 else if (a1 > v22)
  652.                 {
  653.                     auto v12 = a1;
  654.                     v30 = v12 + eye_angles_y;
  655.                 }
  656.                 auto v36 = std::fmodf(v30, 360.0);
  657.                 if (v36 > 180.0)
  658.                     v36 = v36 - 360.0;
  659.                 if (v36 < 180.0)
  660.                     v36 = v36 + 360.0;
  661.                 animstate->m_flGoalFeetYaw = v36;
  662.                 if (Globals::MissedShots[entity->EntIndex()] > 2)//(global::missedshots > 2)
  663.                 {
  664.                     switch (Globals::MissedShots[entity->EntIndex()])
  665.                     {
  666.                     case 3:
  667.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
  668.                         break;
  669.                     case 4:
  670.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
  671.                         break;
  672.                     case 5:
  673.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
  674.                         break;
  675.                     case 6:
  676.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
  677.                         break;
  678.                         //case 7:
  679.                             //animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + animstate->m_flCurrentFeetYaw + 25.0;
  680.                         //case 8:
  681.                             //animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - animstate->m_flCurrentFeetYaw - 25.0;
  682.                     default:
  683.                         return;
  684.                     }
  685.                 }
  686.             }
  687.         }
  688.     }
  689. }
  690.  
  691.  
  692. void onetap(C_BaseEntity* entity)
  693. {
  694.  
  695.     if (!c_config::get().aimbot_resolver)
  696.         return;
  697.  
  698.     if (entity->GetTeam() == Globals::LocalPlayer->GetTeam())
  699.         return;
  700.  
  701.     auto local_player = Globals::LocalPlayer;
  702.     auto v3 = local_player;
  703.     if (v3 != entity)
  704.     {
  705.         auto animstate = entity->AnimState();
  706.         if (animstate)
  707.         {
  708.             if (animstate->m_fDuckAmount > 0.0)
  709.             {
  710.                 auto v29 = 0.0;
  711.                 if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
  712.                     v29 = 0.0;
  713.                 else
  714.                     v29 = std::fminf((animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
  715.             }
  716.  
  717.             if (Globals::MissedShots[entity->EntIndex()] <= 2)
  718.             {
  719.                 float speed;
  720.                 if (*(float*)(animstate + 0xF8) < 0.f)
  721.                 {
  722.                     speed = 0.0;
  723.                 }
  724.                 else
  725.                 {
  726.                     speed = fminf(*(DWORD*)(animstate + 0xF8), 1.0f);
  727.                 }
  728.  
  729.                 float flYawModifier = (*(float*)(animstate + 0x11C) * -0.30000001 - 0.19999999) * speed;
  730.                 flYawModifier += 1.0f;
  731.  
  732.                 if (*(float*)(animstate + 0xA4) > 0.0 && *(float*)(animstate + 0xFC) >= 0.0)
  733.                     flYawModifier = fminf(*(float*)(uintptr_t(animstate) + 0xFC), 1.0f);
  734.  
  735.                 float m_flMaxBodyYaw = *(float*)(uintptr_t(animstate) + 0x334) * flYawModifier;
  736.                 float m_flMinBodyYaw = *(float*)(uintptr_t(animstate) + 0x330) * flYawModifier;
  737.  
  738.                 float ResolvedYaw = animstate->m_flEyeYaw;
  739.                 float delta = std::abs(animstate->m_flEyeYaw - animstate->m_flGoalFeetYaw);
  740.                 if (m_flMaxBodyYaw < delta)
  741.                 {
  742.                     ResolvedYaw = animstate->m_flEyeYaw - std::abs(m_flMaxBodyYaw);
  743.                 }
  744.                 else if (m_flMinBodyYaw > delta)
  745.                 {
  746.                     ResolvedYaw = animstate->m_flEyeYaw + std::abs(m_flMinBodyYaw);
  747.                 }
  748.                 animstate->m_flGoalFeetYaw = (g_Math.NormalizeYaw(ResolvedYaw));
  749.             }
  750.             else
  751.             {
  752.                 switch (Globals::MissedShots[entity->EntIndex()] % 4)
  753.                 {
  754.                 case 0:
  755.                     animstate->m_flGoalFeetYaw += 59.0f;
  756.                     break;
  757.                 case 1:
  758.                     animstate->m_flGoalFeetYaw -= 59.0f;
  759.                     break;
  760.                 case 2:
  761.                     animstate->m_flGoalFeetYaw -= 78.0f;
  762.                     break;
  763.                 case 3:
  764.                     animstate->m_flGoalFeetYaw += 78.0f;
  765.                     break;
  766.                 case 4:
  767.                     animstate->m_flGoalFeetYaw -= animstate->m_flGoalFeetYaw ? -180 : 180;
  768.                     break;
  769.                 case 5:
  770.                     animstate->m_flGoalFeetYaw += animstate->m_flGoalFeetYaw ? -180 : 180;
  771.                     break;
  772.                 default:
  773.                     break;
  774.                 }
  775.             }
  776.         }
  777.         /*else
  778.         {
  779.             switch (g_ctx.m_globals.missed_shots[entity->EntIndex()] % 3)
  780.             {
  781.             case 0:
  782.                 entity->m_angEyeAngles -= animstate->m_flGoalFeetYaw ? -58 : 58;
  783.                 break;
  784.             case 1:
  785.                 entity->m_angEyeAngles += animstate->m_flGoalFeetYaw ? -58 : 58;
  786.                 break;
  787.             case 2:
  788.                 entity->m_angEyeAngles -= animstate->m_flGoalFeetYaw ? -89 : 89;
  789.                 break;
  790.             case 3:
  791.                 entity->m_angEyeAngles += animstate->m_flGoalFeetYaw ? -89 : 89;
  792.                 break;
  793.             case 4:
  794.                 entity->m_angEyeAngles -= animstate->m_flGoalFeetYaw ? -78 : 78;
  795.                 break;
  796.             case 5:
  797.                 entity->m_angEyeAngles += animstate->m_flGoalFeetYaw ? -78 : 78;
  798.                 break;
  799.             default:
  800.                 break;
  801.             }
  802.         }
  803.         */
  804.     }
  805. }
  806.  
  807. bool using_fake_angles[65];
  808. int missed_shots[65];
  809.  
  810.  
  811. void newResolver(C_BaseEntity* pEnt)
  812. {
  813.     if (!c_config::get().aimbot_resolver)
  814.         return;
  815.  
  816.     if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
  817.         return;
  818.  
  819.     if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
  820.         return;
  821.  
  822.     auto animstate = pEnt->AnimState();
  823.  
  824.     const auto player_animation_state = pEnt->AnimState();
  825.  
  826.  
  827.     float flMaxYawModifier = player_animation_state->pad10[516] * flMaxYawModifier;
  828.     float flMinYawModifier = player_animation_state->pad10[512] * flMaxYawModifier;
  829.  
  830.     float newFeetYaw = 1.f;
  831.  
  832.     auto eyeYaw = player_animation_state->m_flEyeYaw;
  833.  
  834.     auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
  835.  
  836.     float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  837.  
  838.  
  839.     if (!player_animation_state)
  840.         return;
  841.  
  842.  
  843.  
  844.     float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
  845.  
  846.     auto v28 = 0.f;
  847.  
  848.     if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  849.     {
  850.         v28 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 0.0f);
  851.     }
  852.     else
  853.     {
  854.         v28 = 0x3F800000;
  855.     }
  856.  
  857.     float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v49;
  858.  
  859.     float flYawModifier = v49 + 1.0;
  860.  
  861.     if (player_animation_state->m_fDuckAmount > 0.0)
  862.     {
  863.         float v53 = 0.0f;
  864.  
  865.         if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  866.         {
  867.             v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  868.         }
  869.         else
  870.         {
  871.             v53 = 0.0f;
  872.         }
  873.     }
  874.  
  875.  
  876.  
  877.  
  878.  
  879.     if (eye_feet_delta <= flMaxYawModifier)
  880.     {
  881.         if (flMinYawModifier > eye_feet_delta)
  882.         {
  883.             newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  884.         }
  885.     }
  886.     else
  887.     {
  888.         newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  889.     }
  890.  
  891.  
  892.  
  893.  
  894.     float v136 = fmod(newFeetYaw, 360.0);
  895.  
  896.     if (v136 > 180.0)
  897.     {
  898.         v136 = v136 - 360.0;
  899.     }
  900.  
  901.     if (v136 < 180.0)
  902.     {
  903.         v136 = v136 + 360.0;
  904.     }
  905.  
  906.     v28 = v49++;
  907.  
  908.     {                                             // inlined max_desync_delta
  909.         float v9 = fabs(animstate->m_iLastClientSideAnimationUpdateFramecount - animstate->m_flLastClientSideAnimationUpdateTime);
  910.         float speedfraction = 0.0;
  911.         if (animstate->m_flFeetSpeedForwardsOrSideWays < 0.0)
  912.             speedfraction = 0.0;
  913.         else
  914.             speedfraction = animstate->m_flFeetSpeedForwardsOrSideWays;
  915.  
  916.         float v2 = (animstate->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
  917.         float v18 = v2;
  918.         float v3 = v2 + 1.0;
  919.         float v23 = v3;
  920.         if (animstate->m_fDuckAmount > 0.0)
  921.         {
  922.             float v29 = 0.0;
  923.             if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
  924.                 v29 = 0.0;
  925.             else
  926.                 v29 = fminf((animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
  927.         }
  928.  
  929.         if (Globals::LocalPlayer)
  930.         {
  931.             for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  932.             {
  933.  
  934.                 if (pEnt)// dormant
  935.                 {
  936.                     float v28 = pEnt->GetEyeAngles().y == 0.0 ? -58 : 58;
  937.                     if (v28)
  938.                         return;
  939.                     float v27 = pEnt->GetEyeAngles().y == 0.0 ? -89 : 89;
  940.                     if (v27)
  941.                         return;
  942.                     float v26 = pEnt->GetEyeAngles().y == 0.0 ? -79 : 79;
  943.                     if (v26)
  944.                         return;
  945.                     float v25 = pEnt->GetEyeAngles().y == 0.0 ? -125 : 125;
  946.                     if (v25)
  947.                         return;
  948.                     float v24 = pEnt->GetEyeAngles().y == 0.0 ? -78 : 78;
  949.                     if (v24)
  950.                         return;
  951.                 }
  952.                 float v8 = 0;
  953.                 float v7 = 0;
  954.                 float v6 = 0;
  955.                 for (size_t i = 0; i < pEnt->GetNumAnimOverlays(); i++)
  956.                 {
  957.                     auto layer = pEnt->GetNumAnimOverlays();
  958.                     if (!layer)
  959.                         continue;
  960.  
  961.  
  962.  
  963.                     if (pEnt->GetSequence() == 979);// Íå åáó ïî÷åìó êîãäà îí äåëàë ïîä xy0 òóò áûëà îøèáêà, ÿ å¸ èñïðàâèë
  964.                     v6 = pEnt->GetLowerBodyYaw();
  965.                 }
  966.                 float v20 = (animstate->m_vVelocityX) * v23;
  967.                 float a1 = (animstate->m_vVelocityY) * v23;
  968.                 float v30 = 0.0;
  969.                 float eye_angles_y = animstate->m_flEyeYaw;
  970.                 float goal_feet_yaw = animstate->m_flGoalFeetYaw;
  971.                 float v22 = fabs(eye_angles_y - goal_feet_yaw);
  972.                 if (v20 < v22)
  973.                 {
  974.                     float v11 = fabs(v20);
  975.                     v30 = eye_angles_y - v11;
  976.                 }
  977.                 else if (a1 > v22)
  978.                 {
  979.                     float v12 = fabs(a1);
  980.                     v30 = v12 + eye_angles_y;
  981.                 }
  982.                 float v36 = std::fmodf((v30), 360.0);
  983.                 if (v36 > 180.0)
  984.                     v36 = v36 - 360.0;
  985.                 if (v36 < 180.0)
  986.                     v36 = v36 + 360.0;
  987.                 animstate->m_flGoalFeetYaw = v36;
  988.                 if (Globals::MissedShots[pEnt->EntIndex()] > 2)
  989.                 {
  990.                     int v19 = Globals::MissedShots[pEnt->EntIndex()] % 4;
  991.                     switch (v19)
  992.                     {
  993.                     case 0:
  994.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
  995.                         break;
  996.                     case 1:
  997.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
  998.                         break;
  999.                     case 2:
  1000.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
  1001.                         break;
  1002.                     case 3:
  1003.                         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
  1004.                         break;
  1005.                     default:
  1006.                         return;
  1007.  
  1008.  
  1009.  
  1010.  
  1011.                         player_animation_state->m_flGoalFeetYaw = v136;
  1012.                     }
  1013.                 }
  1014.             }
  1015.  
  1016.         }
  1017.     }
  1018. }
  1019.  
  1020.  
  1021. float polak_num_rand(float Min, float Max) // random number
  1022. {
  1023.     return ((float(rand()) / float(RAND_MAX)) * (Max - Min)) + Min;
  1024. }
  1025.  
  1026.  
  1027. void PolakResolver(C_BaseEntity* pEnt) {
  1028.  
  1029.     if (!c_config::get().aimbot_resolver)
  1030.         return;
  1031.  
  1032.     if (pEnt->GetTeam() == Globals::LocalPlayer->GetTeam())
  1033.         return;
  1034.  
  1035.  
  1036.  
  1037.     auto animstate = pEnt->AnimState();
  1038.  
  1039.     const auto player_animation_state = pEnt->AnimState();
  1040.  
  1041.     float newFeetYaw = 1.f;
  1042.  
  1043.  
  1044.     if (!player_animation_state)
  1045.         return;
  1046.  
  1047.  
  1048.     float v136 = fmod(newFeetYaw, 360.0);
  1049.  
  1050.  
  1051.     float v6 = 0;
  1052.     for (size_t i = 0; i < pEnt->GetNumAnimOverlays(); i++) // hi polak i hacked aimware
  1053.     {
  1054.         auto animLayer = pEnt->GetAnimOverlay4(i);
  1055.         if (!animLayer)
  1056.             continue;
  1057.         if (pEnt->GetSequenceActivity(animLayer->m_nSequence) == 979);
  1058.         auto v6 = pEnt->GetLowerBodyYaw();
  1059.     }
  1060.  
  1061.     int v19 = Globals::MissedShots[pEnt->EntIndex()] % 2; // p2c bruteforce
  1062.     switch (v19)
  1063.     {
  1064.     case 0:
  1065.         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + polak_num_rand(0.0, 45.0);
  1066.         break;
  1067.     case 1:
  1068.         animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - polak_num_rand(0.0, 45.0);
  1069.         break;
  1070.     default:
  1071.         return;
  1072.  
  1073.  
  1074.  
  1075.  
  1076.         player_animation_state->m_flGoalFeetYaw = v136;
  1077.     }
  1078. }
  1079.  
  1080.  
  1081. void HandleHits(C_BaseEntity* pEnt)
  1082. {
  1083.     auto NetChannel = g_pEngine->GetNetChannelInfo();
  1084.  
  1085.     if (!NetChannel)
  1086.         return;
  1087.  
  1088.     static float predTime[65];
  1089.     static bool init[65];
  1090.  
  1091.     if (Globals::Shot[pEnt->EntIndex()])
  1092.     {
  1093.         if (init[pEnt->EntIndex()])
  1094.         {
  1095.             g_Resolver.pitchHit[pEnt->EntIndex()] = pEnt->GetEyeAngles().x;
  1096.             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);
  1097.             init[pEnt->EntIndex()] = false;
  1098.         }
  1099.  
  1100.         if (g_pGlobalVars->curtime > predTime[pEnt->EntIndex()] && !Globals::Hit[pEnt->EntIndex()])
  1101.         {
  1102.             Globals::MissedShots[pEnt->EntIndex()] += 1;
  1103.             Globals::Shot[pEnt->EntIndex()] = false;
  1104.         }
  1105.         else if (g_pGlobalVars->curtime <= predTime[pEnt->EntIndex()] && Globals::Hit[pEnt->EntIndex()])
  1106.             Globals::Shot[pEnt->EntIndex()] = false;
  1107.  
  1108.     }
  1109.     else
  1110.         init[pEnt->EntIndex()] = true;
  1111.  
  1112.     Globals::Hit[pEnt->EntIndex()] = false;
  1113. }
  1114.  
  1115. void Resolver::OnCreateMove() // cancer v2
  1116. {
  1117.     if (!c_config::get().aimbot_resolver)
  1118.         return;
  1119.  
  1120.     if (!Globals::LocalPlayer->IsAlive())
  1121.         return;
  1122.  
  1123.     if (!Globals::LocalPlayer->GetActiveWeapon() || Globals::LocalPlayer->IsKnifeorNade())
  1124.         return;
  1125.  
  1126.  
  1127.     for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  1128.     {
  1129.         C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  1130.  
  1131.         if (!pPlayerEntity
  1132.             || !pPlayerEntity->IsAlive()
  1133.             || pPlayerEntity->IsDormant()
  1134.             || pPlayerEntity == Globals::LocalPlayer
  1135.             || pPlayerEntity->GetTeam() == Globals::LocalPlayer->GetTeam())
  1136.         {
  1137.             UseFreestandAngle[i] = false;
  1138.             continue;
  1139.         }
  1140.  
  1141.         // WE NEED THEM TO CHECK OUR PREVALUES OF RESOLVER
  1142.         /*
  1143.         NormalizeYaw180;
  1144.         solve_desync_simple;
  1145.         FlipYaw;
  1146.         breaking_lby_animations;
  1147.         CalcAngle69;
  1148.         NormalizeX;
  1149.         max_desync_angle;
  1150.         is_slow_walking;
  1151.         GetLBYRotatedYaw;
  1152.         NormalizePitch;
  1153.         */
  1154.         // END OF RESOLVER PREVALUES
  1155.  
  1156.         if (abs(pPlayerEntity->GetVelocity().Length2D()) > 29.f)
  1157.             UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
  1158.  
  1159.         if (abs(pPlayerEntity->GetVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
  1160.         {
  1161.             bool Autowalled = false, HitSide1 = false, HitSide2 = false;
  1162.  
  1163.             float angToLocal = g_Math.CalcAngle(Globals::LocalPlayer->GetOrigin(), pPlayerEntity->GetOrigin()).y;
  1164.             Vector ViewPoint = Globals::LocalPlayer->GetOrigin() + Vector(0, 0, 90);
  1165.  
  1166.             Vector2D Side1 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal))),(45 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  1167.             Vector2D Side2 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  1168.  
  1169.             Vector2D Side3 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal))),(50 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  1170.             Vector2D Side4 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  1171.  
  1172.             Vector Origin = pPlayerEntity->GetOrigin();
  1173.  
  1174.             Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
  1175.  
  1176.             Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
  1177.  
  1178.             for (int side = 0; side < 2; side++)
  1179.             {
  1180.                 Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x,  Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
  1181.                 Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x,  ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
  1182.  
  1183.                 if (g_Autowall.CanHitFloatingPoint(OriginAutowall, ViewPoint))
  1184.                 {
  1185.                     if (side == 0)
  1186.                     {
  1187.                         HitSide1 = true;
  1188.                         FreestandAngle[pPlayerEntity->EntIndex()] = 90;
  1189.                     }
  1190.                     else if (side == 1)
  1191.                     {
  1192.                         HitSide2 = true;
  1193.                         FreestandAngle[pPlayerEntity->EntIndex()] = -90;
  1194.                     }
  1195.  
  1196.                     Autowalled = true;
  1197.                 }
  1198.                 else
  1199.                 {
  1200.                     for (int side222 = 0; side222 < 2; side222++)
  1201.                     {
  1202.                         Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x,  Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };
  1203.  
  1204.                         if (g_Autowall.CanHitFloatingPoint(OriginAutowall222, OriginAutowall2))
  1205.                         {
  1206.                             if (side222 == 0)
  1207.                             {
  1208.                                 HitSide1 = true;
  1209.                                 FreestandAngle[pPlayerEntity->EntIndex()] = 90;
  1210.                             }
  1211.                             else if (side222 == 1)
  1212.                             {
  1213.                                 HitSide2 = true;
  1214.                                 FreestandAngle[pPlayerEntity->EntIndex()] = -90;
  1215.                             }
  1216.  
  1217.                             Autowalled = true;
  1218.                         }
  1219.                     }
  1220.                 }
  1221.             }
  1222.  
  1223.             if (Autowalled)
  1224.             {
  1225.                 if (HitSide1 && HitSide2)
  1226.                     UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
  1227.                 else
  1228.                     UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
  1229.             }
  1230.         }
  1231.     }
  1232. }
  1233.  
  1234. void Resolver::FrameStage(ClientFrameStage_t stage)
  1235. {
  1236.     if (!Globals::LocalPlayer || !g_pEngine->IsInGame())
  1237.         return;
  1238.  
  1239.     static bool  wasDormant[65];
  1240.  
  1241.     for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  1242.     {
  1243.         C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  1244.  
  1245.         if (!pPlayerEntity
  1246.             || !pPlayerEntity->IsAlive())
  1247.             continue;
  1248.         if (pPlayerEntity->IsDormant())
  1249.         {
  1250.             wasDormant[i] = true;
  1251.             continue;
  1252.         }
  1253.  
  1254.         if (stage == FRAME_RENDER_START)
  1255.         {
  1256.             HandleHits(pPlayerEntity);
  1257.             AnimationFix(pPlayerEntity);
  1258.         }
  1259.  
  1260.         if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
  1261.             newResolver(pPlayerEntity);
  1262.         //  ResolveDesyncBruteforce(pPlayerEntity);
  1263.         }
  1264.  
  1265.         if (stage == FRAME_NET_UPDATE_END && pPlayerEntity != Globals::LocalPlayer)
  1266.         {
  1267.             auto VarMap = reinterpret_cast<uintptr_t>(pPlayerEntity) + 36;
  1268.             auto VarMapSize = *reinterpret_cast<int*>(VarMap + 20);
  1269.  
  1270.             for (auto index = 0; index < VarMapSize; index++)
  1271.                 * reinterpret_cast<uintptr_t*>(*reinterpret_cast<uintptr_t*>(VarMap) + index * 12) = 0;
  1272.         }
  1273.  
  1274.         wasDormant[i] = false;
  1275.     }
  1276. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top