Advertisement
Guest User

memmemememe

a guest
May 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.10 KB | None | 0 0
  1. int resolve_type[65];
  2. bool using_fake_angles[65];
  3. bool UseFreestandAngle[65];
  4. float FreestandAngle[65];
  5. bool has_been_initialized = false;
  6. void c_player_resolver::run() {
  7. if (!g_cfg.ragebot.antiaim_correction || !g_ctx.m_local->is_alive())
  8. return;
  9.  
  10. static bool first_execute[65];
  11. for (int i = 1; i <= 64; i++) {
  12. player_t* entity = reinterpret_cast<player_t*>(g_csgo.m_entitylist()->GetClientEntity(i));
  13.  
  14.  
  15. player_info_t info;
  16. g_csgo.m_engine()->GetPlayerInfo(m_e->EntIndex(), &info);
  17.  
  18. update();
  19. lby_prediction();
  20. pitch_resolve();
  21.  
  22. m_previous = m_current;
  23. m_has_previous = true;
  24.  
  25. if (entity == g_ctx.m_local) {
  26. animation_fix(entity);
  27. continue;
  28. }
  29.  
  30. if (!entity->valid(true, true))
  31. continue;
  32.  
  33. if (!has_been_initialized) {
  34. if (i = 64)
  35. has_been_initialized = true;
  36. first_execute[i] = true;
  37. }
  38. update_record(current_record[i], entity);
  39.  
  40. if (is_slow_walking(current_record[i], last_record[i].back(), (g_csgo.m_globals()->m_curtime - entity->m_flSimulationTime()) + g_csgo.m_globals()->m_interval_per_tick))
  41. compensate_for_slow_walk(entity, current_record[i].velocity);
  42.  
  43. find_viable_record(current_record[i], last_record[i].back());
  44. animation_fix(entity);
  45.  
  46.  
  47. if ((current_record[i].simtime - last_record[i].back().simtime) == g_csgo.m_globals()->m_interval_per_tick)
  48. return;
  49.  
  50. resolve(current_record[i], last_record[i].back(), entity);
  51. }
  52. }
  53. int total_missed[64];
  54. int total_hit[64];
  55.  
  56. void c_player_resolver::create_move(vec3_t latency_based_eye_pos) {
  57. if (!g_cfg.ragebot.antiaim_correction)
  58. return;
  59.  
  60. player_t * e = m_e;
  61.  
  62. const float height = 64;
  63.  
  64. Vector direction_1, direction_2;
  65. math::angle_vectors(vec3_t(0.f, math::calculate_angle(g_ctx.m_local->m_vecOrigin(), e->m_vecOrigin()).y - 90.f, 0.f), direction_1);
  66. math::angle_vectors(vec3_t(0.f, math::calculate_angle(g_ctx.m_local->m_vecOrigin(), e->m_vecOrigin()).y + 90.f, 0.f), direction_2);
  67.  
  68. const auto left_eye_pos = e->m_vecOrigin() + Vector(0, 0, height) + (direction_1 * 16.f);
  69. const auto right_eye_pos = e->m_vecOrigin() + Vector(0, 0, height) + (direction_2 * 16.f);
  70.  
  71. m_antifreestand.left_damage = autowall::get().calculate_return_info(latency_based_eye_pos, left_eye_pos, g_ctx.m_local, e, 1).m_damage;
  72. m_antifreestand.right_damage = autowall::get().calculate_return_info(latency_based_eye_pos, right_eye_pos, g_ctx.m_local, e, 1).m_damage;
  73.  
  74. Ray_t ray;
  75. trace_t trace;
  76. CTraceFilterWorldOnly filter;
  77.  
  78. ray.Init(left_eye_pos, latency_based_eye_pos);
  79. g_csgo.m_trace()->TraceRay(ray, MASK_ALL, &filter, &trace);
  80. m_antifreestand.left_fraction = trace.fraction;
  81.  
  82. ray.Init(right_eye_pos, latency_based_eye_pos);
  83. g_csgo.m_trace()->TraceRay(ray, MASK_ALL, &filter, &trace);
  84. m_antifreestand.right_fraction = trace.fraction;
  85.  
  86. }
  87. void c_player_resolver::lby_prediction() {
  88. static float next_lby_update[65];
  89.  
  90. resolver_info_t
  91. & current = m_current,
  92. &previous = m_previous;
  93. player_t * e = m_e;
  94.  
  95. if (e->IsDormant()) {
  96. current.m_predicted_flick = false;
  97. current.m_flick = false;
  98. g_ctx.m_globals.add_time[e->EntIndex()] = 0.f;
  99. g_ctx.m_globals.next_update[e->EntIndex()] = 0.f;
  100. next_lby_update[e->EntIndex()] = 0.f;
  101. }
  102.  
  103. if (e->get_animtime() >= next_lby_update[e->EntIndex()] && !e->IsDormant())
  104. {
  105. current.m_predicted_flick = true;
  106. g_ctx.m_globals.add_time[e->EntIndex()] = 1.1f;
  107. next_lby_update[e->EntIndex()] = e->get_animtime() + g_ctx.m_globals.add_time[e->EntIndex()];
  108. g_ctx.m_globals.next_update[e->EntIndex()] = next_lby_update[e->EntIndex()];
  109. }
  110. else
  111. current.m_predicted_flick = false;
  112.  
  113. if (current.m_lowerbody != e->m_flLowerBodyYawTarget() && !e->IsDormant())
  114. {
  115. current.m_flick = true;
  116. g_ctx.m_globals.add_time[e->EntIndex()] = g_csgo.m_globals()->m_interval_per_tick + 1.1f;
  117. next_lby_update[e->EntIndex()] = e->get_animtime() + g_ctx.m_globals.add_time[e->EntIndex()];
  118. g_ctx.m_globals.next_update[e->EntIndex()] = next_lby_update[e->EntIndex()];
  119. }
  120. else
  121. current.m_flick = false;
  122.  
  123. if (current.m_velocity.Length2D() > 0.1f && !current.m_fakewalking && !e->IsDormant()) {
  124. g_ctx.m_globals.add_time[e->EntIndex()] = 0.22f;
  125. next_lby_update[e->EntIndex()] = e->get_animtime() + g_ctx.m_globals.add_time[e->EntIndex()];
  126. g_ctx.m_globals.next_update[e->EntIndex()] = next_lby_update[e->EntIndex()];
  127. }
  128. }
  129.  
  130. void c_player_resolver::update() {
  131. resolver_info_t
  132. & current = m_current,
  133. &previous = m_previous;
  134. player_t * e = m_e;
  135.  
  136. m_mode = resolver_modes::anti_freestand;
  137.  
  138. int i = e->EntIndex();
  139. current.m_velocity = e->m_vecVelocity();
  140. current.m_origin = e->m_vecOrigin();
  141. current.m_lowerbody = e->m_flLowerBodyYawTarget();
  142. current.m_flags = e->m_fFlags();
  143. current.m_dormant = e->IsDormant();
  144. static bool isstatic[65];
  145. float moving_sim;
  146. static float nextlbyupdate[65];
  147. current.back = vec3_t(e->m_angEyeAngles().x, math::calculate_angle(e->m_vecOrigin(), g_ctx.m_local->m_vecOrigin()).y + 180.f, 0.f);
  148. current.right = vec3_t(e->m_angEyeAngles().x, math::calculate_angle(e->m_vecOrigin(), g_ctx.m_local->m_vecOrigin()).y + 70.f + ((rand() % 40) - (40 * 0.5f)), 0.f);
  149. current.left = vec3_t(e->m_angEyeAngles().x, math::calculate_angle(e->m_vecOrigin(), g_ctx.m_local->m_vecOrigin()).y - 70.f + ((rand() % 40) - (40 * 0.5f)), 0.f);
  150. const bool moving_on_ground = current.m_velocity.Length2D() > 0.1 && current.m_flags & FL_ONGROUND;
  151. current.m_at_target = math::calculate_angle(g_ctx.m_local->m_vecOrigin(), current.m_origin).y;
  152. current.m_balance_adjust_triggered = false, current.m_balance_adjust_triggered = false;
  153. auto activity = e->sequence_activity(e->get_animlayer(3).m_nSequence);
  154.  
  155.  
  156. if (e->m_flSimulationTime() >= m_current.m_next_predicted_lby_update)
  157. {
  158. m_current.did_predicted_lby_flick = true;
  159. m_current.m_next_predicted_lby_update = e->m_flSimulationTime() + 1.1f;
  160. }
  161. else
  162. m_current.did_predicted_lby_flick = false;
  163. if (m_current.m_lowerbody != m_previous.m_lowerbody &&
  164. fabs(math::normalize_yaw(m_current.m_lowerbody - m_previous.m_lowerbody)) > 5.f &&
  165. !m_current.m_dormant &&
  166. !m_previous.m_dormant &&
  167. !m_current.m_last_move_lby &&
  168. !m_current.m_last_moving_lby_delta &&
  169. !m_previous.m_lowerbody)
  170.  
  171. {
  172. m_current.m_did_lby_flick = true;
  173. m_current.m_last_move_lby = e->m_flSimulationTime();
  174. m_current.m_predicted_flick = e->m_flSimulationTime();
  175. m_current.m_next_predicted_lby_update = e->m_flSimulationTime() + m_current.m_last_move_lby + 1.1f;
  176.  
  177. }
  178.  
  179. if (m_current.m_velocity.Length2D() > 0.6f && !m_current.m_fakewalking)
  180. m_current.m_next_predicted_lby_update = e->m_flSimulationTime() + 0.22f;
  181.  
  182. if (moving_on_ground && !current.m_fakewalking)
  183. {
  184. current.m_last_move_lby = current.m_lowerbody;
  185. moving_sim = e->m_flSimulationTime();
  186. }
  187.  
  188. update_fakewalk_data(current, e);
  189. triggers_979(e);
  190.  
  191. if (g_csgo.m_inputsys()->IsButtonDown(g_cfg.ragebot.override_key))
  192. m_mode = resolver_modes::override;
  193.  
  194. if (math::normalize_pitch(current.m_pitch) > 5.f)
  195. current.last_pitchdown = g_csgo.m_globals()->m_curtime;
  196. }
  197.  
  198. bool c_player_resolver::is_slow_walking(c_resolver_info record1, c_resolver_info record2, float accuracy) {
  199. vec3_t prev_vel;
  200. static float prev_time = 0.f;
  201. if (prev_time < accuracy) {
  202. prev_vel = record1.velocity;
  203. prev_time = record2.simtime + 0.75;
  204. }
  205. else {
  206. if (record1.velocity != prev_vel)
  207. return false;
  208. else
  209. return true;
  210. }
  211. }
  212. void c_player_resolver::update_fakewalk_data(resolver_info_t & current, player_t * e) {
  213. resolver_info_t previous = m_previous;
  214.  
  215. AnimationLayer anim_layers[15];
  216. bool s_1 = false,
  217. s_2 = false,
  218. s_3 = false;
  219.  
  220. for (int i = 0; i < e->animlayer_count(); i++)
  221. {
  222. anim_layers[i] = e->get_animlayers()[i];
  223. if (anim_layers[i].m_nSequence == 26 && anim_layers[i].m_flWeight < 0.4f)
  224. s_1 = true;
  225. if (anim_layers[i].m_nSequence == 7 && anim_layers[i].m_flWeight > 0.001f)
  226. s_2 = true;
  227. if (anim_layers[i].m_nSequence == 2 && anim_layers[i].m_flWeight == 0)
  228. s_3 = true;
  229. }
  230.  
  231. if (s_1 && s_2)
  232. if (s_3 || (e->m_fFlags() & FL_DUCKING))
  233. current.m_fakewalking = true;
  234. else
  235. current.m_fakewalking = false;
  236. else
  237. current.m_fakewalking = false;
  238. }
  239. bool find_layer(player_t * e, int act, AnimationLayer *set)
  240. {
  241. for (int i = 0; i < 13; i++)
  242. {
  243. AnimationLayer layer = e->get_animlayer(i);
  244. const int activity = e->sequence_activity(layer.m_nSequence);
  245. if (activity == act) {
  246. *set = layer;
  247. return true;
  248. }
  249. }
  250. return false;
  251. }
  252. bool triggers_981(player_t *e)
  253. {
  254. int seq_activity[64];
  255.  
  256. for (int j = 0; j < 13; j++)
  257. {
  258. seq_activity[e->EntIndex()] = e->sequence_activity(e->get_animlayer(j).m_nSequence);
  259.  
  260. if (seq_activity[e->EntIndex()] == 981 && e->get_animlayer(j).m_flWeight == 1)
  261. {
  262. return true;
  263. }
  264. }
  265.  
  266. return false;
  267. }
  268. bool c_player_resolver::IsAdjustingBalance(player_t *player, ResolveInfo &record, AnimationLayer *layer)
  269. {
  270. for (int i = 0; i < record.m_iLayerCount; i++)
  271. {
  272. const int activity = player->sequence_activity(record.animationLayer[i].m_nSequence);
  273. if (activity == 979)
  274. {
  275. *layer = record.animationLayer[i];
  276. return true;
  277. }
  278. }
  279. return false;
  280. }
  281. void c_player_resolver::triggers_979(player_t *e)
  282. {
  283. int seq_activity[64];
  284.  
  285. for (int j = 0; j < 13; j++)
  286. {
  287. seq_activity[e->EntIndex()] = e->sequence_activity(e->get_animlayer(j).m_nSequence);
  288.  
  289. if (seq_activity[e->EntIndex()] == 979 && e->get_animlayer(j).m_flWeight == 0.f && e->get_animlayer(j).m_flCycle > .92f)
  290. {
  291. is_fake = true;
  292. }
  293. }
  294. }
  295. bool c_player_resolver::is_slow_walking(player_t * e) {
  296. float velocity_2D[64], old_velocity_2D[64];
  297.  
  298. if (e->m_vecVelocity().Length2D() != velocity_2D[e->EntIndex()] && e->m_vecVelocity().Length2D() != NULL) {
  299. old_velocity_2D[e->EntIndex()] = velocity_2D[e->EntIndex()];
  300. velocity_2D[e->EntIndex()] = e->m_vecVelocity().Length2D();
  301. }
  302. if (velocity_2D[e->EntIndex()] > 0.1f || 0.4f) {
  303. int tick_counter[64];
  304.  
  305. if (velocity_2D[e->EntIndex()] == old_velocity_2D[e->EntIndex()])
  306. ++tick_counter[e->EntIndex()];
  307. else
  308. tick_counter[e->EntIndex()] = 0;
  309.  
  310. while (tick_counter[e->EntIndex()] > (1 / g_csgo.m_globals()->m_interval_per_tick) * fabsf(0.1f || 0.4f))
  311. return true;
  312. }
  313. return false;
  314. }
  315.  
  316. float flAngleMod(float flAngle)
  317. {
  318. return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
  319. }
  320.  
  321. float ApproachAngle(float target, float value, float speed) //angles to approach
  322. {
  323. target = flAngleMod(target);
  324. value = flAngleMod(value);
  325.  
  326. float delta = target - value;
  327.  
  328. // Speed is assumed to be positive
  329. if (speed < 0)
  330. speed = -speed;
  331.  
  332. if (delta < -180)
  333. delta += 360;
  334. else if (delta > 180)
  335. delta -= 360;
  336.  
  337. if (delta > speed)
  338. value += speed;
  339. else if (delta < -speed)
  340. value -= speed;
  341. else
  342. value = target;
  343.  
  344. return value;
  345. }
  346. float compare_angle_dist(float mainang, float ang1, float ang2, float ang3 = 0) // for compare angle distance
  347. {
  348. return max(std::abs(ang1 - mainang), std::abs(ang2 - mainang));
  349. }
  350. bool float_near(float v1, float v2, float tolerance) {
  351. return std::abs(v1 - v2) <= std::abs(tolerance);
  352. }
  353. bool solve_desync_simple(player_t* e) // 979 animation
  354. {
  355. if (!e || e->IsDormant() || !e->is_alive())
  356. return false;
  357.  
  358. for (size_t i = 0; i < e->NumOverlays(); i++)
  359. {
  360. auto layer = e->get_anim_overlay_index(i);
  361. if (!layer)
  362. continue;
  363.  
  364. if (e->GetSequenceActivity(layer->m_nSequence) == 979)
  365. {
  366. if (layer->m_flWeight == 0.0f && (layer->m_flCycle == 0.0f || layer->m_flCycle != layer->m_flPrevCycle))
  367. return true;
  368. }
  369. }
  370. return false;
  371. }
  372. float NormalizeYaw180(float yaw)
  373. {
  374. if (yaw > 180)
  375. yaw -= (round(yaw / 360) * 360.f);
  376. else if (yaw < -180)
  377. yaw += (round(yaw / 360) * -360.f);
  378.  
  379. return yaw;
  380. }
  381. float NormalizeX(float yaw)
  382. {
  383. if (yaw != yaw)
  384. yaw = 0.f;
  385.  
  386. return fmod(yaw + 180.f, 360.f) - 180.f;
  387. }
  388.  
  389. float approach(float cur, float target, float inc) {
  390. inc = abs(inc);
  391.  
  392. if (cur < target)
  393. return min(cur + inc, target);
  394. if (cur > target)
  395. return max(cur - inc, target);
  396.  
  397. return target;
  398. }
  399. bool delta_58(float first, float second)
  400. {
  401. if (first - second < 58.f && first - second > -58.f)
  402. {
  403. return true;
  404. }
  405. return false;
  406. }
  407. float angle_difference(float a, float b) {
  408. auto diff = NormalizeYaw180(a - b);
  409.  
  410. if (diff < 180)
  411. return diff;
  412. return diff - 360;
  413. }
  414. bool delta_35(float first, float second)
  415. {
  416. if (first - second <= 35.f && first - second >= -35.f)
  417. {
  418. return true;
  419. }
  420. return false;
  421. }
  422. float approach_angle(float cur, float target, float inc) {
  423. auto diff = angle_difference(target, cur);
  424. return approach(cur, cur + diff, inc);
  425. }
  426. void c_player_resolver::resolve(c_resolver_info record1, c_resolver_info record2, player_t* e)
  427. {
  428.  
  429. ////
  430. resolver_info_t current = m_current, previous = m_previous;
  431. ////
  432.  
  433. static float oldSimtime[65];
  434. static float storedSimtime[65];
  435. static float ShotTime[65];
  436. static float SideTime[65][3];
  437. static int LastDesyncSide[65];
  438. bool UseFreestandAngle[65];
  439. static bool Delaying[65];
  440. static AnimationLayer StoredLayers[64][15];
  441. static c_baseplayeranimationstate * StoredAnimState[65];
  442. static float StoredPosParams[65][24];
  443. static Vector oldEyeAngles[65];
  444. static float oldGoalfeetYaw[65];
  445. float FreestandAngle[65];
  446. float* PosParams = (float*)((uintptr_t)e + 0x2774);
  447. bool update = false;
  448. bool shot = false;
  449. static bool jittering[65];
  450. auto animation_state = e->get_animation_state();
  451. auto feet_yaw = animation_state->m_flCurrentFeetYaw;
  452. float body_yaw = 58.f; animation_state->m_flCurrentTorsoYaw;
  453. auto move_yaw = 29.f;
  454. auto goal_feet_yaw = animation_state->m_flGoalFeetYaw;
  455. auto shit = body_yaw - feet_yaw;
  456. auto shitv2 = body_yaw + feet_yaw;
  457. auto poses = e->m_flPoseParameter();
  458. float feet_yaw_rate = animation_state->m_flFeetYawRate;
  459. float fff = animation_state->m_flFeetSpeedForwardsOrSideWays;
  460. float forwardorsideways = animation_state->m_flFeetSpeedUnknownForwardOrSideways;
  461. float feet_cucle = animation_state->m_flFeetCycle;
  462. float headheighanimation = animation_state->m_flHeadHeightOrOffsetFromHittingGroundAnimation;
  463. float new_body_yaw = animation_state->m_flCurrentTorsoYaw;
  464. auto body_max_rotation = animation_state->pad10[516];
  465. auto normalized_eye_abs_yaw_diff = fmod((animation_state->m_flEyeYaw - feet_yaw), 360.0);
  466. auto body_min_rotation = animation_state->pad10[512];
  467. float newFeetYaw = 0.f;
  468. auto eyeYaw = e->get_animation_state()->m_flEyeYaw;
  469. auto lbyYaw = e->get_animation_state()->m_flGoalFeetYaw;
  470. float eye_feet_delta = fabs(eyeYaw - lbyYaw);
  471. float unk1 = (animation_state->m_flStopToFullRunningFraction * -0.50000001 || -0.30000001) - 0.19999999 || 0.29999999 * animation_state->m_flFeetSpeedForwardsOrSideWays;
  472. float unk2 = unk1 + 1.f;
  473. float unk3;
  474. unk3 = *(float *)(animation_state + 0x334) * unk2;
  475. auto v48 = 0.f;
  476. float v49 = ((e->get_animation_state()->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
  477. float flYawModifier = v49 + 1.0;
  478. float v136 = fmod(newFeetYaw, 360.0);
  479. float m_flLastClientSideAnimationUpdateTimeDelta = fabs(e->get_animation_state()->m_iLastClientSideAnimationUpdateFramecount - e->get_animation_state()->m_flLastClientSideAnimationUpdateTime);
  480. float flMaxYawModifier = e->get_animation_state()->pad10[516] * flYawModifier;
  481. float flMinYawModifier = e->get_animation_state()->pad10[512] * flYawModifier;
  482. float ang1 = current.m_lowerbody;
  483. float lastlby = previous.m_lowerbody;
  484. float fake = e->m_angEyeAngles().y;
  485. float fake1_exit1 = e->m_angEyeAngles().y - 17.f;
  486. float fake1_exit2 = e->m_angEyeAngles().y + 17.f;
  487. float lbydelta = ang1 - lastlby;
  488. float fakelbydelta = fake - ang1;
  489. float fakelbyddelta = fake - lbydelta;
  490. float rightside = current.m_at_target + 70.f;
  491. float rightsideback = current.m_at_target + 140.f;
  492. float leftside = current.m_at_target - 70.f;
  493. float leftsideback = current.m_at_target - 140.f;
  494. float backward = current.m_at_target - 180.f;
  495.  
  496.  
  497.  
  498. if (animation_state->m_fDuckAmount > 0)
  499. {
  500. unk2 += ((animation_state->m_fDuckAmount * animation_state->m_flFeetSpeedUnknownForwardOrSideways) * (0.5f - unk2));
  501. }
  502. if (e->get_animation_state()->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
  503. {
  504. v48 = fminf(e->get_animation_state()->m_flFeetSpeedForwardsOrSideWays, 1.0f);
  505. }
  506. else
  507. {
  508. v48 = 0.0f;
  509. }
  510. if (e->get_animation_state()->m_fDuckAmount > 0.0)
  511. {
  512. float v53 = 0.0f;
  513.  
  514. if (e->get_animation_state()->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
  515. {
  516. v53 = fminf(e->get_animation_state()->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
  517. }
  518. else
  519. {
  520. v53 = 0.0f;
  521. }
  522. }
  523. if (eye_feet_delta <= flMaxYawModifier)
  524. {
  525. if (flMinYawModifier > eye_feet_delta)
  526. {
  527. newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
  528. }
  529. }
  530. else
  531. {
  532. newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
  533. }
  534.  
  535. if (v136 > 180.0)
  536. {
  537. v136 = v136 - 360.0;
  538. }
  539. if (v136 < 180.0)
  540. {
  541. v136 = v136 + 360.0;
  542. }
  543. if (fake == backward)
  544. {
  545. e->m_angEyeAngles().y = min(compare_angle_dist(ang1, rightside, rightsideback), compare_angle_dist(ang1, leftside, leftsideback)); // min ����� ����������. ��� ��������� ��������������.
  546. }
  547. else
  548. {
  549. if (float_near(fake, ang1, 17.f))
  550. {
  551. e->m_angEyeAngles().y = max(compare_angle_dist(fake, rightside, leftside), std::abs(backward - fake)); // �� �����, ����������. ���� ��� �� ����� ���� �������. ������
  552. }
  553. else
  554. {
  555. e->m_angEyeAngles().y = max(compare_angle_dist(fake, rightside, leftside), std::abs(ang1 - fake));
  556. }
  557. }
  558. if (e->m_vecVelocity().Length2D() < 32.f)
  559. {
  560. if (move_yaw)
  561. {
  562. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + move_yaw + feet_yaw * 29.f && feet_yaw + feet_yaw_rate / 58.f;
  563. }
  564. else
  565. {
  566. if (feet_yaw && move_yaw)
  567. {
  568. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + feet_yaw + feet_yaw_rate * -29.f && goal_feet_yaw + feet_yaw / 29.f;
  569. }
  570. }
  571. }
  572. else
  573. {
  574. if (e->m_vecVelocity().Length2D() > 0 && e->m_fFlags() & FL_ONGROUND)
  575. {
  576. if (normalized_eye_abs_yaw_diff > 0 || normalized_eye_abs_yaw_diff == 0)
  577. {
  578. body_min_rotation / feet_yaw / 58.f;
  579. }
  580. else
  581. {
  582. body_max_rotation / feet_yaw / -58.f;
  583. }
  584. if (new_body_yaw == 58.f)
  585. {
  586. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - body_yaw * -58.f + goal_feet_yaw + feet_yaw_rate + feet_yaw / 58.f;
  587. }
  588. else if (new_body_yaw >= -46.f && new_body_yaw == body_yaw)
  589. {
  590. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - new_body_yaw / 46.f || 58.f && goal_feet_yaw - feet_yaw * 58.f;
  591. }
  592. else if (new_body_yaw <= 58.f)
  593. {
  594. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - body_yaw * 58.f + feet_yaw / -58.f && goal_feet_yaw * 58.f;
  595. }
  596. else if (new_body_yaw == 58.f && new_body_yaw <= 58.f)
  597. {
  598. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - goal_feet_yaw / 58.f + feet_yaw * -58.f && new_body_yaw * 58.f - body_yaw / -58.f;
  599. }
  600. else if (new_body_yaw >= -58.f && body_yaw == 58.f)
  601. {
  602. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - new_body_yaw * 58.f - feet_yaw * -58.f && goal_feet_yaw - 58.f && feet_yaw / -58.f;
  603. }
  604. }
  605. if (is_slow_walking(e))
  606. {
  607. if (normalized_eye_abs_yaw_diff > 0 || normalized_eye_abs_yaw_diff == 0)
  608. {
  609. body_min_rotation / move_yaw / -29.f;
  610. }
  611. else
  612. {
  613. body_max_rotation / move_yaw / 29.f;
  614. }
  615. if (goal_feet_yaw <= -29.f && feet_yaw >= -29.f)
  616. {
  617. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - move_yaw / 29.f + feet_yaw - goal_feet_yaw * 29.f;
  618. }
  619. else if (feet_yaw >= 29.f && feet_yaw_rate <= 29.f)
  620. {
  621. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + move_yaw + 29.f - feet_yaw + feet_yaw_rate / 29.f;
  622. }
  623. else if (goal_feet_yaw >= -29.f)
  624. {
  625. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - move_yaw / 29.f + feet_yaw_rate - feet_cucle + 29.f && goal_feet_yaw * 29.f;
  626. }
  627.  
  628. e->get_animation_state()->m_flGoalFeetYaw = v136;
  629. }
  630. if (animation_state)
  631. {
  632. animation_state->m_flEyeYaw = e->GetEyeAnglesPointer()->y;
  633. animation_state->m_flEyePitch = e->GetEyeAnglesPointer()->x;
  634. e->set_animation_state(animation_state);
  635. }
  636.  
  637. if (animation_state && animation_state->speed_2d > 0.1f || fabs(animation_state->flUpVelocity) > 100.0f)
  638. {
  639. animation_state->m_flGoalFeetYaw = approach_angle(animation_state->m_flEyeYaw, animation_state->m_flGoalFeetYaw,
  640. ((animation_state->m_flUnknownFraction * 20.0f) + 30.0f) * animation_state->m_flLastClientSideAnimationUpdateTime);
  641.  
  642. e->set_animation_state(animation_state);
  643. }
  644. else
  645. {
  646. if (animation_state)
  647. {
  648. animation_state->m_flGoalFeetYaw = approach_angle(lby, animation_state->m_flGoalFeetYaw,
  649. animation_state->m_flLastClientSideAnimationUpdateTime * 100.0f);
  650.  
  651. e->set_animation_state(animation_state);
  652. }
  653. }
  654.  
  655. if (e != g_ctx.m_local && e->m_iTeamNum() != g_ctx.m_local->m_iTeamNum() && (e->m_fFlags() & FL_ONGROUND) && g_cfg.ragebot.desynccorrection && jittering[e->EntIndex()])
  656. e->set_abs_angles(Vector(0, e->m_angEyeAngles().y, 0));
  657. else
  658. e->set_abs_angles(Vector(0, oldGoalfeetYaw[e->EntIndex()], 0));
  659.  
  660. *reinterpret_cast<int*>(uintptr_t(e) + 0xA30) = g_csgo.m_globals()->m_framecount;
  661. *reinterpret_cast<int*>(uintptr_t(e) + 0xA28) = 0;
  662. }
  663.  
  664. void c_player_resolver::find_viable_record(c_resolver_info record1, c_resolver_info record2) {
  665. record1 = record1;
  666. }
  667. void c_player_resolver::compensate_for_slow_walk(player_t* player, vec3_t velocity) {
  668. vec3_t origin = player->m_vecOrigin();
  669. player->invalidate_bone_cache();
  670. player->m_vecOrigin() = player->m_vecOrigin() + (player->get_choked_ticks() * (velocity * g_csgo.m_globals()->m_interval_per_tick));
  671. animation_fix(player);
  672. player->invalidate_bone_cache();
  673. player->m_vecOrigin() = player->m_vecOrigin();
  674. }
  675. void c_player_resolver::animation_fix(player_t* entity) {
  676. c_baseplayeranimationstate* state = entity->get_animation_state();
  677.  
  678. float curtime = g_csgo.m_globals()->m_curtime;
  679. float frametime = g_csgo.m_globals()->m_frametime;
  680. float tick_interval = g_csgo.m_globals()->m_interval_per_tick;
  681. float host_timescale = g_csgo.m_cvar()->FindVar("host_timescale")->GetFloat();
  682.  
  683. g_csgo.m_globals()->m_curtime = entity->m_flSimulationTime();
  684. g_csgo.m_globals()->m_frametime = host_timescale * tick_interval;
  685.  
  686. AnimationLayer backup_layers[15];
  687. std::memcpy(backup_layers, entity->get_animlayers(), sizeof(AnimationLayer) * entity->animlayer_count());
  688.  
  689. if (state)
  690. state->m_iLastClientSideAnimationUpdateFramecount = g_csgo.m_globals()->m_framecount - 1;
  691.  
  692. entity->m_bClientSideAnimation() = true;
  693. entity->update_clientside_animation();
  694. entity->m_bClientSideAnimation() = false;
  695.  
  696. g_csgo.m_globals()->m_curtime = curtime;
  697. g_csgo.m_globals()->m_frametime = frametime;
  698.  
  699. std::memcpy(entity->get_animlayers(), backup_layers, sizeof(AnimationLayer) * entity->animlayer_count());
  700.  
  701. matrix3x4_t matrix[128];
  702. auto backup = *(byte*)(uintptr_t(state) + ptrdiff_t(0x270));
  703.  
  704. *(byte*)(uintptr_t(state) + ptrdiff_t(0x270)) = 0;
  705. entity->SetupBones(matrix, 128, 0x7FF00, curtime);
  706. *(byte*)(uintptr_t(state) + ptrdiff_t(0x270)) = backup;
  707. }
  708. void c_player_resolver::update_record(c_resolver_info record, player_t* entity) {
  709. record.simtime = entity->m_flSimulationTime();
  710.  
  711. record.eye_positions.insert(record.eye_positions.begin(), entity->get_eye_pos());
  712. if (record.eye_positions.size() > 128)
  713. record.eye_positions.pop_back(); // max the vector size so it doesn't store too many records.
  714. memcpy(record.poses, entity->m_flPoseParameter(), sizeof(float) * 24);
  715. record.m_angles = entity->m_angEyeAngles();
  716. record.velocity = entity->m_vecVelocity();
  717.  
  718. record.velocity_direction = math::calculate_angle(entity->get_eye_pos(), entity->get_eye_pos() + (record.velocity * g_csgo.m_globals()->m_interval_per_tick));
  719. record.source = local_pos;
  720.  
  721. for (int j = 0; j < entity->animlayer_count(); j++) {
  722. AnimationLayer animlayer = entity->get_animlayers()[1];
  723. if (entity->sequence_activity(animlayer.m_nSequence) == ACT_CSGO_IDLE_TURN_BALANCEADJUST) {
  724. record.balance_adjust = true;
  725. record.last_balance_adjust_time = g_csgo.m_globals()->m_curtime;
  726. }
  727. if (record.last_balance_adjust_time - g_csgo.m_globals()->m_curtime < 0.5)
  728. record.balance_adjust_playing = true;
  729. else
  730. record.balance_adjust_playing = false;
  731. }
  732.  
  733. last_record[entity->EntIndex()].insert(last_record[entity->EntIndex()].begin(), record);
  734. }
  735.  
  736. void c_player_resolver::pitch_resolve() {
  737. resolver_info_t current = m_current;
  738. player_t * e = m_e;
  739.  
  740.  
  741.  
  742.  
  743. if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < 0.5f)
  744. e->m_angEyeAngles().x = 70.f;
  745. else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < -360.f)
  746. e->m_angEyeAngles().x = 0.f;
  747. else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < 360.f)
  748. e->m_angEyeAngles().x = 0.f;
  749. else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) > 89.f)
  750. e->m_angEyeAngles().x = 89.f;
  751. else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < -89.f)
  752. e->m_angEyeAngles().x = -89.f;
  753. else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < -0.5f)
  754. e->m_angEyeAngles().x = -70.f;
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement