Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int resolve_type[65];
- bool using_fake_angles[65];
- bool UseFreestandAngle[65];
- float FreestandAngle[65];
- bool has_been_initialized = false;
- void c_player_resolver::run() {
- if (!g_cfg.ragebot.antiaim_correction || !g_ctx.m_local->is_alive())
- return;
- static bool first_execute[65];
- for (int i = 1; i <= 64; i++) {
- player_t* entity = reinterpret_cast<player_t*>(g_csgo.m_entitylist()->GetClientEntity(i));
- player_info_t info;
- g_csgo.m_engine()->GetPlayerInfo(m_e->EntIndex(), &info);
- update();
- lby_prediction();
- pitch_resolve();
- m_previous = m_current;
- m_has_previous = true;
- if (entity == g_ctx.m_local) {
- animation_fix(entity);
- continue;
- }
- if (!entity->valid(true, true))
- continue;
- if (!has_been_initialized) {
- if (i = 64)
- has_been_initialized = true;
- first_execute[i] = true;
- }
- update_record(current_record[i], entity);
- 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))
- compensate_for_slow_walk(entity, current_record[i].velocity);
- find_viable_record(current_record[i], last_record[i].back());
- animation_fix(entity);
- if ((current_record[i].simtime - last_record[i].back().simtime) == g_csgo.m_globals()->m_interval_per_tick)
- return;
- resolve(current_record[i], last_record[i].back(), entity);
- }
- }
- int total_missed[64];
- int total_hit[64];
- void c_player_resolver::create_move(vec3_t latency_based_eye_pos) {
- if (!g_cfg.ragebot.antiaim_correction)
- return;
- player_t * e = m_e;
- const float height = 64;
- Vector direction_1, direction_2;
- 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);
- 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);
- const auto left_eye_pos = e->m_vecOrigin() + Vector(0, 0, height) + (direction_1 * 16.f);
- const auto right_eye_pos = e->m_vecOrigin() + Vector(0, 0, height) + (direction_2 * 16.f);
- m_antifreestand.left_damage = autowall::get().calculate_return_info(latency_based_eye_pos, left_eye_pos, g_ctx.m_local, e, 1).m_damage;
- m_antifreestand.right_damage = autowall::get().calculate_return_info(latency_based_eye_pos, right_eye_pos, g_ctx.m_local, e, 1).m_damage;
- Ray_t ray;
- trace_t trace;
- CTraceFilterWorldOnly filter;
- ray.Init(left_eye_pos, latency_based_eye_pos);
- g_csgo.m_trace()->TraceRay(ray, MASK_ALL, &filter, &trace);
- m_antifreestand.left_fraction = trace.fraction;
- ray.Init(right_eye_pos, latency_based_eye_pos);
- g_csgo.m_trace()->TraceRay(ray, MASK_ALL, &filter, &trace);
- m_antifreestand.right_fraction = trace.fraction;
- }
- void c_player_resolver::lby_prediction() {
- static float next_lby_update[65];
- resolver_info_t
- & current = m_current,
- &previous = m_previous;
- player_t * e = m_e;
- if (e->IsDormant()) {
- current.m_predicted_flick = false;
- current.m_flick = false;
- g_ctx.m_globals.add_time[e->EntIndex()] = 0.f;
- g_ctx.m_globals.next_update[e->EntIndex()] = 0.f;
- next_lby_update[e->EntIndex()] = 0.f;
- }
- if (e->get_animtime() >= next_lby_update[e->EntIndex()] && !e->IsDormant())
- {
- current.m_predicted_flick = true;
- g_ctx.m_globals.add_time[e->EntIndex()] = 1.1f;
- next_lby_update[e->EntIndex()] = e->get_animtime() + g_ctx.m_globals.add_time[e->EntIndex()];
- g_ctx.m_globals.next_update[e->EntIndex()] = next_lby_update[e->EntIndex()];
- }
- else
- current.m_predicted_flick = false;
- if (current.m_lowerbody != e->m_flLowerBodyYawTarget() && !e->IsDormant())
- {
- current.m_flick = true;
- g_ctx.m_globals.add_time[e->EntIndex()] = g_csgo.m_globals()->m_interval_per_tick + 1.1f;
- next_lby_update[e->EntIndex()] = e->get_animtime() + g_ctx.m_globals.add_time[e->EntIndex()];
- g_ctx.m_globals.next_update[e->EntIndex()] = next_lby_update[e->EntIndex()];
- }
- else
- current.m_flick = false;
- if (current.m_velocity.Length2D() > 0.1f && !current.m_fakewalking && !e->IsDormant()) {
- g_ctx.m_globals.add_time[e->EntIndex()] = 0.22f;
- next_lby_update[e->EntIndex()] = e->get_animtime() + g_ctx.m_globals.add_time[e->EntIndex()];
- g_ctx.m_globals.next_update[e->EntIndex()] = next_lby_update[e->EntIndex()];
- }
- }
- void c_player_resolver::update() {
- resolver_info_t
- & current = m_current,
- &previous = m_previous;
- player_t * e = m_e;
- m_mode = resolver_modes::anti_freestand;
- int i = e->EntIndex();
- current.m_velocity = e->m_vecVelocity();
- current.m_origin = e->m_vecOrigin();
- current.m_lowerbody = e->m_flLowerBodyYawTarget();
- current.m_flags = e->m_fFlags();
- current.m_dormant = e->IsDormant();
- static bool isstatic[65];
- float moving_sim;
- static float nextlbyupdate[65];
- 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);
- 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);
- 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);
- const bool moving_on_ground = current.m_velocity.Length2D() > 0.1 && current.m_flags & FL_ONGROUND;
- current.m_at_target = math::calculate_angle(g_ctx.m_local->m_vecOrigin(), current.m_origin).y;
- current.m_balance_adjust_triggered = false, current.m_balance_adjust_triggered = false;
- auto activity = e->sequence_activity(e->get_animlayer(3).m_nSequence);
- if (e->m_flSimulationTime() >= m_current.m_next_predicted_lby_update)
- {
- m_current.did_predicted_lby_flick = true;
- m_current.m_next_predicted_lby_update = e->m_flSimulationTime() + 1.1f;
- }
- else
- m_current.did_predicted_lby_flick = false;
- if (m_current.m_lowerbody != m_previous.m_lowerbody &&
- fabs(math::normalize_yaw(m_current.m_lowerbody - m_previous.m_lowerbody)) > 5.f &&
- !m_current.m_dormant &&
- !m_previous.m_dormant &&
- !m_current.m_last_move_lby &&
- !m_current.m_last_moving_lby_delta &&
- !m_previous.m_lowerbody)
- {
- m_current.m_did_lby_flick = true;
- m_current.m_last_move_lby = e->m_flSimulationTime();
- m_current.m_predicted_flick = e->m_flSimulationTime();
- m_current.m_next_predicted_lby_update = e->m_flSimulationTime() + m_current.m_last_move_lby + 1.1f;
- }
- if (m_current.m_velocity.Length2D() > 0.6f && !m_current.m_fakewalking)
- m_current.m_next_predicted_lby_update = e->m_flSimulationTime() + 0.22f;
- if (moving_on_ground && !current.m_fakewalking)
- {
- current.m_last_move_lby = current.m_lowerbody;
- moving_sim = e->m_flSimulationTime();
- }
- update_fakewalk_data(current, e);
- triggers_979(e);
- if (g_csgo.m_inputsys()->IsButtonDown(g_cfg.ragebot.override_key))
- m_mode = resolver_modes::override;
- if (math::normalize_pitch(current.m_pitch) > 5.f)
- current.last_pitchdown = g_csgo.m_globals()->m_curtime;
- }
- bool c_player_resolver::is_slow_walking(c_resolver_info record1, c_resolver_info record2, float accuracy) {
- vec3_t prev_vel;
- static float prev_time = 0.f;
- if (prev_time < accuracy) {
- prev_vel = record1.velocity;
- prev_time = record2.simtime + 0.75;
- }
- else {
- if (record1.velocity != prev_vel)
- return false;
- else
- return true;
- }
- }
- void c_player_resolver::update_fakewalk_data(resolver_info_t & current, player_t * e) {
- resolver_info_t previous = m_previous;
- AnimationLayer anim_layers[15];
- bool s_1 = false,
- s_2 = false,
- s_3 = false;
- for (int i = 0; i < e->animlayer_count(); i++)
- {
- anim_layers[i] = e->get_animlayers()[i];
- if (anim_layers[i].m_nSequence == 26 && anim_layers[i].m_flWeight < 0.4f)
- s_1 = true;
- if (anim_layers[i].m_nSequence == 7 && anim_layers[i].m_flWeight > 0.001f)
- s_2 = true;
- if (anim_layers[i].m_nSequence == 2 && anim_layers[i].m_flWeight == 0)
- s_3 = true;
- }
- if (s_1 && s_2)
- if (s_3 || (e->m_fFlags() & FL_DUCKING))
- current.m_fakewalking = true;
- else
- current.m_fakewalking = false;
- else
- current.m_fakewalking = false;
- }
- bool find_layer(player_t * e, int act, AnimationLayer *set)
- {
- for (int i = 0; i < 13; i++)
- {
- AnimationLayer layer = e->get_animlayer(i);
- const int activity = e->sequence_activity(layer.m_nSequence);
- if (activity == act) {
- *set = layer;
- return true;
- }
- }
- return false;
- }
- bool triggers_981(player_t *e)
- {
- int seq_activity[64];
- for (int j = 0; j < 13; j++)
- {
- seq_activity[e->EntIndex()] = e->sequence_activity(e->get_animlayer(j).m_nSequence);
- if (seq_activity[e->EntIndex()] == 981 && e->get_animlayer(j).m_flWeight == 1)
- {
- return true;
- }
- }
- return false;
- }
- bool c_player_resolver::IsAdjustingBalance(player_t *player, ResolveInfo &record, AnimationLayer *layer)
- {
- for (int i = 0; i < record.m_iLayerCount; i++)
- {
- const int activity = player->sequence_activity(record.animationLayer[i].m_nSequence);
- if (activity == 979)
- {
- *layer = record.animationLayer[i];
- return true;
- }
- }
- return false;
- }
- void c_player_resolver::triggers_979(player_t *e)
- {
- int seq_activity[64];
- for (int j = 0; j < 13; j++)
- {
- seq_activity[e->EntIndex()] = e->sequence_activity(e->get_animlayer(j).m_nSequence);
- if (seq_activity[e->EntIndex()] == 979 && e->get_animlayer(j).m_flWeight == 0.f && e->get_animlayer(j).m_flCycle > .92f)
- {
- is_fake = true;
- }
- }
- }
- bool c_player_resolver::is_slow_walking(player_t * e) {
- float velocity_2D[64], old_velocity_2D[64];
- if (e->m_vecVelocity().Length2D() != velocity_2D[e->EntIndex()] && e->m_vecVelocity().Length2D() != NULL) {
- old_velocity_2D[e->EntIndex()] = velocity_2D[e->EntIndex()];
- velocity_2D[e->EntIndex()] = e->m_vecVelocity().Length2D();
- }
- if (velocity_2D[e->EntIndex()] > 0.1f || 0.4f) {
- int tick_counter[64];
- if (velocity_2D[e->EntIndex()] == old_velocity_2D[e->EntIndex()])
- ++tick_counter[e->EntIndex()];
- else
- tick_counter[e->EntIndex()] = 0;
- while (tick_counter[e->EntIndex()] > (1 / g_csgo.m_globals()->m_interval_per_tick) * fabsf(0.1f || 0.4f))
- return true;
- }
- return false;
- }
- float flAngleMod(float flAngle)
- {
- return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65535));
- }
- float ApproachAngle(float target, float value, float speed) //angles to approach
- {
- target = flAngleMod(target);
- value = flAngleMod(value);
- float delta = target - value;
- // Speed is assumed to be positive
- if (speed < 0)
- speed = -speed;
- if (delta < -180)
- delta += 360;
- else if (delta > 180)
- delta -= 360;
- if (delta > speed)
- value += speed;
- else if (delta < -speed)
- value -= speed;
- else
- value = target;
- return value;
- }
- float compare_angle_dist(float mainang, float ang1, float ang2, float ang3 = 0) // for compare angle distance
- {
- return max(std::abs(ang1 - mainang), std::abs(ang2 - mainang));
- }
- bool float_near(float v1, float v2, float tolerance) {
- return std::abs(v1 - v2) <= std::abs(tolerance);
- }
- bool solve_desync_simple(player_t* e) // 979 animation
- {
- if (!e || e->IsDormant() || !e->is_alive())
- return false;
- for (size_t i = 0; i < e->NumOverlays(); i++)
- {
- auto layer = e->get_anim_overlay_index(i);
- if (!layer)
- continue;
- if (e->GetSequenceActivity(layer->m_nSequence) == 979)
- {
- if (layer->m_flWeight == 0.0f && (layer->m_flCycle == 0.0f || layer->m_flCycle != layer->m_flPrevCycle))
- return true;
- }
- }
- return false;
- }
- float NormalizeYaw180(float yaw)
- {
- if (yaw > 180)
- yaw -= (round(yaw / 360) * 360.f);
- else if (yaw < -180)
- yaw += (round(yaw / 360) * -360.f);
- return yaw;
- }
- float NormalizeX(float yaw)
- {
- if (yaw != yaw)
- yaw = 0.f;
- return fmod(yaw + 180.f, 360.f) - 180.f;
- }
- float approach(float cur, float target, float inc) {
- inc = abs(inc);
- if (cur < target)
- return min(cur + inc, target);
- if (cur > target)
- return max(cur - inc, target);
- return target;
- }
- bool delta_58(float first, float second)
- {
- if (first - second < 58.f && first - second > -58.f)
- {
- return true;
- }
- return false;
- }
- float angle_difference(float a, float b) {
- auto diff = NormalizeYaw180(a - b);
- if (diff < 180)
- return diff;
- return diff - 360;
- }
- bool delta_35(float first, float second)
- {
- if (first - second <= 35.f && first - second >= -35.f)
- {
- return true;
- }
- return false;
- }
- float approach_angle(float cur, float target, float inc) {
- auto diff = angle_difference(target, cur);
- return approach(cur, cur + diff, inc);
- }
- void c_player_resolver::resolve(c_resolver_info record1, c_resolver_info record2, player_t* e)
- {
- ////
- resolver_info_t current = m_current, previous = m_previous;
- ////
- static float oldSimtime[65];
- static float storedSimtime[65];
- static float ShotTime[65];
- static float SideTime[65][3];
- static int LastDesyncSide[65];
- bool UseFreestandAngle[65];
- static bool Delaying[65];
- static AnimationLayer StoredLayers[64][15];
- static c_baseplayeranimationstate * StoredAnimState[65];
- static float StoredPosParams[65][24];
- static Vector oldEyeAngles[65];
- static float oldGoalfeetYaw[65];
- float FreestandAngle[65];
- float* PosParams = (float*)((uintptr_t)e + 0x2774);
- bool update = false;
- bool shot = false;
- static bool jittering[65];
- auto animation_state = e->get_animation_state();
- auto feet_yaw = animation_state->m_flCurrentFeetYaw;
- float body_yaw = 58.f; animation_state->m_flCurrentTorsoYaw;
- auto move_yaw = 29.f;
- auto goal_feet_yaw = animation_state->m_flGoalFeetYaw;
- auto shit = body_yaw - feet_yaw;
- auto shitv2 = body_yaw + feet_yaw;
- auto poses = e->m_flPoseParameter();
- float feet_yaw_rate = animation_state->m_flFeetYawRate;
- float fff = animation_state->m_flFeetSpeedForwardsOrSideWays;
- float forwardorsideways = animation_state->m_flFeetSpeedUnknownForwardOrSideways;
- float feet_cucle = animation_state->m_flFeetCycle;
- float headheighanimation = animation_state->m_flHeadHeightOrOffsetFromHittingGroundAnimation;
- float new_body_yaw = animation_state->m_flCurrentTorsoYaw;
- auto body_max_rotation = animation_state->pad10[516];
- auto normalized_eye_abs_yaw_diff = fmod((animation_state->m_flEyeYaw - feet_yaw), 360.0);
- auto body_min_rotation = animation_state->pad10[512];
- float newFeetYaw = 0.f;
- auto eyeYaw = e->get_animation_state()->m_flEyeYaw;
- auto lbyYaw = e->get_animation_state()->m_flGoalFeetYaw;
- float eye_feet_delta = fabs(eyeYaw - lbyYaw);
- float unk1 = (animation_state->m_flStopToFullRunningFraction * -0.50000001 || -0.30000001) - 0.19999999 || 0.29999999 * animation_state->m_flFeetSpeedForwardsOrSideWays;
- float unk2 = unk1 + 1.f;
- float unk3;
- unk3 = *(float *)(animation_state + 0x334) * unk2;
- auto v48 = 0.f;
- float v49 = ((e->get_animation_state()->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;
- float flYawModifier = v49 + 1.0;
- float v136 = fmod(newFeetYaw, 360.0);
- float m_flLastClientSideAnimationUpdateTimeDelta = fabs(e->get_animation_state()->m_iLastClientSideAnimationUpdateFramecount - e->get_animation_state()->m_flLastClientSideAnimationUpdateTime);
- float flMaxYawModifier = e->get_animation_state()->pad10[516] * flYawModifier;
- float flMinYawModifier = e->get_animation_state()->pad10[512] * flYawModifier;
- float ang1 = current.m_lowerbody;
- float lastlby = previous.m_lowerbody;
- float fake = e->m_angEyeAngles().y;
- float fake1_exit1 = e->m_angEyeAngles().y - 17.f;
- float fake1_exit2 = e->m_angEyeAngles().y + 17.f;
- float lbydelta = ang1 - lastlby;
- float fakelbydelta = fake - ang1;
- float fakelbyddelta = fake - lbydelta;
- float rightside = current.m_at_target + 70.f;
- float rightsideback = current.m_at_target + 140.f;
- float leftside = current.m_at_target - 70.f;
- float leftsideback = current.m_at_target - 140.f;
- float backward = current.m_at_target - 180.f;
- if (animation_state->m_fDuckAmount > 0)
- {
- unk2 += ((animation_state->m_fDuckAmount * animation_state->m_flFeetSpeedUnknownForwardOrSideways) * (0.5f - unk2));
- }
- if (e->get_animation_state()->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
- {
- v48 = fminf(e->get_animation_state()->m_flFeetSpeedForwardsOrSideWays, 1.0f);
- }
- else
- {
- v48 = 0.0f;
- }
- if (e->get_animation_state()->m_fDuckAmount > 0.0)
- {
- float v53 = 0.0f;
- if (e->get_animation_state()->m_flFeetSpeedUnknownForwardOrSideways >= 0.0)
- {
- v53 = fminf(e->get_animation_state()->m_flFeetSpeedUnknownForwardOrSideways, 1.0);
- }
- else
- {
- v53 = 0.0f;
- }
- }
- if (eye_feet_delta <= flMaxYawModifier)
- {
- if (flMinYawModifier > eye_feet_delta)
- {
- newFeetYaw = fabs(flMinYawModifier) + eyeYaw;
- }
- }
- else
- {
- newFeetYaw = eyeYaw - fabs(flMaxYawModifier);
- }
- if (v136 > 180.0)
- {
- v136 = v136 - 360.0;
- }
- if (v136 < 180.0)
- {
- v136 = v136 + 360.0;
- }
- if (fake == backward)
- {
- e->m_angEyeAngles().y = min(compare_angle_dist(ang1, rightside, rightsideback), compare_angle_dist(ang1, leftside, leftsideback)); // min ����� ����������. ��� ��������� ��������������.
- }
- else
- {
- if (float_near(fake, ang1, 17.f))
- {
- e->m_angEyeAngles().y = max(compare_angle_dist(fake, rightside, leftside), std::abs(backward - fake)); // �� �����, ����������. ���� ��� �� ����� ���� �������. ������
- }
- else
- {
- e->m_angEyeAngles().y = max(compare_angle_dist(fake, rightside, leftside), std::abs(ang1 - fake));
- }
- }
- if (e->m_vecVelocity().Length2D() < 32.f)
- {
- if (move_yaw)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + move_yaw + feet_yaw * 29.f && feet_yaw + feet_yaw_rate / 58.f;
- }
- else
- {
- if (feet_yaw && move_yaw)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + feet_yaw + feet_yaw_rate * -29.f && goal_feet_yaw + feet_yaw / 29.f;
- }
- }
- }
- else
- {
- if (e->m_vecVelocity().Length2D() > 0 && e->m_fFlags() & FL_ONGROUND)
- {
- if (normalized_eye_abs_yaw_diff > 0 || normalized_eye_abs_yaw_diff == 0)
- {
- body_min_rotation / feet_yaw / 58.f;
- }
- else
- {
- body_max_rotation / feet_yaw / -58.f;
- }
- if (new_body_yaw == 58.f)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - body_yaw * -58.f + goal_feet_yaw + feet_yaw_rate + feet_yaw / 58.f;
- }
- else if (new_body_yaw >= -46.f && new_body_yaw == body_yaw)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - new_body_yaw / 46.f || 58.f && goal_feet_yaw - feet_yaw * 58.f;
- }
- else if (new_body_yaw <= 58.f)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - body_yaw * 58.f + feet_yaw / -58.f && goal_feet_yaw * 58.f;
- }
- else if (new_body_yaw == 58.f && new_body_yaw <= 58.f)
- {
- 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;
- }
- else if (new_body_yaw >= -58.f && body_yaw == 58.f)
- {
- 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;
- }
- }
- if (is_slow_walking(e))
- {
- if (normalized_eye_abs_yaw_diff > 0 || normalized_eye_abs_yaw_diff == 0)
- {
- body_min_rotation / move_yaw / -29.f;
- }
- else
- {
- body_max_rotation / move_yaw / 29.f;
- }
- if (goal_feet_yaw <= -29.f && feet_yaw >= -29.f)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - move_yaw / 29.f + feet_yaw - goal_feet_yaw * 29.f;
- }
- else if (feet_yaw >= 29.f && feet_yaw_rate <= 29.f)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw + move_yaw + 29.f - feet_yaw + feet_yaw_rate / 29.f;
- }
- else if (goal_feet_yaw >= -29.f)
- {
- animation_state->m_flEyeYaw = animation_state->m_flEyeYaw - move_yaw / 29.f + feet_yaw_rate - feet_cucle + 29.f && goal_feet_yaw * 29.f;
- }
- e->get_animation_state()->m_flGoalFeetYaw = v136;
- }
- if (animation_state)
- {
- animation_state->m_flEyeYaw = e->GetEyeAnglesPointer()->y;
- animation_state->m_flEyePitch = e->GetEyeAnglesPointer()->x;
- e->set_animation_state(animation_state);
- }
- if (animation_state && animation_state->speed_2d > 0.1f || fabs(animation_state->flUpVelocity) > 100.0f)
- {
- animation_state->m_flGoalFeetYaw = approach_angle(animation_state->m_flEyeYaw, animation_state->m_flGoalFeetYaw,
- ((animation_state->m_flUnknownFraction * 20.0f) + 30.0f) * animation_state->m_flLastClientSideAnimationUpdateTime);
- e->set_animation_state(animation_state);
- }
- else
- {
- if (animation_state)
- {
- animation_state->m_flGoalFeetYaw = approach_angle(lby, animation_state->m_flGoalFeetYaw,
- animation_state->m_flLastClientSideAnimationUpdateTime * 100.0f);
- e->set_animation_state(animation_state);
- }
- }
- 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()])
- e->set_abs_angles(Vector(0, e->m_angEyeAngles().y, 0));
- else
- e->set_abs_angles(Vector(0, oldGoalfeetYaw[e->EntIndex()], 0));
- *reinterpret_cast<int*>(uintptr_t(e) + 0xA30) = g_csgo.m_globals()->m_framecount;
- *reinterpret_cast<int*>(uintptr_t(e) + 0xA28) = 0;
- }
- void c_player_resolver::find_viable_record(c_resolver_info record1, c_resolver_info record2) {
- record1 = record1;
- }
- void c_player_resolver::compensate_for_slow_walk(player_t* player, vec3_t velocity) {
- vec3_t origin = player->m_vecOrigin();
- player->invalidate_bone_cache();
- player->m_vecOrigin() = player->m_vecOrigin() + (player->get_choked_ticks() * (velocity * g_csgo.m_globals()->m_interval_per_tick));
- animation_fix(player);
- player->invalidate_bone_cache();
- player->m_vecOrigin() = player->m_vecOrigin();
- }
- void c_player_resolver::animation_fix(player_t* entity) {
- c_baseplayeranimationstate* state = entity->get_animation_state();
- float curtime = g_csgo.m_globals()->m_curtime;
- float frametime = g_csgo.m_globals()->m_frametime;
- float tick_interval = g_csgo.m_globals()->m_interval_per_tick;
- float host_timescale = g_csgo.m_cvar()->FindVar("host_timescale")->GetFloat();
- g_csgo.m_globals()->m_curtime = entity->m_flSimulationTime();
- g_csgo.m_globals()->m_frametime = host_timescale * tick_interval;
- AnimationLayer backup_layers[15];
- std::memcpy(backup_layers, entity->get_animlayers(), sizeof(AnimationLayer) * entity->animlayer_count());
- if (state)
- state->m_iLastClientSideAnimationUpdateFramecount = g_csgo.m_globals()->m_framecount - 1;
- entity->m_bClientSideAnimation() = true;
- entity->update_clientside_animation();
- entity->m_bClientSideAnimation() = false;
- g_csgo.m_globals()->m_curtime = curtime;
- g_csgo.m_globals()->m_frametime = frametime;
- std::memcpy(entity->get_animlayers(), backup_layers, sizeof(AnimationLayer) * entity->animlayer_count());
- matrix3x4_t matrix[128];
- auto backup = *(byte*)(uintptr_t(state) + ptrdiff_t(0x270));
- *(byte*)(uintptr_t(state) + ptrdiff_t(0x270)) = 0;
- entity->SetupBones(matrix, 128, 0x7FF00, curtime);
- *(byte*)(uintptr_t(state) + ptrdiff_t(0x270)) = backup;
- }
- void c_player_resolver::update_record(c_resolver_info record, player_t* entity) {
- record.simtime = entity->m_flSimulationTime();
- record.eye_positions.insert(record.eye_positions.begin(), entity->get_eye_pos());
- if (record.eye_positions.size() > 128)
- record.eye_positions.pop_back(); // max the vector size so it doesn't store too many records.
- memcpy(record.poses, entity->m_flPoseParameter(), sizeof(float) * 24);
- record.m_angles = entity->m_angEyeAngles();
- record.velocity = entity->m_vecVelocity();
- record.velocity_direction = math::calculate_angle(entity->get_eye_pos(), entity->get_eye_pos() + (record.velocity * g_csgo.m_globals()->m_interval_per_tick));
- record.source = local_pos;
- for (int j = 0; j < entity->animlayer_count(); j++) {
- AnimationLayer animlayer = entity->get_animlayers()[1];
- if (entity->sequence_activity(animlayer.m_nSequence) == ACT_CSGO_IDLE_TURN_BALANCEADJUST) {
- record.balance_adjust = true;
- record.last_balance_adjust_time = g_csgo.m_globals()->m_curtime;
- }
- if (record.last_balance_adjust_time - g_csgo.m_globals()->m_curtime < 0.5)
- record.balance_adjust_playing = true;
- else
- record.balance_adjust_playing = false;
- }
- last_record[entity->EntIndex()].insert(last_record[entity->EntIndex()].begin(), record);
- }
- void c_player_resolver::pitch_resolve() {
- resolver_info_t current = m_current;
- player_t * e = m_e;
- if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < 0.5f)
- e->m_angEyeAngles().x = 70.f;
- else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < -360.f)
- e->m_angEyeAngles().x = 0.f;
- else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < 360.f)
- e->m_angEyeAngles().x = 0.f;
- else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) > 89.f)
- e->m_angEyeAngles().x = 89.f;
- else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < -89.f)
- e->m_angEyeAngles().x = -89.f;
- else if (fabs(g_csgo.m_globals()->m_curtime - current.last_pitchdown) < -0.5f)
- e->m_angEyeAngles().x = -70.f;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement