Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.40 KB | None | 0 0
  1. void CResolver::record(SDK::CBaseEntity* entity, float new_yaw)
  2. {
  3. if (entity->GetVelocity().Length2D() > 36) return;
  4.  
  5. auto c_baseweapon = reinterpret_cast<SDK::CBaseWeapon*>(INTERFACES::ClientEntityList->GetClientEntity(entity->GetActiveWeaponIndex()));
  6. if (!c_baseweapon) return;
  7.  
  8. auto& info = player_info[entity->GetIndex()];
  9. if (entity->GetActiveWeaponIndex() && info.last_ammo < c_baseweapon->GetLoadedAmmo()) {
  10. info.last_ammo = c_baseweapon->GetLoadedAmmo();
  11. return;
  12. }
  13.  
  14. info.unresolved_yaw.insert(info.unresolved_yaw.begin(), new_yaw);
  15. if (info.unresolved_yaw.size() > 20) info.unresolved_yaw.pop_back();
  16. if (info.unresolved_yaw.size() < 2) return;
  17.  
  18. auto average_unresolved_yaw = 0;
  19. for (auto val : info.unresolved_yaw)
  20. average_unresolved_yaw += val;
  21. average_unresolved_yaw /= info.unresolved_yaw.size();
  22.  
  23. int delta = average_unresolved_yaw - entity->GetLowerBodyYaw();
  24. auto big_math_delta = abs((((delta + 180) % 360 + 360) % 360 - 180));
  25.  
  26. info.lby_deltas.insert(info.lby_deltas.begin(), big_math_delta);
  27. if (info.lby_deltas.size() > 10) {
  28. info.lby_deltas.pop_back();
  29. }
  30. }
  31. float random(int Min, int Max)
  32. {
  33. return ((rand() % (Max - Min)) + Min);
  34. }
  35. bool CResolver::is_slow_walking(SDK::CBaseEntity* entity) {
  36. float velocity_2D[64], old_velocity_2D[64];
  37.  
  38. if (entity->GetVelocity().Length2D() != velocity_2D[entity->GetIndex()] && entity->GetVelocity().Length2D() != NULL) {
  39. old_velocity_2D[entity->GetIndex()] = velocity_2D[entity->GetIndex()];
  40. velocity_2D[entity->GetIndex()] = entity->GetVelocity().Length2D();
  41. }
  42.  
  43. if (velocity_2D[entity->GetIndex()] > 0.1) {
  44. int tick_counter[64];
  45.  
  46. if (velocity_2D[entity->GetIndex()] == old_velocity_2D[entity->GetIndex()])
  47. ++tick_counter[entity->GetIndex()];
  48. else
  49. tick_counter[entity->GetIndex()] = 0;
  50.  
  51. while (tick_counter[entity->GetIndex()] > (1 / INTERFACES::Globals->interval_per_tick) * fabsf(0.1f))// should give use 100ms in ticks if their speed stays the same for that long they are definetely up to something..
  52. return true;
  53.  
  54. }
  55. return false;
  56. }
  57. int total_missed[64];
  58. int total_hit[64];
  59. SDK::IGameEvent* event = nullptr;
  60. extra s_extra;
  61. void missed_due_to_desync(SDK::IGameEvent* event) {
  62.  
  63. if (event == nullptr)
  64. return;
  65. int user = event->GetInt("userid");
  66. int attacker = event->GetInt("attacker");
  67. bool player_hurt[64], hit_entity[64];
  68.  
  69. if (INTERFACES::Engine->GetPlayerForUserID(user) != INTERFACES::Engine->GetLocalPlayer()
  70. && INTERFACES::Engine->GetPlayerForUserID(attacker) == INTERFACES::Engine->GetLocalPlayer()) {
  71. player_hurt[INTERFACES::Engine->GetPlayerForUserID(user)] = true;
  72. }
  73.  
  74. if (INTERFACES::Engine->GetPlayerForUserID(user) != INTERFACES::Engine->GetLocalPlayer())
  75. {
  76. Vector bullet_impact_location = Vector(event->GetFloat("x"), event->GetFloat("y"), event->GetFloat("z"));
  77. if (GLOBAL::aim_point != bullet_impact_location) return;
  78. hit_entity[INTERFACES::Engine->GetPlayerForUserID(user)] = true;
  79. }
  80. if (!player_hurt[INTERFACES::Engine->GetPlayerForUserID(user)] && hit_entity[INTERFACES::Engine->GetPlayerForUserID(user)]) {
  81. s_extra.current_flag[INTERFACES::Engine->GetPlayerForUserID(user)] = correction_flags::DESYNC;
  82. ++total_missed[INTERFACES::Engine->GetPlayerForUserID(user)];
  83. }
  84. if (player_hurt[INTERFACES::Engine->GetPlayerForUserID(user)] && hit_entity[INTERFACES::Engine->GetPlayerForUserID(user)]) {
  85. ++total_hit[INTERFACES::Engine->GetPlayerForUserID(user)];
  86. }
  87. }
  88.  
  89. void CResolver::resolve(SDK::CBaseEntity* entity)
  90. {
  91. auto local_player = INTERFACES::ClientEntityList->GetClientEntity(INTERFACES::Engine->GetLocalPlayer());
  92.  
  93. int i = entity->GetIndex();
  94.  
  95. static float MoveReal[65], FakeWalkandslowwalkingfix[65];
  96. auto animation_state = entity->GetAnimState();
  97. auto animstate = uintptr_t(local_player->GetAnimState());
  98. float duckammount = *(float*)(animstate + 0xA4);
  99. float speedfraction = max(0, min(*reinterpret_cast<float*>(animstate + 0xF8), 1));
  100. float speedfactor = max(0, min(1, *reinterpret_cast<float*> (animstate + 0xFC)));
  101. float unk1 = ((*reinterpret_cast<float*> (animstate + 0x11C) * -0.30000001) - 0.19999999) * speedfraction;
  102. float unk2 = unk1 + 1.f;
  103. float unk3;
  104. if (duckammount > 0) {
  105. unk2 += ((duckammount * speedfactor) * (0.5f - unk2));
  106. }
  107. unk3 = *(float*)(animstate + 0x334) * unk2;
  108. /*float duckammount = animation_state->m_fDuckAmount;
  109. float speedfraction = max(0, min(animation_state->m_flFeetSpeedForwardsOrSideWays, 2));
  110. float speedfactor = max(0, min(1, animation_state->m_flFeetSpeedUnknownForwardOrSideways));
  111. float unk1 = (animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999 * speedfraction;
  112. float unk2 = unk1 + 1.f;
  113. float unk3;
  114.  
  115. if (duckammount > 0)
  116. {
  117. unk2 += ((duckammount * speedfactor) * (0.5f - unk2));
  118. }
  119. unk3 = *(float *)(animation_state + 0x334) * unk2;*/
  120.  
  121. auto feet_yaw = animation_state->m_flCurrentFeetYaw;
  122. float body_yaw = 58.f;//animation_state->m_flCurrentTorsoYaw;
  123. auto move_yaw = 29.f;
  124. auto goal_feet_yaw = animation_state->m_flGoalFeetYaw;
  125. auto shit = body_yaw - feet_yaw;
  126. auto shitv2 = body_yaw + feet_yaw;
  127.  
  128. auto poses = entity->GetPoseParamaters();
  129. float feet_yaw_rate = animation_state->m_flFeetYawRate;
  130. float fff = animation_state->m_flFeetSpeedForwardsOrSideWays;
  131. float forwardorsideways = animation_state->m_flFeetSpeedUnknownForwardOrSideways;
  132. float feet_cucle = animation_state->m_flFeetCycle;
  133. float headheighanimation = animation_state->m_flHeadHeightOrOffsetFromHittingGroundAnimation;
  134. float new_body_yaw = animation_state->m_flCurrentTorsoYaw;
  135. auto body_max_rotation = animation_state->pad10[516];
  136. auto normalized_eye_abs_yaw_diff = fmod((animation_state->m_flEyeYaw - feet_yaw), 360.0);
  137. auto body_min_rotation = animation_state->pad10[512];
  138. if (entity->GetVelocity().Length2D() < 32.f) // �������� �� ����(upd:����� ����������)(UDP:��� ���������)
  139. {
  140. if (move_yaw)
  141. {
  142. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + move_yaw + feet_yaw * 29.f && feet_yaw + feet_yaw_rate / 58.f;
  143. }
  144. else
  145. {
  146. if (feet_yaw && move_yaw)
  147. {
  148. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + feet_yaw + feet_yaw_rate * -29.f && goal_feet_yaw + feet_yaw / 29.f;
  149. }
  150. }
  151. }
  152. else
  153. {
  154. if (entity->GetVelocity().Length2D() > 0 && entity->GetFlags() & FL_ONGROUND)
  155. {
  156. if (normalized_eye_abs_yaw_diff > 0 || normalized_eye_abs_yaw_diff == 0)
  157. {
  158. body_min_rotation / feet_yaw / 59.f;
  159. }
  160. else
  161. {
  162. body_max_rotation / feet_yaw / -59.f;
  163. }
  164. if (new_body_yaw == 59.f)
  165. {
  166. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - body_yaw * -59.f + goal_feet_yaw + feet_yaw_rate + feet_yaw / 59.f;
  167. }
  168. else if (new_body_yaw >= -46.f && new_body_yaw == body_yaw)
  169. {
  170. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - new_body_yaw / 46.f || 59.f && goal_feet_yaw - feet_yaw * 59.f;
  171. }
  172. else if (new_body_yaw <= 59.f)
  173. {
  174. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - body_yaw * 59.f + feet_yaw / -59.f && goal_feet_yaw * 59.f;
  175. }
  176. else if (new_body_yaw == 59.f && new_body_yaw <= 59.f)
  177. {
  178. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - goal_feet_yaw / 59.f + feet_yaw * -59.f && new_body_yaw * 59.f - body_yaw / -59.f;
  179. }
  180. else if (new_body_yaw >= -59.f && body_yaw == 59.f)
  181. {
  182. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - new_body_yaw * 59.f - feet_yaw * -59.f && goal_feet_yaw - 59.f && feet_yaw / -59.f;
  183. }
  184. }
  185. if (is_slow_walking(entity))//
  186. {
  187. if (normalized_eye_abs_yaw_diff > 0 || normalized_eye_abs_yaw_diff == 0)
  188. {
  189. body_min_rotation / move_yaw / -29.f;
  190. }
  191. else
  192. {
  193. body_max_rotation / move_yaw / 29.f;
  194. }
  195. if (goal_feet_yaw <= -29.f && feet_yaw >= -29.f)
  196. {
  197. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - move_yaw / 29.f + feet_yaw - goal_feet_yaw * 29.f;
  198. }
  199. else if (feet_yaw >= 29.f && feet_yaw_rate <= 29.f)
  200. {
  201. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + move_yaw + 29.f - feet_yaw + feet_yaw_rate / 29.f;
  202. }
  203. else if (goal_feet_yaw >= -29.f)
  204. {
  205. animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - move_yaw / 29.f + feet_yaw_rate - feet_cucle + 29.f && goal_feet_yaw * 29.f;
  206. }
  207. resolver->enemy_fakewalk = true;
  208. }
  209. else
  210. resolver->enemy_fakewalk = false;
  211. }
  212. }
  213. CResolver* resolver = new CResolver();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement