Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.03 KB | None | 0 0
  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\IVEngineClient.h"
  7. #include "..\..\SDK\Hitboxes.h"
  8. #include "..\..\SDK\PlayerInfo.h"
  9. #include "..\..\Utils\Math.h"
  10. #include "..\..\Menu\Menu.h"
  11. #include "../../SDK/CEntity.h"
  12. #include "..\Logs\Logs.h"
  13. #include "../../SDK/Vector.h"
  14.  
  15. Resolver g_Resolver;
  16. resolver_setup * resolver = new resolver_setup();
  17.  
  18.  
  19. void Resolver::UpdateAnimations(IClientEntity *player, C_BaseEntity* pEnt)
  20. {
  21. bool value;
  22. //Vector vecAbsVelocity;
  23. auto state = pEnt->GetPlayerAnimationState();
  24. if (state)
  25. {
  26. // backup
  27. const float curtime = g_pGlobalVars->curtime;
  28. const float frametime = g_pGlobalVars->frametime;
  29.  
  30. g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
  31. g_pGlobalVars->curtime = pEnt->GetSimulationTime();
  32.  
  33. int backup_eflags = pEnt->m_iEFlags();
  34. // animstate->m_iLastClientSideAnimationUpdateFramecount - animstate->m_flLastClientSideAnimationUpdateTime
  35. // SetLocalVelocity
  36. pEnt->m_iEFlags() &= ~0x1000; // InvalidatePhysicsRecursive(VELOCITY_CHANGED); EFL_DIRTY_ABSVELOCITY = 0x1000
  37. // pEnt->SetAbsVelocity() = pEnt->m_vecVelocity();
  38.  
  39. // invalidates prior animations
  40. //if (state->m_iLastClientSideAnimationUpdateFramecount() == g_pGlobalVars->framecount)
  41. // state->m_iLastClientSideAnimationUpdateFramecount() = g_pGlobalVars->framecount - 1;
  42.  
  43. //pEnt->ClientAnimations(value) = true;
  44.  
  45. // updates local animations + poses + calculates new abs angle based on eyeangles and other stuff
  46. pEnt->UpdateClientAnimation();
  47.  
  48. pEnt->ClientAnimations() = false;
  49.  
  50. // restore
  51. pEnt->m_iEFlags() = backup_eflags;
  52.  
  53. g_pGlobalVars->curtime = curtime;
  54. g_pGlobalVars->frametime = frametime;
  55.  
  56. pEnt->InvalidateBoneCache();
  57. player->SetupBones(nullptr, -1, 0x7FF00, g_pGlobalVars->curtime);
  58. }
  59. }
  60. void Resolver::AnimationFix2(C_BaseEntity* pEnt, C_BaseEntity* pLocalEnt)
  61. {
  62.  
  63.  
  64. /*static float ShotTime[65];
  65.  
  66. static float oldSimtime[65];
  67. static float storedSimtime[65];
  68.  
  69. static Vector oldEyeAngles[65];
  70. static float oldGoalfeetYaw[65];
  71. static Vector oldOrigin[65]; */
  72.  
  73. auto AnimState = pEnt->AnimState();
  74. auto local_player = g::pLocalEntity;
  75. if (pEnt == local_player) {
  76. pEnt->ClientAnimations() = true;
  77. auto player_animation_state = pEnt->AnimState();
  78. AnimState->m_flLeanAmount = 15;
  79. AnimState->m_flCurrentTorsoYaw += 10;
  80. pEnt->UpdateClientAnimation();
  81. pEnt->SetAbsAngles(Vector(0, AnimState->m_flGoalFeetYaw, 0));
  82. pEnt->ClientAnimations() = false;
  83. }
  84. else {
  85. auto player_index = pEnt->EntIndex() - 1;
  86.  
  87. pEnt->ClientAnimations() = true;
  88.  
  89. auto old_curtime = g_pGlobalVars->curtime;
  90. auto old_frametime = g_pGlobalVars->frametime;
  91.  
  92. g_pGlobalVars->curtime = pEnt->GetSimulationTime();
  93. g_pGlobalVars->frametime = g_pGlobalVars->intervalPerTick;
  94.  
  95.  
  96. auto player_model_time = reinterpret_cast<int*>(AnimState + 120);
  97. if (AnimState != nullptr && player_model_time != nullptr)
  98. if (*player_model_time == g_pGlobalVars->framecount)
  99. * player_model_time = g_pGlobalVars->framecount - 1;
  100.  
  101.  
  102.  
  103.  
  104. pEnt->UpdateClientAnimation();
  105.  
  106. g_pGlobalVars->curtime = old_curtime;
  107. g_pGlobalVars->frametime = old_frametime;
  108.  
  109. //pEnt->SetAbsAngles(Vector(0, player_animation_state->m_flGoalFeetYaw, 0));
  110.  
  111. pEnt->ClientAnimations() = false;
  112. ;
  113. /*if (g::missedshoted > 3)
  114. {
  115. float angToLocal = g_Math.NormalizeYaw(g_Math.CalcAngle(pLocalEnt->GetOrigin(), pEnt->GetOrigin()).y);
  116.  
  117. float Back = g_Math.NormalizeYaw(angToLocal);
  118. float DesyncFix = 0;
  119. float* PosParams = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(pEnt) + 0x2774);
  120. bool shot = false;
  121.  
  122.  
  123. float Resim = g_Math.NormalizeYaw((TICKS_TO_TIME(16) / (pEnt->GetSimulationTime() - oldSimtime[pEnt->EntIndex()])) * g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));
  124.  
  125. if (Resim > 60.f)
  126. Resim = 60.f;
  127. if (Resim < -60.f)
  128. Resim = -60.f;
  129.  
  130. if (g_Menu.Config.Resolver && !shot && !isnan(angToLocal) && !isinf(angToLocal) && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam())
  131. {
  132. float AntiSide = 0.f;
  133.  
  134. if (g::MissedShots[pEnt->EntIndex()] % 2)
  135. {
  136. if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Back) > 0.f)
  137. AntiSide = -90.f;
  138. else if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Back) < 0.f)
  139. AntiSide = 90.f;
  140. }
  141. else
  142. {
  143. if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - g_Math.NormalizeYaw(Back + 90)) > 0.f)
  144. AntiSide = 180.f;
  145. else if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - g_Math.NormalizeYaw(Back + 90)) < 0.f)
  146. AntiSide = 0.f;
  147. }
  148.  
  149. float Brute = g_Math.NormalizeYaw(Back + AntiSide);
  150. float Delta = g_Math.NormalizeYaw(g_Math.NormalizeYaw(Brute - pEnt->GetEyeAngles().y) + Resim);
  151.  
  152. if (Delta > 58.f) // who needs clamps
  153. Delta = 58.f;
  154. if (Delta < -58.f)
  155. Delta = -58.f;
  156.  
  157. Resim += Delta;
  158. DesyncFix += Delta;
  159.  
  160. if (Resim > 60.f)
  161. Resim = 60.f;
  162. if (Resim < -60.f)
  163. Resim = -60.f;
  164. }
  165.  
  166. float Equalized;
  167.  
  168. // if (fabs(g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y)) < 60.f) // yea basically im retarded
  169. Equalized = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y + Resim);
  170. // else
  171. // Equalized = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Resim);
  172.  
  173. if (g_Menu.Config.Resolver && !shot && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND))
  174. AnimState->m_flGoalFeetYaw = Equalized;
  175. } //b resolver?
  176.  
  177. float* PosParams = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(pEnt) + 0x2774);
  178. bool shot = false; */
  179.  
  180. float* PosParams = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(pEnt) + 0x2774);
  181. bool shot = false;
  182.  
  183. if (shot && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam() && PosParams[12] <= -80) // ez shot pitch fix LMAO
  184. PosParams[12] = 89.f;
  185. }
  186. }
  187.  
  188.  
  189.  
  190.  
  191. void Resolver::AnimationFix(C_BaseEntity* pEnt, C_BaseEntity* pLocalEnt)
  192. {
  193.  
  194.  
  195.  
  196. // i rly am just to lazy pls dont judge
  197. static float ShotTime[65];
  198.  
  199. static float oldSimtime[65];
  200. static float storedSimtime[65];
  201.  
  202. static Vector oldEyeAngles[65];
  203. static float oldGoalfeetYaw[65];
  204. static Vector oldOrigin[65];
  205.  
  206. float* PosParams = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(pEnt) + 0x2774);
  207. bool shot = false;
  208.  
  209. auto* AnimState = pEnt->AnimState();
  210. if (!AnimState || !pEnt->AnimOverlays() || !PosParams)
  211. return;
  212.  
  213. if (*reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(AnimState) + 0x164) < 0) // sorry had to anti pasta this basically the key to nospread
  214. * reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(AnimState) + 0x110) = 0.f;
  215.  
  216. bool update = false;
  217.  
  218. if (storedSimtime[pEnt->EntIndex()] != pEnt->GetSimulationTime())
  219. {
  220. pEnt->ClientAnimations() = true;
  221. pEnt->UpdateClientAnimation();
  222. // pEnt->ClientAnimations() = false;
  223.  
  224. update = true;
  225. }
  226.  
  227.  
  228.  
  229. oldGoalfeetYaw[pEnt->EntIndex()] = AnimState->m_flGoalFeetYaw;
  230.  
  231. if (pEnt->GetActiveWeapon() && !pEnt->IsKnifeorNade())
  232. {
  233. if (ShotTime[pEnt->EntIndex()] != pEnt->GetActiveWeapon()->GetLastShotTime())
  234. {
  235. shot = true;
  236. ShotTime[pEnt->EntIndex()] = pEnt->GetActiveWeapon()->GetLastShotTime();
  237. }
  238. else
  239. shot = false;
  240. }
  241. else
  242. {
  243. shot = false;
  244. ShotTime[pEnt->EntIndex()] = 0.f;
  245. }
  246.  
  247.  
  248. if (shot && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam() && PosParams[12] <= -80) // ez shot pitch fix LMAO
  249. PosParams[12] = 89.f;
  250.  
  251. if (update)
  252. {
  253. oldEyeAngles[pEnt->EntIndex()] = pEnt->GetEyeAngles();
  254. oldSimtime[pEnt->EntIndex()] = storedSimtime[pEnt->EntIndex()];
  255. storedSimtime[pEnt->EntIndex()] = pEnt->GetSimulationTime();
  256. oldOrigin[pEnt->EntIndex()] = pEnt->GetOrigin();
  257. }
  258.  
  259. pEnt->SetAbsAngles(Vector(0, oldGoalfeetYaw[pEnt->EntIndex()], 0));
  260. }
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267. void StaticDesyncResolve(C_BaseEntity* entity)
  268. {
  269. int angle1[64];
  270. int angle2[64];
  271. int angle3[64];
  272. static float old_simtime[65];
  273. bool using_fake_angles[65];
  274.  
  275. if (old_simtime[entity->EntIndex()] != entity->GetSimulationTime())
  276. angle1[entity->EntIndex()] = entity->GetEyeAngles().y;
  277. else
  278. angle2[entity->EntIndex()] = entity->GetEyeAngles().y;
  279.  
  280. if (angle1[entity->EntIndex()] != angle2[entity->EntIndex()])
  281. using_fake_angles[entity->EntIndex()] = true;
  282. else
  283. using_fake_angles[entity->EntIndex()] = false;
  284.  
  285. if (using_fake_angles[entity->EntIndex()])
  286. {
  287. if (g_Math.YawDistance(angle1[entity->EntIndex()], angle2[entity->EntIndex()]) <= 58)
  288. {
  289. entity->GetEyeAnglesPointer()->y = entity->GetLowerBodyYaw() - g_Math.YawDistance(angle1[entity->EntIndex()], angle2[entity->EntIndex()]);
  290. }
  291. }
  292.  
  293. old_simtime[entity->EntIndex()] = entity->GetSimulationTime();
  294. }
  295.  
  296. void Guess(C_BaseEntity* ent)
  297. {
  298. // 0,1,2 not 1,2,3. someone doesn't know how '%' works, eh? -swoopae
  299. switch (g::MissedShots[ent->EntIndex()] % 3)
  300. {
  301. case 0:
  302. StaticDesyncResolve(ent); break;
  303. case 1:
  304. ent->GetEyeAnglesPointer()->y += ent->GetMaxDesyncDelta(); break;
  305. case 2:
  306. ent->GetEyeAnglesPointer()->y -= ent->GetMaxDesyncDelta(); break;
  307. }
  308. }
  309.  
  310. void Resolver::resolvepitch(C_BaseEntity* pEnt)
  311. {
  312. auto local_player = g::pLocalEntity;
  313. float last_simtime[64] = { 0.f };
  314. float stored_pitch_1[64] = { 0.f };
  315. float fixed_pitch[64] = { 0.f };
  316.  
  317. float yaw = pEnt->GetEyeAngles().y;
  318. bool has_been_set[64] = { false };
  319. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(0);
  320. //const auto local = hackManager.pLocal();
  321. if (!local_player)
  322. return;
  323.  
  324. for (auto i = 0; i < g_pEngine->GetMaxClients(); ++i)
  325. {
  326.  
  327. const auto eye = pEnt->GetEyeAngles().y;
  328.  
  329. auto pitch = 0.f;
  330.  
  331. if (eye > 89.f)
  332. pitch = 89.f;
  333.  
  334. else if (eye < -89.f)
  335. pitch = -89.f;
  336.  
  337. else
  338. {
  339. if (stored_pitch_1[i] == FLT_MAX || !has_been_set[i])
  340. {
  341. stored_pitch_1[i] = eye;
  342. has_been_set[i] = true;
  343. }
  344.  
  345. if (stored_pitch_1[i] - eye < 30 && stored_pitch_1[i] - eye > -30)
  346. {
  347. pitch = eye;
  348. }
  349. else
  350. {
  351. pitch = stored_pitch_1[i];
  352. }
  353. }
  354. // pPlayerEntity->SetEyeAngles(Vector(pPlayerEntity->GetEyeAngles().x,
  355. //pPlayerEntity->(Vector(GetEyeAngles().x = pitch;
  356. }
  357. }
  358.  
  359. void brutev2(int stage, IClientEntity * player, float yaw_value, C_BaseEntity* pEnt)
  360. {
  361.  
  362. switch (stage)
  363. {
  364. case 0: // no delta check / low jitter
  365. {
  366. switch (g::MissedShots[pEnt->EntIndex()] % 3)
  367. {
  368. case 0: pEnt->GetEyeAnglesXY()->y -= -yaw_value;
  369. break;
  370. case 1: pEnt->GetEyeAnglesXY()->y += -yaw_value;
  371. break;
  372. case 2: pEnt->GetEyeAnglesXY()->y -= 45.f;
  373. break;
  374. case 3: pEnt->GetEyeAnglesXY()->y += 45.f;
  375. break;
  376. case 4: pEnt->GetEyeAnglesXY()->y = yaw_value - 90.f;
  377. break;
  378. }
  379. }
  380. break;
  381.  
  382. case 1: // low delta break / limited jitter
  383. {
  384. switch (g::MissedShots[pEnt->EntIndex()] % 3)
  385. {
  386. case 0: pEnt->GetEyeAnglesXY()->y += 20.f;
  387. break;
  388. case 1: pEnt->GetEyeAnglesXY()->y += 45.f;
  389. break;
  390. case 2: pEnt->GetEyeAnglesXY()->y -= 20.f;
  391. break;
  392. case 3: pEnt->GetEyeAnglesXY()->y -= 45.f;
  393. break;
  394. case 4: pEnt->GetEyeAnglesXY()->y = yaw_value;
  395. break;
  396.  
  397. default: pEnt->GetEyeAnglesXY()->y -= pEnt->GetLowerBodyYaw() - pEnt->GetEyeAnglesXY()->y;
  398. }
  399. }
  400. break;
  401.  
  402. case 2: // high delta break / high jitter
  403. {
  404. switch (g::MissedShots[pEnt->EntIndex()] % 4)
  405. {
  406. case 0: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() - 40.f;
  407. break;
  408. case 1: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() + 40.f;
  409. break;
  410. case 2: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() - 90.f;
  411. break;
  412. case 3: pEnt->GetEyeAnglesXY()->y = yaw_value - 29.f;
  413. break;
  414. case 4: pEnt->GetEyeAnglesXY()->y = yaw_value + 29.f;
  415. break;
  416. }
  417. }
  418.  
  419. }
  420. }
  421.  
  422. float NormalizeYaw180(float yaw)
  423. {
  424. if (yaw > 180)
  425. yaw -= (round(yaw / 360) * 360.f);
  426. else if (yaw < -180)
  427. yaw += (round(yaw / 360) * -360.f);
  428.  
  429. return yaw;
  430. }
  431.  
  432.  
  433.  
  434. void Resolver::ResolverB(C_BaseEntity* pEnt, IClientEntity* player)
  435. {
  436. auto AnimState = pEnt->AnimState();
  437. float speedfraction = 0.0;
  438. if (AnimState->m_flFeetSpeedForwardsOrSideWays < 0.0)
  439. speedfraction = 0.0;
  440. else
  441. speedfraction = AnimState->m_flFeetSpeedForwardsOrSideWays;
  442. float v2 = (AnimState->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
  443. float v18 = v2;
  444. float v3 = v2 + 1.0;
  445. float v23 = v3;
  446. float original_lby[65] = { FLT_MAX };
  447. auto fix_goal_feet_yaw = [](float rotation, float invertedrotation, float yawfeetdelta, float yaw, C_AnimState* state) {
  448. if (yawfeetdelta < rotation) {
  449. if (invertedrotation > yawfeetdelta)
  450. * (float*)(uintptr_t(state) + 0x80) = invertedrotation + yaw;
  451. }
  452. else
  453. *(float*)(uintptr_t(state) + 0x80) = yaw - rotation;
  454. };
  455.  
  456. auto get_rotation = [&](int rotation_type, C_AnimState* state) {
  457. float v43 = *(float*)((uintptr_t)state + 0xA4);
  458. float v54 = max(0, min(*reinterpret_cast<float*>((uintptr_t)state + 0xF8), 1));
  459. float v55 = max(0, min(1, *reinterpret_cast<float*>((uintptr_t)state + 0xFC)));
  460.  
  461. float v56;
  462. v56 = ((*reinterpret_cast<float*>((uintptr_t)state + 0x11C) * -0.30000001) - 0.19999999) * v54;
  463. if (v43 > 0)
  464. v56 += ((v43 * v55) * (0.5 - v56));
  465.  
  466. v56 = *(float*)((uintptr_t)state + rotation_type) * v56;
  467. return v56;
  468. };
  469.  
  470. auto state = pEnt->GetPlayerAnimationState();
  471. //auto AnimState = pEnt->AnimState();
  472. auto local_player = g::pLocalEntity;
  473. // auto animstate1 = pEnt->AnimState();
  474.  
  475. if (!AnimState)
  476. return;
  477.  
  478. /* float newFeetYaw =
  479. 1.f;
  480.  
  481. auto eyeYaw = AnimState->m_flEyeYaw;
  482.  
  483. auto lbyYaw = AnimState->m_flGoalFeetYaw;
  484.  
  485. float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  486.  
  487. float flMaxYawModifier = AnimState->pad10[516] * flMaxYawModifier;
  488. float flMinYawModifier = AnimState->pad10[512] * flMaxYawModifier;
  489.  
  490. auto v28 = 0.f;
  491.  
  492. if (AnimState->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  493. {
  494. v28 = fminf(AnimState->m_flFeetSpeedForwardsOrSideWays, 0.0f);
  495. }
  496. else
  497. {
  498. v28 = 0x3F800000;
  499. }
  500.  
  501. float v49 = ((AnimState->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v49;
  502.  
  503. if (eye_feet_delta <= flMaxYawModifier)
  504. {
  505. if (flMinYawModifier > eye_feet_delta)
  506. {
  507. newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  508. }
  509. }
  510. else
  511. {
  512. newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  513. }*/
  514.  
  515.  
  516. /*float v136 = fmod(newFeetYaw, 360.0);
  517.  
  518. if (v136 > 180.0)
  519. {
  520. v136 = v136 - 360.0;
  521. }
  522.  
  523. if (v136 < 180.0)
  524. {
  525. v136 = v136 + 360.0;
  526. }
  527.  
  528. v28 = v49++; */
  529.  
  530.  
  531. float feet_eye = NormalizeYaw180(state->m_flGoalFeetYaw - pEnt->GetEyeAngles().y);
  532. float inverted = get_rotation(0x2B4, AnimState);
  533. float max = get_rotation(0x2B0, AnimState);
  534. float yawfeetdelta = AnimState->m_flEyeYaw - AnimState->m_flGoalFeetYaw;
  535. float yaw = pEnt->GetEyeAngles().y;
  536.  
  537. if (pEnt != g::pLocalEntity && (pEnt->GetTeam() != g::pLocalEntity->GetTeam() && !g_Menu.Config.FriendlyFire) && g_Menu.Config.Resolver2 /*&& !( GetAsyncKeyState( g_Menu.Config.override_resolver_key ) && g_Menu.Config.ResolverOverride && g::pLocalEntity && g::pLocalEntity->IsAlive())*/ || pEnt != g::pLocalEntity && g_Menu.Config.FriendlyFire && g_Menu.Config.Resolver /*&& !( GetAsyncKeyState( g_Menu.Config.override_resolver_key ) && g_Menu.Config.ResolverOverride && g::pLocalEntity && g::pLocalEntity->IsAlive())*/) {
  538. // if (!g::MissedShots[pEnt->EntIndex()]) {
  539. if (local_player)
  540. {
  541.  
  542. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  543.  
  544. {
  545.  
  546. //player = GetClientEntity(g_EntityList, i);
  547. if (local_player->IsDormant())// dormant
  548. {
  549. // auto v29 = AnimState->m_flEyeYaw == 0.0 ? -60 : 60;
  550. // if (v29)
  551. // return;
  552. auto v28 = AnimState->m_flEyeYaw == 0.0 ? -58 : 58; // 58
  553. if (v28)
  554. return;
  555. auto v27 = AnimState->m_flEyeYaw == 0.0 ? -90 : 90; // 89
  556. if (v27)
  557. return;
  558. auto v26 = AnimState->m_flEyeYaw == 0.0 ? -79 : 79; // 79
  559. if (v26)
  560. return;
  561. auto v25 = AnimState->m_flEyeYaw == 0.0 ? -118 : 118; // 125 // 60
  562. if (v25)
  563. return;
  564. auto v24 = AnimState->m_flEyeYaw == 0.0 ? -60 : 60; // 78
  565. if (v24)
  566. return;
  567.  
  568. }
  569. float v8 = 0;
  570. float v7 = 0;
  571. float v6 = 0;
  572. for (size_t i = 0; i < g::pLocalEntity->GetNumAnimOverlays(); i++)
  573. {
  574. auto layer = g::pLocalEntity->get_anim_overlay_index(i);
  575. if (!layer)
  576. continue;
  577.  
  578. if (g::pLocalEntity->get_sequence_act(layer->m_nSequence) == 979 && (layer->m_flPrevCycle) != (layer->m_flCycle))
  579. v6 = g::pLocalEntity->GetLowerBodyYaw();
  580. }
  581. float v20 = (AnimState->m_vVelocityX) * v23;
  582. float a1 = (AnimState->m_vVelocityY) * v23;
  583. float v30 = 0.0;
  584. float eye_angles_y = AnimState->m_flEyeYaw;
  585. float goal_feet_yaw = AnimState->m_flGoalFeetYaw;
  586. float v22 = fabs(eye_angles_y - goal_feet_yaw);
  587. if (v20 < v22)
  588. {
  589. float v11 = fabs(v20);
  590. v30 = eye_angles_y - v11;
  591. }
  592. else if (a1 > v22)
  593. {
  594. float v12 = fabs(a1);
  595. v30 = v12 + eye_angles_y;
  596. }
  597. float v36 = std::fmodf((v30), 360.0);
  598. if (v36 > 180.0)
  599. v36 = v36 - 360.0;
  600. if (v36 < 180.0)
  601. v36 = v36 + 360.0;
  602. AnimState->m_flGoalFeetYaw = v36;
  603. if (g::missedshoted > 2)
  604. {
  605. int v19 = g::MissedShots[pEnt->EntIndex()] % 4;
  606. switch (v19)
  607. {
  608. case 0:
  609. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw + 45.0;
  610. break;
  611. case 1:
  612. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw - 45.0;
  613. break;
  614. case 2:
  615. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw - 30.0;
  616. break;
  617. case 3:
  618. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw + 30.0;
  619. break;
  620. default:
  621. return;
  622. }
  623.  
  624. fix_goal_feet_yaw(max, inverted, yawfeetdelta, yaw, AnimState);
  625. pEnt->AnimState()->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw;
  626. }
  627. // xy0's ""reversed"" resolver which is pretty much our static desync but ok
  628. // else if (g::MissedShots[pEnt->EntIndex()] < 2) {
  629. float m_flLastClientSideAnimationUpdateTimeDelta = fabs(AnimState->m_iLastClientSideAnimationUpdateFramecount - AnimState->m_flLastClientSideAnimationUpdateTime);
  630.  
  631. auto v48 = 0.f;
  632.  
  633. if (AnimState->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  634. {
  635. v48 = fminf(AnimState->m_flFeetSpeedForwardsOrSideWays, 1.0f);
  636. }
  637. else
  638. {
  639. v48 = 0.0f;
  640. brutev2(0, player, feet_eye, pEnt);
  641. }
  642.  
  643.  
  644. if (AnimState->m_fDuckAmount > 0.0)
  645. {
  646. float v53 = 0.0f;
  647.  
  648. if (AnimState->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  649. {
  650. v53 = fminf(AnimState->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  651. }
  652. else
  653. {
  654. v53 = 0.0f;
  655. // brutev2(1, player, pEnt->GetLowerBodyYaw(), pEnt);
  656. }
  657. if (g::missedshoted > 7)
  658. brutev2(1, player, pEnt->GetLowerBodyYaw(), pEnt);
  659. else if (g::missedshoted > 8)
  660. brutev2(2, player, original_lby[pEnt->EntIndex()], pEnt);
  661. }
  662.  
  663.  
  664. /*if (local_player)
  665. {
  666.  
  667. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  668.  
  669. {
  670.  
  671. //player = GetClientEntity(g_EntityList, i);
  672. if (local_player->IsAlive() && local_player->IsDormant())// dormant
  673. {
  674. // auto v29 = AnimState->m_flEyeYaw == 0.0 ? -60 : 58;
  675. // if (v29)
  676. // return;
  677. auto v28 = AnimState->m_flEyeYaw == 0.0 ? -58 : 580; // 58
  678. if (v28)
  679. return;
  680. auto v27 = AnimState->m_flEyeYaw == 0.0 ? -90 : 90; // 89
  681. if (v27)
  682. return;
  683. auto v26 = AnimState->m_flEyeYaw == 0.0 ? -80 : 80; // 79
  684. if (v26)
  685. return;
  686. auto v25 = AnimState->m_flEyeYaw == 0.0 ? -60 : 60; // 125
  687. if (v25)
  688. return;
  689. auto v24 = AnimState->m_flEyeYaw == 0.0 ? -118 : 118; // 78
  690. if (v24)
  691. return;
  692.  
  693. }
  694. float v8 = 0;
  695. float v7 = 0;
  696. float v6 = 0;
  697. for (size_t i = 0; i < g::pLocalEntity->GetNumAnimOverlays(); i++)
  698. {
  699. auto layer = g::pLocalEntity->get_anim_overlay_index(i);
  700. if (!layer)
  701. continue;
  702.  
  703. if (g::pLocalEntity->get_sequence_act(layer->m_nSequence) == 979 && (layer->m_flPrevCycle) != (layer->m_flCycle))
  704. v6 = g::pLocalEntity->GetLowerBodyYaw();
  705. }
  706. float v20 = (AnimState->m_vVelocityX) * v23;
  707. float a1 = (AnimState->m_vVelocityY) * v23;
  708. float v30 = 0.0;
  709. float eye_angles_y = AnimState->m_flEyeYaw;
  710. float goal_feet_yaw = AnimState->m_flGoalFeetYaw;
  711. float v22 = fabs(eye_angles_y - goal_feet_yaw);
  712. if (v20 < v22)
  713. {
  714. float v11 = fabs(v20);
  715. v30 = eye_angles_y - v11;
  716. }
  717. else if (a1 > v22)
  718. {
  719. float v12 = fabs(a1);
  720. v30 = v12 + eye_angles_y;
  721. }
  722. float v36 = std::fmodf((v30), 360.0);
  723. if (v36 > 180.0)
  724. v36 = v36 - 360.0;
  725. if (v36 < 180.0)
  726. v36 = v36 + 360.0;
  727. AnimState->m_flGoalFeetYaw = v36;
  728. if (g::missedshoted > 2)
  729. {
  730. int v19 = g::MissedShots[pEnt->EntIndex()] % 3;
  731. switch (v19)
  732. {
  733. case 0:
  734. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw + 45.0;
  735. break;
  736. case 1:
  737. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw - 45.0;
  738. break;
  739. case 2:
  740. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw - 30.0;
  741. break;
  742. case 3:
  743. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw + 30.0;
  744. break;
  745. default:
  746. return;
  747. } */
  748.  
  749.  
  750.  
  751. float v49 = ((AnimState->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
  752.  
  753. float flYawModifier = v49 + 1.0;
  754.  
  755. /* if (AnimState->m_fDuckAmount > 0.0)
  756. {
  757. float v53 = 0.0f;
  758.  
  759. if (AnimState->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  760. {
  761. v53 = fminf(AnimState->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  762. }
  763. else
  764. {
  765. v53 = 0.0f;
  766. // brutev2(1, player, pEnt->GetLowerBodyYaw(), pEnt);
  767. }
  768. if (g::missedshoted > 5)
  769. brutev2(1, player, pEnt->GetLowerBodyYaw(), pEnt);
  770. else if (g::missedshoted > 6)
  771. brutev2(2, player, original_lby[pEnt->EntIndex()], pEnt);
  772. } */
  773.  
  774.  
  775.  
  776. float flMaxYawModifier = AnimState->pad10[516] * flYawModifier;
  777. float flMinYawModifier = AnimState->pad10[512] * flYawModifier;
  778.  
  779. float newFeetYaw = 0.f;
  780.  
  781. auto eyeYaw = AnimState->m_flEyeYaw;
  782.  
  783. auto lbyYaw = AnimState->m_flGoalFeetYaw;
  784.  
  785. float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  786.  
  787. float flEyeDiff = std::remainderf(eyeYaw - lbyYaw, 360.f);
  788.  
  789. if (eye_feet_delta <= flMaxYawModifier)
  790. {
  791. if (flMinYawModifier > eye_feet_delta)
  792. {
  793. newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  794. }
  795. }
  796. else
  797. {
  798. newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  799. }
  800.  
  801. float v136 = fmod(newFeetYaw, 360.0);
  802.  
  803. if (v136 > 180.0)
  804. {
  805. v136 = v136 - 360.0;
  806. }
  807.  
  808. if (v136 < 180.0)
  809. {
  810. v136 = v136 + 360.0;
  811. }
  812.  
  813. AnimState->m_flGoalFeetYaw = v136;
  814. }
  815. // else {
  816. // brutev2(2, player, original_lby[pEnt->EntIndex()], pEnt);
  817. }
  818. // g::MissedShots[pEnt->EntIndex()] = g::MissedShots[pEnt->EntIndex()] % 6; // so it just doesn't brute all the fucking time, that's dumb.
  819. }
  820. }
  821.  
  822.  
  823. void Resolver::Resolve1(C_BaseEntity* pEnt, C_BaseEntity* pLocalEnt)
  824. {
  825.  
  826. static float ShotTime[65];
  827.  
  828. static float oldSimtime[65];
  829. static float storedSimtime[65];
  830.  
  831. static Vector oldEyeAngles[65];
  832. static float oldGoalfeetYaw[65];
  833. static Vector oldOrigin[65];
  834. auto AnimState = pEnt->AnimState();
  835. float speedfraction = 0.0;
  836. if (AnimState->m_flFeetSpeedForwardsOrSideWays < 0.0)
  837. speedfraction = 0.0;
  838. else
  839. speedfraction = AnimState->m_flFeetSpeedForwardsOrSideWays;
  840. float v2 = (AnimState->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
  841. float v18 = v2;
  842. float v3 = v2 + 1.0;
  843. float v23 = v3;
  844. float original_lby[65] = { FLT_MAX };
  845. auto fix_goal_feet_yaw = [](float rotation, float invertedrotation, float yawfeetdelta, float yaw, C_AnimState* state) {
  846. if (yawfeetdelta < rotation) {
  847. if (invertedrotation > yawfeetdelta)
  848. * (float*)(uintptr_t(state) + 0x80) = invertedrotation + yaw;
  849. }
  850. else
  851. *(float*)(uintptr_t(state) + 0x80) = yaw - rotation;
  852. };
  853. auto get_rotation = [&](int rotation_type, C_AnimState* state) {
  854. float v43 = *(float*)((uintptr_t)state + 0xA4);
  855. float v54 = max(0, min(*reinterpret_cast<float*>((uintptr_t)state + 0xF8), 1));
  856. float v55 = max(0, min(1, *reinterpret_cast<float*>((uintptr_t)state + 0xFC)));
  857.  
  858. float v56;
  859. v56 = ((*reinterpret_cast<float*>((uintptr_t)state + 0x11C) * -0.30000001) - 0.19999999) * v54;
  860. if (v43 > 0)
  861. v56 += ((v43 * v55) * (0.5 - v56));
  862.  
  863. v56 = *(float*)((uintptr_t)state + rotation_type) * v56;
  864. return v56;
  865. };
  866.  
  867. float feet_eye = NormalizeYaw180(AnimState->m_flGoalFeetYaw - pEnt->GetEyeAngles().y);
  868. float inverted = get_rotation(0x2B4, AnimState);
  869. float max = get_rotation(0x2B0, AnimState);
  870. float yawfeetdelta = AnimState->m_flEyeYaw - AnimState->m_flGoalFeetYaw;
  871. float yaw = pEnt->GetEyeAngles().y;
  872.  
  873.  
  874. float* PosParams = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(pEnt) + 0x2774);
  875. bool shot = false;
  876.  
  877. //auto AnimState = pEnt->AnimState();
  878.  
  879.  
  880.  
  881. //auto* AnimState = pEnt->AnimState();
  882. if (!AnimState || !pEnt->AnimOverlays() || !PosParams)
  883. return;
  884.  
  885. if (*reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(AnimState) + 0x164) < 0) // sorry had to anti pasta this basically the key to nospread
  886. * reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(AnimState) + 0x110) = 0.f;
  887.  
  888. bool update = false;
  889.  
  890. auto v48 = 0.f;
  891.  
  892. if (AnimState->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  893. {
  894. v48 = fminf(AnimState->m_flFeetSpeedForwardsOrSideWays, 1.0f);
  895. }
  896. else
  897. {
  898. v48 = 0.0f;
  899. //brutev2(0, player, feet_eye, pEnt);
  900. }
  901.  
  902. float v49 = ((AnimState->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
  903.  
  904. float flYawModifier = v49 + 1.0;
  905.  
  906. float flMaxYawModifier = AnimState->pad10[516] * flYawModifier;
  907. float flMinYawModifier = AnimState->pad10[512] * flYawModifier;
  908.  
  909. float newFeetYaw = 0.f;
  910.  
  911. auto eyeYaw = AnimState->m_flEyeYaw;
  912.  
  913. auto lbyYaw = AnimState->m_flGoalFeetYaw;
  914.  
  915. float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  916.  
  917. float flEyeDiff = std::remainderf(eyeYaw - lbyYaw, 360.f);
  918.  
  919. if (eye_feet_delta <= flMaxYawModifier)
  920. {
  921. if (flMinYawModifier > eye_feet_delta)
  922. {
  923. newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  924. }
  925. }
  926. else
  927. {
  928. newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  929. }
  930.  
  931. float v136 = fmod(newFeetYaw, 360.0);
  932.  
  933. if (v136 > 180.0)
  934. {
  935. v136 = v136 - 360.0;
  936. }
  937.  
  938. if (v136 < 180.0)
  939. {
  940. v136 = v136 + 360.0;
  941. }
  942.  
  943. AnimState->m_flGoalFeetYaw = v136;
  944.  
  945.  
  946.  
  947. oldGoalfeetYaw[pEnt->EntIndex()] = AnimState->m_flGoalFeetYaw;
  948.  
  949.  
  950. if (pLocalEnt && pLocalEnt->IsAlive())
  951. {
  952.  
  953. fix_goal_feet_yaw(max, inverted, yawfeetdelta, yaw, AnimState);
  954. float angToLocal = g_Math.NormalizeYaw(g_Math.CalcAngle(pLocalEnt->GetOrigin(), pEnt->GetOrigin()).y);
  955.  
  956. float Back = g_Math.NormalizeYaw(angToLocal);
  957. float DesyncFix = 0;
  958.  
  959. float Resim = g_Math.NormalizeYaw((TICKS_TO_TIME(16) / (pEnt->GetSimulationTime() - oldSimtime[pEnt->EntIndex()])) * g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));
  960.  
  961. if (Resim > 60.f)
  962. Resim = 60.f;
  963. if (Resim < -60.f)
  964. Resim = -60.f;
  965.  
  966. if (g_Menu.Config.Resolve1 && !shot && !isnan(angToLocal) && !isinf(angToLocal) && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam())
  967. {
  968. float AntiSide = 0.f;
  969.  
  970. if (g::MissedShots[pEnt->EntIndex()] % 2)
  971. {
  972. if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Back) > 0.f)
  973. AntiSide = -90.f;
  974. else if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Back) < 0.f)
  975. AntiSide = 90.f;
  976. }
  977. else
  978. {
  979. if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - g_Math.NormalizeYaw(Back + 90)) > 0.f)
  980. AntiSide = 180.f;
  981. else if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - g_Math.NormalizeYaw(Back + 90)) < 0.f)
  982. AntiSide = 0.f;
  983. }
  984.  
  985. float Brute = g_Math.NormalizeYaw(Back + AntiSide);
  986. float Delta = g_Math.NormalizeYaw(g_Math.NormalizeYaw(Brute - pEnt->GetEyeAngles().y) + Resim);
  987.  
  988. if (Delta > 58.f) // who needs clamps
  989. Delta = 58.f;
  990. if (Delta < -58.f)
  991. Delta = -58.f;
  992.  
  993. Resim += Delta;
  994. DesyncFix += Delta;
  995.  
  996. if (Resim > 60.f)
  997. Resim = 60.f;
  998. if (Resim < -60.f)
  999. Resim = -60.f;
  1000. }
  1001.  
  1002. if (g::missedshoted > 4)
  1003. {
  1004. int v19 = g::MissedShots[pEnt->EntIndex()] % 4;
  1005. switch (v19)
  1006. {
  1007. case 0:
  1008. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw + 45.0;
  1009. break;
  1010. case 1:
  1011. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw - 45.0;
  1012. break;
  1013. case 2:
  1014. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw - 30.0;
  1015. break;
  1016. case 3:
  1017. AnimState->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw + 30.0;
  1018. break;
  1019. default:
  1020. return;
  1021. }
  1022.  
  1023. float Equalized;
  1024.  
  1025. // if (fabs(g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y)) < 60.f) // yea basically im retarded
  1026. Equalized = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y + Resim);
  1027. // else
  1028. // Equalized = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Resim);
  1029.  
  1030. if (g_Menu.Config.Resolve1 && !shot && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND))
  1031. AnimState->m_flGoalFeetYaw = Equalized;
  1032. } //b resolver?
  1033.  
  1034. if (shot && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam() && PosParams[12] <= -80) // ez shot pitch fix LMAO
  1035. PosParams[12] = 89.f;
  1036.  
  1037.  
  1038. pEnt->SetAbsAngles(Vector(0, oldGoalfeetYaw[pEnt->EntIndex()], 0));
  1039. }
  1040. }
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. void Resolver::OnCreateMove() // cancer v2
  1061. {
  1062. //if (!g_Menu.Config.Resolver)
  1063. // return;
  1064.  
  1065. //if (!g_Menu.Config.Resolve1)
  1066. // return;
  1067. //if (!g_Menu.Config.Resolver2)
  1068. // return;
  1069.  
  1070.  
  1071. if (!g_pEngine->IsInGame() && !g_pEngine->IsConnected())
  1072. return;
  1073.  
  1074. if (!g::pLocalEntity->IsAlive())
  1075. return;
  1076.  
  1077. if (!g::pLocalEntity->GetActiveWeapon())
  1078. return; // why wouldnt u resolve people when u have a knife out retard
  1079.  
  1080. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  1081. {
  1082. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  1083.  
  1084. if (!pPlayerEntity
  1085. || !pPlayerEntity->IsAlive()
  1086. || pPlayerEntity->IsDormant()
  1087. || pPlayerEntity == g::pLocalEntity
  1088. || pPlayerEntity->GetTeam() == g::pLocalEntity->GetTeam())
  1089. {
  1090. UseFreestandAngle[i] = false;
  1091. continue;
  1092. }
  1093.  
  1094. if (abs(pPlayerEntity->GetVelocity().Length2D()) > 29.f)
  1095. UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
  1096.  
  1097. if (abs(pPlayerEntity->GetVelocity().Length2D()) <= 29.f && !UseFreestandAngle[pPlayerEntity->EntIndex()])
  1098. {
  1099. bool Autowalled = false, HitSide1 = false, HitSide2 = false;
  1100.  
  1101. float angToLocal = g_Math.CalcAngle(g::pLocalEntity->GetOrigin(), pPlayerEntity->GetOrigin()).y;
  1102. Vector ViewPoint = g::pLocalEntity->GetOrigin() + Vector(0, 0, 90);
  1103.  
  1104. Vector2D Side1 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal))),(45 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  1105. Vector2D Side2 = { (45 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(45 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  1106.  
  1107. Vector2D Side3 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal))),(50 * cos(g_Math.GRD_TO_BOG(angToLocal))) };
  1108. Vector2D Side4 = { (50 * sin(g_Math.GRD_TO_BOG(angToLocal + 180))) ,(50 * cos(g_Math.GRD_TO_BOG(angToLocal + 180))) };
  1109.  
  1110. Vector Origin = pPlayerEntity->GetOrigin();
  1111.  
  1112. Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
  1113.  
  1114. Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
  1115.  
  1116. for (int side = 0; side < 2; side++)
  1117. {
  1118. Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
  1119. Vector OriginAutowall2 = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
  1120.  
  1121. if (g_Autowall.CanHitFloatingPoint(OriginAutowall, ViewPoint))
  1122. {
  1123. if (side == 0)
  1124. {
  1125. HitSide1 = true;
  1126. FreestandAngle[pPlayerEntity->EntIndex()] = 90;
  1127. }
  1128. else if (side == 1)
  1129. {
  1130. HitSide2 = true;
  1131. FreestandAngle[pPlayerEntity->EntIndex()] = -90;
  1132. }
  1133.  
  1134. Autowalled = true;
  1135. }
  1136. else
  1137. {
  1138. for (int side222 = 0; side222 < 2; side222++)
  1139. {
  1140. Vector OriginAutowall222 = { Origin.x + OriginLeftRight[side222].x, Origin.y - OriginLeftRight[side222].y , Origin.z + 90 };
  1141.  
  1142. if (g_Autowall.CanHitFloatingPoint(OriginAutowall222, OriginAutowall2))
  1143. {
  1144. if (side222 == 0)
  1145. {
  1146. HitSide1 = true;
  1147. FreestandAngle[pPlayerEntity->EntIndex()] = 90;
  1148. }
  1149. else if (side222 == 1)
  1150. {
  1151. HitSide2 = true;
  1152. FreestandAngle[pPlayerEntity->EntIndex()] = -90;
  1153. }
  1154.  
  1155. Autowalled = true;
  1156. }
  1157. }
  1158. }
  1159. }
  1160.  
  1161. if (Autowalled)
  1162. {
  1163. if (HitSide1 && HitSide2)
  1164. UseFreestandAngle[pPlayerEntity->EntIndex()] = false;
  1165. else
  1166. UseFreestandAngle[pPlayerEntity->EntIndex()] = true;
  1167. }
  1168. }
  1169.  
  1170.  
  1171. // bad idea but ill try this why not
  1172. if (UseFreestandAngle[pPlayerEntity->EntIndex()] && g::MissedShots[pPlayerEntity->EntIndex()] < 4) {
  1173. pPlayerEntity->SetEyeAngles(Vector(pPlayerEntity->GetEyeAngles().x, pPlayerEntity->GetEyeAngles().y + FreestandAngle[pPlayerEntity->EntIndex()], pPlayerEntity->GetEyeAngles().z));
  1174. }
  1175. }
  1176. }
  1177.  
  1178.  
  1179.  
  1180.  
  1181. float approach(float cur, float target, float inc) {
  1182. inc = abs(inc);
  1183.  
  1184. if (cur < target)
  1185. return min(cur + inc, target);
  1186. if (cur > target)
  1187. return max(cur - inc, target);
  1188.  
  1189. return target;
  1190. }
  1191. /*float NormalizeYaw180(float yaw)
  1192. {
  1193. if (yaw > 180)
  1194. yaw -= (round(yaw / 360) * 360.f);
  1195. else if (yaw < -180)
  1196. yaw += (round(yaw / 360) * -360.f);
  1197.  
  1198. return yaw;
  1199. } */
  1200.  
  1201. float angle_difference(float a, float b) {
  1202. auto diff = NormalizeYaw180(a - b);
  1203.  
  1204. if (diff < 180)
  1205. return diff;
  1206. return diff - 360;
  1207. }
  1208.  
  1209. float approach_angle(float cur, float target, float inc) {
  1210. auto diff = angle_difference(target, cur);
  1211. return approach(cur, cur + diff, inc);
  1212. }
  1213.  
  1214. bool solve_desync_simple(IClientEntity* e)
  1215. {
  1216. if (!e || e->IsDormant() || !g::pLocalEntity->IsAlive())
  1217. return false;
  1218.  
  1219. for (size_t i = 0; i < g::pLocalEntity->GetNumAnimOverlays(); i++)
  1220. {
  1221. auto layer = g::pLocalEntity->get_anim_overlay_index(i);
  1222. if (!layer)
  1223. continue;
  1224.  
  1225. /*if (e->get_sequence_act(layer->m_nSequence) == 979) */
  1226. {
  1227. if (layer->m_flWeight == 0.0f && (layer->m_flCycle == 0.0f || layer->m_flCycle != layer->m_flPrevCycle))
  1228. return true;
  1229. }
  1230. }
  1231. return false;
  1232. }
  1233. bool breaking_lby_animations(IClientEntity* e)
  1234. {
  1235. if (!e || e->IsDormant() || !g::pLocalEntity->IsAlive())
  1236. return false;
  1237.  
  1238. for (size_t i = 0; i < g::pLocalEntity->GetNumAnimOverlays(); i++)
  1239. {
  1240. auto layer = g::pLocalEntity->get_anim_overlay_index(i);
  1241. // if (g::pLocalEntity->GetSequence(g::pLocalEntity->m_nSequence) == 979)
  1242. {
  1243. if (layer->m_flCycle != layer->m_flCycle || layer->m_flWeight == 1.f)
  1244. return true;
  1245. // }
  1246. }
  1247.  
  1248. return false;
  1249. }
  1250. }
  1251.  
  1252. Vector CalcAngleToEnt(const Vector& vecSource, const Vector& vecDestination)
  1253. {
  1254. Vector qAngles;
  1255. Vector delta = Vector((vecSource[0] - vecDestination[0]), (vecSource[1] - vecDestination[1]), (vecSource[2] - vecDestination[2]));
  1256. float hyp = sqrtf(delta[0] * delta[0] + delta[1] * delta[1]);
  1257. qAngles[0] = (float)(atan(delta[2] / hyp) * (180.0f / M_PI));
  1258. qAngles[1] = (float)(atan(delta[1] / delta[0]) * (180.0f / M_PI));
  1259. qAngles[2] = 0.f;
  1260. if (delta[0] >= 0.f)
  1261. qAngles[1] += 180.f;
  1262.  
  1263. return qAngles;
  1264. }
  1265. float feet_yaw_delta(float first, float second)
  1266. {
  1267. return first - second;
  1268. }
  1269. bool delta_35(float first, float second)
  1270. {
  1271. if (first - second <= 35.f && first - second >= -35.f)
  1272. {
  1273. return true;
  1274. }
  1275. return false;
  1276. }
  1277. bool delta_20(float first, float second)
  1278. {
  1279. if (first - second <= 20.f && first - second >= -20.f)
  1280. {
  1281. return true;
  1282. }
  1283. return false;
  1284. }
  1285. void brute(int stage, IClientEntity* player, float yaw_value, C_BaseEntity* pEnt)
  1286. {
  1287.  
  1288. switch (stage)
  1289. {
  1290. case 0: // no delta check / low jitter
  1291. {
  1292. switch (g::MissedShots[pEnt->EntIndex()] % 3)
  1293. {
  1294. case 0: pEnt->GetEyeAnglesXY()->y -= -yaw_value;
  1295. break;
  1296. case 1: pEnt->GetEyeAnglesXY()->y += -yaw_value;
  1297. break;
  1298. case 2: pEnt->GetEyeAnglesXY()->y -= 45.f;
  1299. break;
  1300. case 3: pEnt->GetEyeAnglesXY()->y += 45.f;
  1301. break;
  1302. case 4: pEnt->GetEyeAnglesXY()->y = yaw_value - 90.f;
  1303. break;
  1304. }
  1305. }
  1306. break;
  1307.  
  1308. case 1: // low delta break / limited jitter
  1309. {
  1310. switch (g::MissedShots[pEnt->EntIndex()] % 3)
  1311. {
  1312. case 0: pEnt->GetEyeAnglesXY()->y += 20.f;
  1313. break;
  1314. case 1: pEnt->GetEyeAnglesXY()->y += 45.f;
  1315. break;
  1316. case 2: pEnt->GetEyeAnglesXY()->y -= 20.f;
  1317. break;
  1318. case 3: pEnt->GetEyeAnglesXY()->y -= 45.f;
  1319. break;
  1320. case 4: pEnt->GetEyeAnglesXY()->y = yaw_value;
  1321. break;
  1322.  
  1323. default: pEnt->GetEyeAnglesXY()->y -= pEnt->GetLowerBodyYaw() - pEnt->GetEyeAnglesXY()->y;
  1324. }
  1325. }
  1326. break;
  1327.  
  1328. case 2: // high delta break / high jitter
  1329. {
  1330. switch (g::MissedShots[pEnt->EntIndex()] % 4)
  1331. {
  1332. case 0: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() - 40.f;
  1333. break;
  1334. case 1: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() + 40.f;
  1335. break;
  1336. case 2: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() - 90.f;
  1337. break;
  1338. case 3: pEnt->GetEyeAnglesXY()->y = yaw_value - 29.f;
  1339. break;
  1340. case 4: pEnt->GetEyeAnglesXY()->y = yaw_value + 29.f;
  1341. break;
  1342. }
  1343. }
  1344. }
  1345. }
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354. void Resolver::resolve_mirror_primary(IClientEntity * player, float yaw_value, C_BaseEntity* pEnt)
  1355. {
  1356. // bool enemy_fake[65] = { false };
  1357. C_BaseCombatWeapon* weapon = (C_BaseCombatWeapon*)g::pLocalEntity->GetActiveWeapon();
  1358.  
  1359. float moving_lby[65] = { FLT_MAX };
  1360. float old_eyes[65] = { FLT_MAX };
  1361. float delta[65] = { FLT_MAX };
  1362. float old_lby[65] = { FLT_MAX };
  1363. float update_time[65] = { FLT_MAX };
  1364. float original_lby[65] = { FLT_MAX };
  1365. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(0);
  1366.  
  1367. bool fake = false;
  1368. bool did_move[65] = { false };
  1369.  
  1370. auto lby_update = pEnt->GetAnimationTime();
  1371.  
  1372. bool is_moving = pPlayerEntity->GetVelocity().Length2D() > 0.1f && (pPlayerEntity->GetFlags() & FL_ONGROUND);
  1373.  
  1374. if (!player || !(pPlayerEntity->GetFlags() & FL_ONGROUND))
  1375. return;
  1376.  
  1377. if (player->IsDormant())
  1378. {
  1379. moving_lby[pEnt->EntIndex()] = { FLT_MAX };
  1380. }
  1381.  
  1382. if (!delta_35(pEnt->GetEyeAngles().y, pEnt->GetLowerBodyYaw()) && g::MissedShots[pEnt->EntIndex()] > 3)
  1383. {
  1384. resolver->enemy_fake[pEnt->EntIndex()] = true;
  1385. fake = true;
  1386. }
  1387. else
  1388. {
  1389. resolver->enemy_fake[pEnt->EntIndex()] = false;
  1390. fake = false;
  1391. }
  1392.  
  1393. auto state = pEnt->GetPlayerAnimationState();
  1394.  
  1395. if (state)
  1396. {
  1397. state->m_flEyeYaw = pEnt->GetEyeAngles().y;
  1398. state->m_flEyePitch = pEnt->GetEyeAngles().x;
  1399. pEnt->setAnimationState(state);
  1400. }
  1401.  
  1402. if (state && state->speed_2d > 0.1f || fabs(state->flUpVelocity) > 100.0f)
  1403. {
  1404. state->m_flGoalFeetYaw = approach_angle(state->m_flEyeYaw, state->m_flGoalFeetYaw,
  1405. ((state->m_flUnknownFraction * 20.0f) + 30.0f) * state->m_flLastClientSideAnimationUpdateTime);
  1406.  
  1407. update_time[pEnt->EntIndex()] = pEnt->GetAnimationTime() + 0.22f;
  1408.  
  1409. pEnt->setAnimationState(state);
  1410. }
  1411. else
  1412. {
  1413. if (state)
  1414. {
  1415. state->m_flGoalFeetYaw = approach_angle(pEnt->GetLowerBodyYaw(), state->m_flGoalFeetYaw,
  1416. state->m_flLastClientSideAnimationUpdateTime * 100.0f);
  1417.  
  1418. update_time[pEnt->EntIndex()] = pEnt->GetAnimationTime() + 1.1f;
  1419.  
  1420. pEnt->setAnimationState(state);
  1421. }
  1422. }
  1423.  
  1424. if (is_moving)
  1425. {
  1426. if (moving_lby[pEnt->EntIndex()] != pEnt->GetLowerBodyYaw())
  1427. moving_lby[pEnt->EntIndex()] = pEnt->GetLowerBodyYaw();
  1428.  
  1429. old_lby[pEnt->EntIndex()] = pEnt->GetLowerBodyYaw();
  1430. did_move[pEnt->EntIndex()] = true;
  1431. }
  1432.  
  1433. float delta_eye_lby = pEnt->GetEyeAngles().y - pEnt->GetLowerBodyYaw();
  1434. float delta_lby;
  1435.  
  1436. if (pPlayerEntity->GetVelocity().Length2D() > 0.1f && (pPlayerEntity->GetFlags() & FL_ONGROUND))
  1437. {
  1438. if (state)
  1439. {
  1440. if (original_lby[pEnt->EntIndex()] == FLT_MAX)
  1441. {
  1442. original_lby[pEnt->EntIndex()] = pEnt->GetLowerBodyYaw();
  1443. }
  1444.  
  1445. if (old_lby[pEnt->EntIndex()] == FLT_MAX)
  1446. {
  1447. old_lby[pEnt->EntIndex()] = pEnt->GetLowerBodyYaw();
  1448. }
  1449. else
  1450. {
  1451. delta_lby = old_lby[pEnt->EntIndex()] - pEnt->GetLowerBodyYaw();
  1452. }
  1453. }
  1454. }
  1455. else
  1456. {
  1457. if (original_lby[pEnt->EntIndex()] != pEnt->GetLowerBodyYaw())
  1458. original_lby[pEnt->EntIndex()] = pEnt->GetLowerBodyYaw();
  1459. }
  1460.  
  1461. #pragma region Alright now we will do the b1g resolve
  1462.  
  1463. float feet_eye = NormalizeYaw180(state->m_flGoalFeetYaw - pEnt->GetEyeAngles().y);
  1464. if (breaking_lby_animations(player))
  1465. {
  1466. if (g::MissedShots[pEnt->EntIndex()] < 2)
  1467. {
  1468. if (delta_35(original_lby[pEnt->EntIndex()], pEnt->GetLowerBodyYaw())) // since 180 jitter with max delta will make the difference between 90º lby and eyes 38
  1469. {
  1470. pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() - delta_eye_lby;
  1471. }
  1472. else
  1473. {
  1474. pEnt->GetEyeAnglesXY()->y = original_lby[pEnt->EntIndex()];
  1475. }
  1476. }
  1477. else
  1478. brute(2, player, original_lby[pEnt->EntIndex()], pEnt);
  1479. /* switch (g::MissedShots[pEnt->EntIndex()] % 4)
  1480. {
  1481. case 0: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() - 40.f;
  1482. break;
  1483. case 1: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() + 40.f;
  1484. break;
  1485. case 2: pEnt->GetEyeAnglesXY()->y = pEnt->GetLowerBodyYaw() - 90.f;
  1486. break;
  1487. case 3: pEnt->GetEyeAnglesXY()->y = yaw_value - 29.f;
  1488. break;
  1489. case 4: pEnt->GetEyeAnglesXY()->y = yaw_value + 29.f;
  1490. break;
  1491. } */
  1492. }
  1493.  
  1494.  
  1495.  
  1496.  
  1497. else
  1498. {
  1499. if (solve_desync_simple(player))
  1500. {
  1501.  
  1502. if (delta_eye_lby > 58.f)
  1503. delta_eye_lby = 58.f;
  1504.  
  1505. if (delta_eye_lby < -58.f)
  1506. delta_eye_lby = -58.f;
  1507.  
  1508. if (g::MissedShots[pEnt->EntIndex()] < 2)
  1509. {
  1510. pEnt->GetEyeAngles() -= delta_eye_lby;
  1511. }
  1512. else
  1513. brute(1, player, pEnt->GetLowerBodyYaw(), pEnt);
  1514. }
  1515. else
  1516. {
  1517.  
  1518. if (g::MissedShots[pEnt->EntIndex()] < 2)
  1519. {
  1520. pEnt->GetEyeAnglesXY()->y -= g::MissedShots[pEnt->EntIndex()] < 1 ? feet_eye : -feet_eye;
  1521. }
  1522. else
  1523. brute(0, player, feet_eye, pEnt);
  1524.  
  1525. }
  1526. g::MissedShots[pEnt->EntIndex()] = g::MissedShots[pEnt->EntIndex()] % 6;
  1527.  
  1528. }
  1529. }
  1530.  
  1531.  
  1532.  
  1533. int C_BaseEntity::get_sequence_act(int sequence)
  1534. {
  1535. auto hdr = g_pModelInfo->GetStudiomodel(this->GetModel());
  1536.  
  1537. if (!hdr)
  1538. return -1;
  1539.  
  1540. static auto get_sequence_activity = reinterpret_cast< int(__fastcall*)(void*, studiohdr_t*, int) >((DWORD)
  1541. Utils::FindSignature("client_panorama.dll", "55 8B EC 53 8B 5D 08 56 8B F1 83"/*"55 8B EC 83 7D 08 FF 56 8B F1 74"*/));
  1542. return get_sequence_activity(this, hdr, sequence);
  1543. }
  1544.  
  1545. /*void Resolver::fatality(IClientEntity * localplayer, IClientEntity * enemy, C_BaseEntity* pEnt )
  1546. {
  1547.  
  1548.  
  1549. auto animstate = pEnt->GetPlayerAnimationState();
  1550. auto animstate = pEnt->AnimState();
  1551. auto local_player = g::pLocalEntity;
  1552. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(0);
  1553. // auto animstate = localplayer->GetBasePlayerAnimState();
  1554. if (animstate)
  1555. { // inlined max_desync_delta
  1556. float v9 = fabs(animstate->m_iLastClientSideAnimationUpdateFramecount - animstate->m_flLastClientSideAnimationUpdateTime);
  1557. float speedfraction = 0.0;
  1558. if (animstate->m_flFeetSpeedForwardsOrSideWays < 0.0)
  1559. speedfraction = 0.0;
  1560. else
  1561. speedfraction = animstate->m_flFeetSpeedForwardsOrSideWays;
  1562.  
  1563. float v2 = (animstate->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
  1564. float v18 = v2;
  1565. float v3 = v2 + 1.0;
  1566. float v23 = v3;
  1567. if (animstate->m_fDuckAmount > 0.0)
  1568. {
  1569. float v29 = 0.0;
  1570. if (animstate->m_flFeetSpeedUnknownForwardOrSideways < 0.0)
  1571. v29 = 0.0;
  1572. else
  1573. v29 = fminf((animstate->m_flFeetSpeedUnknownForwardOrSideways), 0x3F800000);
  1574. }
  1575.  
  1576. if (localplayer)
  1577. {
  1578. for (int i = 1; i < g_pEngine->GetMaxClients(); ++i)
  1579. {
  1580. if (enemy)// dormant
  1581. {
  1582. float v28 = pPlayerEntity->GetEyeAngles().y == 0.0 ? -58 : 58;
  1583. if (v28)
  1584. return;
  1585. float v27 = pPlayerEntity->GetEyeAngles().y == 0.0 ? -89 : 89;
  1586. if (v27)
  1587. return;
  1588. float v26 =pPlayerEntity->GetEyeAngles().y == 0.0 ? -79 : 79;
  1589. if (v26)
  1590. return;
  1591. float v25 = pPlayerEntity->GetEyeAngles().y == 0.0 ? -125 : 125;
  1592. if (v25)
  1593. return;
  1594. float v24 = pPlayerEntity->GetEyeAngles().y == 0.0 ? -78 : 78;
  1595. if (v24)
  1596. return;
  1597. }
  1598. }
  1599. float v8 = 0;
  1600. float v7 = 0;
  1601. float v6 = 0;
  1602. for (size_t i = 0; i < g::pLocalEntity->GetNumAnimOverlays(); i++)
  1603. {
  1604. auto layer = g::pLocalEntity->get_anim_overlay_index(i);
  1605. if (!layer)
  1606. continue;
  1607.  
  1608. if (g::pLocalEntity->get_sequence_act(layer->m_nSequence) == 979 && (layer->m_flPrevCycle) != (layer->m_flCycle))
  1609. v6 = g::pLocalEntity->GetLowerBodyYaw();
  1610. }
  1611. float v20 = (animstate->m_vVelocityX) * v23;
  1612. float a1 = (animstate->m_vVelocityY ) * v23;
  1613. float v30 = 0.0;
  1614. float eye_angles_y = animstate->m_flEyeYaw;
  1615. float goal_feet_yaw = animstate->m_flGoalFeetYaw;
  1616. float v22 = fabs(eye_angles_y - goal_feet_yaw);
  1617. if (v20 < v22)
  1618. {
  1619. float v11 = fabs(v20);
  1620. v30 = eye_angles_y - v11;
  1621. }
  1622. else if (a1 > v22)
  1623. {
  1624. float v12 = fabs(a1);
  1625. v30 = v12 + eye_angles_y;
  1626. }
  1627. float v36 = std::fmodf((v30), 360.0);
  1628. if (v36 > 180.0)
  1629. v36 = v36 - 360.0;
  1630. if (v36 < 180.0)
  1631. v36 = v36 + 360.0;
  1632. animstate->m_flGoalFeetYaw = v36;
  1633. if (g::missedshoted > 2)
  1634. {
  1635. int v19 = g::MissedShots[pEnt->EntIndex()] % 4;
  1636. switch (v19)
  1637. {
  1638. case 0:
  1639. animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 45.0;
  1640. break;
  1641. case 1:
  1642. animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 45.0;
  1643. break;
  1644. case 2:
  1645. animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw - 30.0;
  1646. break;
  1647. case 3:
  1648. animstate->m_flGoalFeetYaw = animstate->m_flGoalFeetYaw + 30.0;
  1649. break;
  1650. default:
  1651. return;
  1652. }
  1653. }
  1654. }
  1655. }
  1656. } */
  1657. void Resolver::Resolve(C_BaseEntity* pEnt, C_BaseEntity* pLocalEnt) {
  1658.  
  1659. if (g_Menu.Config.Resolver)
  1660. return;
  1661.  
  1662. if (pEnt->GetTeam() == g::pLocalEntity->GetTeam())
  1663. return;
  1664.  
  1665. const auto player_animation_state = pEnt->AnimState();
  1666.  
  1667. static float ShotTime[65];
  1668.  
  1669. static float oldSimtime[65];
  1670. static float storedSimtime[65];
  1671.  
  1672. static Vector oldEyeAngles[65];
  1673. static float oldGoalfeetYaw[65];
  1674. static Vector oldOrigin[65];
  1675. auto AnimState = pEnt->AnimState();
  1676. float speedfraction = 0.0;
  1677. if (AnimState->m_flFeetSpeedForwardsOrSideWays < 0.0)
  1678. speedfraction = 0.0;
  1679. else
  1680. speedfraction = AnimState->m_flFeetSpeedForwardsOrSideWays;
  1681. float v2 = (AnimState->m_flStopToFullRunningFraction * -0.30000001 - 0.19999999) * speedfraction;
  1682. float v18 = v2;
  1683. float v3 = v2 + 1.0;
  1684. float v23 = v3;
  1685. float original_lby[65] = { FLT_MAX };
  1686. auto fix_goal_feet_yaw = [](float rotation, float invertedrotation, float yawfeetdelta, float yaw, C_AnimState* state) {
  1687. if (yawfeetdelta < rotation) {
  1688. if (invertedrotation > yawfeetdelta)
  1689. * (float*)(uintptr_t(state) + 0x80) = invertedrotation + yaw;
  1690. }
  1691. else
  1692. *(float*)(uintptr_t(state) + 0x80) = yaw - rotation;
  1693. };
  1694. auto get_rotation = [&](int rotation_type, C_AnimState* state) {
  1695. float v43 = *(float*)((uintptr_t)state + 0xA4);
  1696. float v54 = max(0, min(*reinterpret_cast<float*>((uintptr_t)state + 0xF8), 1));
  1697. float v55 = max(0, min(1, *reinterpret_cast<float*>((uintptr_t)state + 0xFC)));
  1698.  
  1699. float v56;
  1700. v56 = ((*reinterpret_cast<float*>((uintptr_t)state + 0x11C) * -0.30000001) - 0.19999999) * v54;
  1701. if (v43 > 0)
  1702. v56 += ((v43 * v55) * (0.5 - v56));
  1703.  
  1704. v56 = *(float*)((uintptr_t)state + rotation_type) * v56;
  1705. return v56;
  1706. };
  1707.  
  1708. float feet_eye = NormalizeYaw180(AnimState->m_flGoalFeetYaw - pEnt->GetEyeAngles().y);
  1709. float inverted = get_rotation(0x2B4, AnimState);
  1710. float max = get_rotation(0x2B0, AnimState);
  1711. float yawfeetdelta = AnimState->m_flEyeYaw - AnimState->m_flGoalFeetYaw;
  1712. float yaw = pEnt->GetEyeAngles().y;
  1713.  
  1714.  
  1715. float* PosParams = reinterpret_cast<float*>(reinterpret_cast<uintptr_t>(pEnt) + 0x2774);
  1716. bool shot = false;
  1717.  
  1718. if (!player_animation_state)
  1719. return;
  1720.  
  1721.  
  1722. if (pLocalEnt && pLocalEnt->IsAlive())
  1723. {
  1724.  
  1725.  
  1726. float angToLocal = g_Math.NormalizeYaw(g_Math.CalcAngle(pLocalEnt->GetOrigin(), pEnt->GetOrigin()).y);
  1727.  
  1728. float Back = g_Math.NormalizeYaw(angToLocal);
  1729. float DesyncFix = 0;
  1730.  
  1731. float Resim = g_Math.NormalizeYaw((TICKS_TO_TIME(16) / (pEnt->GetSimulationTime() - oldSimtime[pEnt->EntIndex()])) * g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y));
  1732.  
  1733. if (Resim > 60.f)
  1734. Resim = 60.f;
  1735. if (Resim < -60.f)
  1736. Resim = -60.f;
  1737.  
  1738. if (g_Menu.Config.Resolver && !shot && !isnan(angToLocal) && !isinf(angToLocal) && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam())
  1739. {
  1740.  
  1741. fix_goal_feet_yaw(max, inverted, yawfeetdelta, yaw, AnimState);
  1742. pEnt->AnimState()->m_flGoalFeetYaw = AnimState->m_flGoalFeetYaw;
  1743.  
  1744.  
  1745. float m_flLastClientSideAnimationUpdateTimeDelta = fabs(player_animation_state->m_iLastClientSideAnimationUpdateFramecount - player_animation_state->m_flLastClientSideAnimationUpdateTime);
  1746.  
  1747. auto v48 = 0.f;
  1748.  
  1749. if (player_animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  1750. {
  1751. v48 = fminf(player_animation_state->m_flFeetSpeedForwardsOrSideWays, 1.0f);
  1752. }
  1753. else
  1754. {
  1755. v48 = 0.0f;
  1756. }
  1757.  
  1758. float v49 = ((player_animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
  1759.  
  1760. float flYawModifier = v49 + 1.0;
  1761.  
  1762. if (player_animation_state->m_fDuckAmount > 0.0)
  1763. {
  1764. float v53 = 0.0f;
  1765.  
  1766. if (player_animation_state->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  1767. {
  1768. v53 = fminf(player_animation_state->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  1769. }
  1770. else
  1771. {
  1772. v53 = 0.0f;
  1773. }
  1774. }
  1775.  
  1776. float flMaxYawModifier = player_animation_state->pad10[516] * flYawModifier;
  1777. float flMinYawModifier = player_animation_state->pad10[512] * flYawModifier;
  1778.  
  1779. float newFeetYaw = 0.f;
  1780.  
  1781. auto eyeYaw = player_animation_state->m_flEyeYaw;
  1782.  
  1783. auto lbyYaw = player_animation_state->m_flGoalFeetYaw;
  1784.  
  1785.  
  1786. float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  1787.  
  1788. if (eye_feet_delta <= flMaxYawModifier)
  1789. {
  1790. if (flMinYawModifier > eye_feet_delta)
  1791. {
  1792. eyeYaw -= fabs(flMinYawModifier) + eye_feet_delta;
  1793. }
  1794. }
  1795.  
  1796. if (lbyYaw > newFeetYaw) // if lby is greater than his feet
  1797. {
  1798. if (eyeYaw < lbyYaw)
  1799. {
  1800. if (newFeetYaw >= flMaxYawModifier)
  1801. {
  1802. lbyYaw -= eye_feet_delta + fabs(flMinYawModifier);
  1803. }
  1804. }
  1805. }
  1806.  
  1807. if (flMaxYawModifier > newFeetYaw)
  1808. {
  1809. if (eye_feet_delta < flMinYawModifier)
  1810. {
  1811. newFeetYaw += fabs(flMaxYawModifier) - eyeYaw;
  1812. }
  1813. }
  1814. else {
  1815. eyeYaw -= eye_feet_delta + lbyYaw;
  1816. }
  1817.  
  1818. float v136 = fmod(newFeetYaw, 360.0);
  1819.  
  1820. if (v136 > 90.0)
  1821. {
  1822. v136 = v136 - 180.0;
  1823. }
  1824.  
  1825. if (v136 < 90.0)
  1826. {
  1827. v136 = v136 + 180.0;
  1828. }
  1829.  
  1830. player_animation_state->m_flGoalFeetYaw = v136;
  1831.  
  1832. float AntiSide = 0.f;
  1833.  
  1834. if (g::MissedShots[pEnt->EntIndex()] % 2)
  1835. {
  1836. if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Back) > 0.f)
  1837. AntiSide = -90.f;
  1838. else if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Back) < 0.f)
  1839. AntiSide = 90.f;
  1840. }
  1841. else
  1842. {
  1843. if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - g_Math.NormalizeYaw(Back + 90)) > 0.f)
  1844. AntiSide = 180.f;
  1845. else if (g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - g_Math.NormalizeYaw(Back + 90)) < 0.f)
  1846. AntiSide = 0.f;
  1847. }
  1848.  
  1849. float Brute = g_Math.NormalizeYaw(Back + AntiSide);
  1850. float Delta = g_Math.NormalizeYaw(g_Math.NormalizeYaw(Brute - pEnt->GetEyeAngles().y) + Resim);
  1851.  
  1852. if (Delta > 60.f) // who needs clamps
  1853. Delta = 60.f;
  1854. if (Delta < -60.f)
  1855. Delta = -60.f;
  1856.  
  1857. Resim += Delta;
  1858. DesyncFix += Delta;
  1859.  
  1860. if (Resim > 60.f)
  1861. Resim = 60.f;
  1862. if (Resim < -60.f)
  1863. Resim = -60.f;
  1864. }
  1865.  
  1866. float Equalized;
  1867.  
  1868. // if (fabs(g_Math.NormalizeYaw(oldEyeAngles[pEnt->EntIndex()].y - pEnt->GetEyeAngles().y)) < 60.f) // yea basically im retarded
  1869. Equalized = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y + Resim);
  1870. // else
  1871. // Equalized = g_Math.NormalizeYaw(pEnt->GetEyeAngles().y - Resim);
  1872.  
  1873. if (g_Menu.Config.Resolver && !shot && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam() && (pEnt->GetFlags() & FL_ONGROUND))
  1874. AnimState->m_flGoalFeetYaw = Equalized;
  1875. } //b resolver?
  1876.  
  1877. if (shot && pEnt != pLocalEnt && pEnt->GetTeam() != pLocalEnt->GetTeam() && PosParams[12] <= -80) // ez shot pitch fix LMAO
  1878. PosParams[12] = 89.f;
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889. // Up There is The Original Resolver
  1890. // In Order To Have A Good Anti Aim Resolver CounterMeasure
  1891. // You Need To Know How Anti Aim Works
  1892. // Of Course You Know How It Works Understand What These Codes Do
  1893. // Then You Can Understand And Add Your Own Code To Your Desire
  1894. // But Be Careful Adding Simple Conditions Or Same Conditions With Different Countermeasures
  1895. // And Those That Are Positive And Negative Conditions As This Will Be On A Loop Resolver Which Is Not Good
  1896. // So Make It Specific As Possible Like 2 Conditions To Be Sure
  1897. // Also Keep A Eye On The Conditions If You Spotted Same Things As This Will Likely Be A Bad Resolver
  1898. // 2nd Note: Make It Very Specific If You Want To Resolve Desync Statics Like I Do
  1899. // 3rd Note 7/18/2019: Dont Make Your Resolver Overreact on Keeping It Resolving
  1900. // 4rd Note: If You See Your Enemy Twitching Then Theres 2 Codes Overlapping
  1901.  
  1902.  
  1903.  
  1904. if (g::missedshoted > 4)
  1905. {
  1906. int v19 = g::MissedShots[pEnt->EntIndex()] % 4;
  1907. switch (v19)
  1908. {
  1909. case 0:
  1910. player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 45.0;
  1911. break;
  1912. case 1:
  1913. player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 45.0;
  1914. break;
  1915. case 2:
  1916. player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw - 30.0;
  1917. break;
  1918. case 3:
  1919. player_animation_state->m_flGoalFeetYaw = player_animation_state->m_flGoalFeetYaw + 30.0;
  1920. break;
  1921. default:
  1922. return;
  1923. }
  1924.  
  1925. // g::MissedShots[pEnt->EntIndex()] = g::MissedShots[pEnt->EntIndex()] % 6; // so it just doesn't brute all the fucking time, that's dumb.
  1926. }
  1927. }
  1928.  
  1929. void HandleHits(C_BaseEntity* pEnt)
  1930. {
  1931. auto NetChannel = g_pEngine->GetNetChannelInfo();
  1932.  
  1933. if (!NetChannel)
  1934. return;
  1935.  
  1936. static float predTime[60];
  1937. static bool init[60];
  1938.  
  1939.  
  1940. if (g::Shot[pEnt->EntIndex()])
  1941. {
  1942. if (init[pEnt->EntIndex()])
  1943. {
  1944. g_Resolver.pitchHit[pEnt->EntIndex()] = pEnt->GetEyeAngles().x;
  1945. predTime[pEnt->EntIndex()] = g_pGlobalVars->curtime + NetChannel->GetAvgLatency(FLOW_INCOMING) + NetChannel->GetAvgLatency(FLOW_OUTGOING) + TICKS_TO_TIME(1) + TICKS_TO_TIME(g_pEngine->GetNetChannel()->choked_packets);
  1946. init[pEnt->EntIndex()] = false;
  1947. }
  1948.  
  1949. if (g_pGlobalVars->curtime > predTime[pEnt->EntIndex()] && !g::Hit[pEnt->EntIndex()])
  1950. {
  1951. g::MissedShots[pEnt->EntIndex()] += 1;
  1952. g::Shot[pEnt->EntIndex()] = false;
  1953. }
  1954. else if (g_pGlobalVars->curtime <= predTime[pEnt->EntIndex()] && g::Hit[pEnt->EntIndex()])
  1955. g::Shot[pEnt->EntIndex()] = false;
  1956.  
  1957. }
  1958. else
  1959. init[pEnt->EntIndex()] = true;
  1960.  
  1961. g::Hit[pEnt->EntIndex()] = false;
  1962. }
  1963.  
  1964.  
  1965. /*void HandleHits( C_BaseEntity * pEnt )
  1966. {
  1967. auto NetChannel = g_pEngine->GetNetChannelInfo( );
  1968.  
  1969. if ( !NetChannel )
  1970. return;
  1971.  
  1972. static float predTime[ 65 ];
  1973. static bool init[ 65 ];
  1974.  
  1975. if ( g::Shot[ pEnt->EntIndex( ) ] )
  1976. {
  1977. if ( init[ pEnt->EntIndex( ) ] )
  1978. {
  1979. predTime[ pEnt->EntIndex( ) ] = g_pGlobalVars->curtime + NetChannel->GetAvgLatency( FLOW_INCOMING ) + NetChannel->GetAvgLatency( FLOW_OUTGOING ) + TICKS_TO_TIME( 1 ) + TICKS_TO_TIME( g_pEngine->GetNetChannel( )->choked_packets );
  1980. init[ pEnt->EntIndex( ) ] = false;
  1981. }
  1982.  
  1983. if ( g_pGlobalVars->curtime > predTime[ pEnt->EntIndex( ) ] && !g::Hit[ pEnt->EntIndex( ) ] )
  1984. {
  1985. g::MissedShots[ pEnt->EntIndex( ) ] += 1;
  1986. g::Shot[ pEnt->EntIndex( ) ] = false;
  1987. }
  1988. else if ( g_pGlobalVars->curtime <= predTime[ pEnt->EntIndex( ) ] && g::Hit[ pEnt->EntIndex( ) ] ) {
  1989. g::Shot[ pEnt->EntIndex( ) ] = false; // missed shot due to spread (?) - no
  1990. }
  1991. }
  1992. else
  1993. init[ pEnt->EntIndex( ) ] = true;
  1994.  
  1995. g::Hit[ pEnt->EntIndex( ) ] = false;
  1996. } */
  1997.  
  1998. inline float ClampYaw( float yaw )
  1999. {
  2000. while ( yaw > 180.f )
  2001. yaw -= 360.f;
  2002. while ( yaw < -180.f )
  2003. yaw += 360.f;
  2004. return yaw;
  2005. }
  2006.  
  2007. void Override( C_BaseEntity * pEnt )
  2008. {
  2009. if ( !g_Menu.Config.Resolver || !g_Menu.Config.ResolverOverride )
  2010. return;
  2011.  
  2012. if ( !GetAsyncKeyState( g_Menu.Config.override_resolver_key ) )
  2013. return;
  2014.  
  2015. if (!g::pLocalEntity || !g::pLocalEntity->IsAlive())
  2016. return;
  2017.  
  2018. Vector viewangles;
  2019. g_pEngine->GetViewAngles( viewangles );
  2020.  
  2021. auto at_target_yaw = g_Math.CalcAngle( pEnt->GetOrigin( ),
  2022. g::pLocalEntity->GetOrigin( ) ).y;
  2023. auto delta = ClampYaw( viewangles.y - at_target_yaw );
  2024.  
  2025. if ( delta > 0 )
  2026. pEnt->SetEyeAngles( Vector( pEnt->GetEyeAngles( ).x, at_target_yaw + 90, 0 ) );
  2027. else
  2028. pEnt->SetEyeAngles( Vector( pEnt->GetEyeAngles( ).x, at_target_yaw - 90, 0 ) );
  2029. }
  2030.  
  2031. void Resolver::FrameStage( ClientFrameStage_t stage )
  2032. {
  2033. if ( !g::pLocalEntity || !g_pEngine->IsInGame( ) || !g_pEngine->IsConnected( ) )
  2034. return;
  2035.  
  2036. if ( !g_Menu.Config.Resolver )
  2037. return;
  2038.  
  2039. if (!g_Menu.Config.Resolver2)
  2040. return;
  2041.  
  2042. if (!g_Menu.Config.Resolvertest)
  2043. return;
  2044.  
  2045. if (!g_Menu.Config.Resolve1)
  2046. return;
  2047.  
  2048. // if (!g_Menu.Config.Resolverfata)
  2049. // return;
  2050.  
  2051. //if (!g_Menu.Config.Resolverfata)
  2052. // return;
  2053.  
  2054. /*if (!g_Menu.Config.Resolver2)
  2055. return; */
  2056.  
  2057. for ( int i = 1; i < g_pEngine->GetMaxClients( ); ++i )
  2058. {
  2059. C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity( i );
  2060. // IClientEntity* player;
  2061.  
  2062. if ( !pPlayerEntity
  2063. || !pPlayerEntity->IsAlive( ) )
  2064. continue;
  2065.  
  2066. if ( pPlayerEntity->IsDormant( ) ) {
  2067. continue;
  2068. }
  2069. float yaw_value = 0;
  2070.  
  2071. if (stage == FRAME_RENDER_START)
  2072. {
  2073. IClientEntity* player;
  2074. C_BaseEntity* pLocalEnt;
  2075.  
  2076. //Resolve1(pPlayerEntity, pLocalEnt);
  2077. // Resolve(pPlayerEntity, player);
  2078. HandleHits(pPlayerEntity);
  2079. // AnimationFix(pPlayerEntity, pLocalEnt);
  2080. //AnimationFix2(pPlayerEntity, pLocalEnt);
  2081. //ResolverB(pPlayerEntity);
  2082. AnimationFix(pPlayerEntity, pLocalEnt);
  2083. }
  2084.  
  2085. if (stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START) {
  2086. //if ( stage == FRAME_RENDER_START ) {
  2087. // C_BaseEntity* pPlayerEntity = g_pEntityList->GetClientEntity(i);
  2088. C_BaseEntity* pLocalEnt;
  2089. IClientEntity* localplayer;
  2090. IClientEntity* enemy;
  2091. IClientEntity* player;
  2092. //HandleHits( pPlayerEntity );
  2093. Resolve( pPlayerEntity, pLocalEnt);
  2094. //resolvepitch(pPlayerEntity);
  2095. //resolve_mirror_primary(player, yaw_value, pPlayerEntity);
  2096. //ResolverB(pPlayerEntity, player);
  2097. //Resolve1(pPlayerEntity, pLocalEnt);
  2098.  
  2099. // fatality(localplayer, enemy, pPlayerEntity);
  2100. //AnimationFix(pPlayerEntity, pLocalEnt);
  2101. // AnimationFix2(pPlayerEntity);
  2102. //Resolve1(pPlayerEntity, pLocalEnt);
  2103.  
  2104.  
  2105. }
  2106. /*else if ( stage == FRAME_NET_UPDATE_POSTDATAUPDATE_START ) {
  2107. Override( pPlayerEntity );
  2108. }*/
  2109. }
  2110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement