Search the Community
Showing results for tags 'resolver lw'.
-
Improving this resolver as I go on! Stay tuned! making this to help pasters hit other cheats. ( don't sell plz ) // This is an independent project of an individual developer. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com #include "animation_system.h" #include "..\ragebot\aim.h" void resolver::initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch) { player = e; player_record = record; original_goal_feet_yaw = math::normalize_yaw(goal_feet_yaw); original_pitch = math::normalize_pitch(pitch); } void resolver::reset() { player = nullptr; player_record = nullptr; side = false; fake = false; was_first_bruteforce = false; was_second_bruteforce = false; original_goal_feet_yaw = 0.0f; original_pitch = 0.0f; } bool resolver::Side() { AnimationLayer layers[13]; AnimationLayer moveLayers[3][13]; AnimationLayer preserver_anim_layers[13]; auto speed = player->m_vecVelocity().Length2D(); //hit side lanes if (speed > 1.1f) { if (!layers[12].m_flWeight * 1000.f) { if ((layers[6].m_flWeight * 1000.f) == (layers[6].m_flWeight * 1000.f)) { float EyeYaw = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate); float Negative = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate); float Positive = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate); if (Positive >= EyeYaw || Positive >= Negative || (Positive * 1000.f)) { last_anims_update_time = m_globals()->m_realtime; return true; } } else { last_anims_update_time = m_globals()->m_realtime; return false; } } } else if (layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f) { auto delta = std::remainder(math::normalize_yaw(player->m_angEyeAngles().y - player->m_flLowerBodyYawTarget()), 360.f) <= 0.f; if (2 * delta) { if (2 * delta == 2) { return false; } } else { return true; } } } float flAngleMod(float flAngle) { return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65530)); } //added approachangle for anglemod float ApproachAngle(float target, float value, float speed) { 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; } //main resolver void resolver::resolve_yaw() { player_info_t player_info; if (!m_engine()->GetPlayerInfo(player->EntIndex(), &player_info)) return; if (player_info.fakeplayer || !g_ctx.local()->is_alive() || player->m_iTeamNum() == g_ctx.local()->m_iTeamNum()) //-V807 { player_record->side = RESOLVER_ORIGINAL; return; } if (g_ctx.globals.missed_shots[player->EntIndex()] >= 2 || g_ctx.globals.missed_shots[player->EntIndex()] && aim::get().last_target[player->EntIndex()].record.type != LBY) { switch (last_side) { case RESOLVER_ORIGINAL: g_ctx.globals.missed_shots[player->EntIndex()] = 0; fake = true; break; case RESOLVER_FIRST: player_record->type = BRUTEFORCE; player_record->side = was_second_bruteforce ? RESOLVER_ZERO : RESOLVER_SECOND; was_first_bruteforce = true; return; case RESOLVER_SECOND: player_record->type = BRUTEFORCE; player_record->side = was_first_bruteforce ? RESOLVER_ZERO : RESOLVER_FIRST; was_second_bruteforce = true; return; case RESOLVER_LOW_FIRST: player_record->type = BRUTEFORCE; player_record->side = RESOLVER_LOW_SECOND; return; case RESOLVER_LOW_SECOND: player_record->type = BRUTEFORCE; player_record->side = RESOLVER_LOW_FIRST; return; } } auto animstate = player->get_animation_state(); if (!animstate) { player_record->side = RESOLVER_ORIGINAL; return; } auto delta = math::normalize_yaw(player->m_angEyeAngles().y - original_goal_feet_yaw); auto valid_lby = true; if (animstate->m_velocity > 1.1f || fabs(animstate->flUpVelocity) > 100.f) valid_lby = animstate->m_flTimeSinceStartedMoving < 0.22f; if (fabs(delta) > 30.0f && valid_lby) { if (g_ctx.globals.missed_shots[player->EntIndex()]) delta = -delta; if (delta > 30.0f) { player_record->type = LBY; player_record->side = RESOLVER_LOW_FIRST; } else if (delta < -30.0f) { player_record->type = LBY; player_record->side = RESOLVER_LOW_SECOND; } } else { auto trace = false; if (m_globals()->m_curtime - lock_side > 2.0f) { auto first_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first), player, g_ctx.local()); auto second_visible = util::visible(g_ctx.globals.eye_pos, player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second), player, g_ctx.local()); if (first_visible != second_visible) { trace = true; side = second_visible; lock_side = m_globals()->m_curtime; } else { auto first_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first)); auto second_position = g_ctx.globals.eye_pos.DistTo(player->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second)); if (fabs(first_position - second_position) > 1.0f) side = first_position > second_position; } } else trace = true; if (side) { player_record->type = trace ? TRACE: DIRECTIONAL; player_record->side = RESOLVER_FIRST; } else { player_record->type = trace ? TRACE : DIRECTIONAL; player_record->side = RESOLVER_SECOND; } } } //bruteforce alert!! void bruteforce(player_t* e, player_info_t player, const float& goal_feet_yaw, const float& pitch) { player_info_t player_info; auto animState = player; auto& resolverInfo = player; // Rebuild setup velocity to receive flMinBodyYaw and flMaxBodyYaw Vector velocity = velocity; float spd; if (spd > std::powf(1.2f * 260.0f, 2.f)) { Vector velocity_normalized = velocity.Normalized(); velocity = velocity_normalized * (1.2f * 260.0f); } float m_flChokedTime; float v25 = (0.0f, 1.0f); float v26 = (0.0f); float v27 = m_flChokedTime * 6.0f; float v28; // clamp if ((v25 - v26) <= v27) { if (-v27 <= (v25 - v26)) v28 = v25; else v28 = v26 - v27; } else { v28 = v26 + v27; } float m_flFakeGoalFeetYaw; float flDuckAmount = (v28, 0.0f, 1.0f); Vector animationVelocity = (m_flChokedTime * 2000.0f, velocity, velocity); float speed = std::fminf(animationVelocity.Length(), 260.0f); bool weapon; float flMaxMovementSpeed = 260.0f; if (weapon) { flMaxMovementSpeed = std::fmaxf(weapon, 0.001f); } float flRunningSpeed = speed / (flMaxMovementSpeed * 0.520f); float flDuckingSpeed = speed / (flMaxMovementSpeed * 0.340f); flRunningSpeed = (flRunningSpeed, 0.0f, 1.0f); float m_flGroundFractio; float flYawModifier = (((m_flGroundFractio * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f; if (flDuckAmount > 0.0f) { float flDuckingSpeed = (flDuckingSpeed, 0.0f, 1.0f); flYawModifier += (flDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier); } float m_flMinBodyYaw; float m_flMaxBodyYaw; float flMinBodyYaw = std::fabsf(m_flMinBodyYaw * flYawModifier); float flMaxBodyYaw = std::fabsf(m_flMaxBodyYaw * flYawModifier); float m_angEyeAngles; float flEyeYaw = m_angEyeAngles, yaw; float flEyeDiff = std::remainderf(flEyeYaw - m_flFakeGoalFeetYaw, 360.f); if (flEyeDiff <= flMaxBodyYaw) { if (flMinBodyYaw > flEyeDiff) m_flFakeGoalFeetYaw = fabs(flMinBodyYaw) + flEyeYaw; } else { m_flFakeGoalFeetYaw = flEyeYaw - fabs(flMaxBodyYaw); } m_flFakeGoalFeetYaw = std::remainderf(m_flFakeGoalFeetYaw, 360.f); float m_flGroundFraction; if (speed > 0.1f || fabs(velocity.z) > 100.0f) { m_flFakeGoalFeetYaw = (ApproachAngle, flEyeYaw, m_flFakeGoalFeetYaw, ((m_flGroundFraction * 29.0f) + 49.0f) * m_flChokedTime); } else { m_flFakeGoalFeetYaw = (ApproachAngle, m_flFakeGoalFeetYaw, m_flChokedTime * 100.0f); } float Left = flEyeYaw - flMinBodyYaw; float Right = flEyeYaw + flMaxBodyYaw; float resolveYaw; int m_iMissedShots; switch (m_iMissedShots % 3) { case 0: // brute left side resolveYaw = m_flFakeGoalFeetYaw; break; case 1: // brute fake side resolveYaw = Left; break; case 2: // brute right side resolveYaw = Right; break; default: break; } return; } bool InFakeWalkOld(player_t* player) { bool bFakewalking = false, stage1 = false, // stages needed cause we are iterating all layers, eitherwise won't work :) stage2 = false, stage3 = false; AnimationLayer animationLayer[15]; for (int i = 0; ; i++) { if (animationLayer[i].m_nSequence == 26 &&animationLayer[i].m_flWeight < 0.47f) stage1 = true; if (animationLayer[i].m_nSequence == 7 && animationLayer[i].m_flWeight > 0.001f) stage2 = true; if (animationLayer[i].m_nSequence == 2 && animationLayer[i].m_flWeight == 0) stage3 = true; } if (stage1 && stage2) if (stage3 || (player->m_fFlags() & FL_DUCKING)) // since weight from stage3 can be 0 aswell when crouching, we need this kind of check, cause you can fakewalk while crouching, thats why it's nested under stage1 and stage2 bFakewalking = true; else bFakewalking = false; else bFakewalking = false; return bFakewalking; } //back to original float resolver::resolve_pitch() { if (fabs(original_pitch) > 85.0f) fake = true; else if (!fake) { player_record->side = RESOLVER_ORIGINAL; return RESOLVER_ORIGINAL; } return original_pitch; }