-
Автор темы
- #1
resolver.cpp:
aimplayer.h:
Код:
#include "includes.h"
Resolver g_resolver{};;
float Resolver::freestand(Player* a1, LagRecord* a2, vec3_t start1, vec3_t end1, float a6, bool a5, float a7) {
AimPlayer* data = &g_aimbot.m_players[a1->index() - 1];
constexpr float STEP{ 4.0 };
constexpr float RANGE{ 32.0 };
std::vector< AdaptiveAngle > angles{ };
angles.emplace_back(a6 + a7);
angles.emplace_back(a6 - a7);
if (a5)
angles.emplace_back(a6);
vec3_t start = start1;
bool valid{ false };
vec3_t end2 = end1;
for (auto it = angles.begin(); it != angles.end(); ++it) {
vec3_t end{ end2.x + std::cos(math::deg_to_rad(it->m_yaw)) * RANGE,end2.y + std::sin(math::deg_to_rad(it->m_yaw)) * RANGE,end2.z };
vec3_t dir = end - start;
float len = dir.normalize();
if (len <= 0.0)
continue;
for (float i{ 0.0 }; i < len; i += STEP) {
vec3_t point = start + (dir * i);
int contents = g_csgo.m_engine_trace->GetPointContents(point, MASK_SHOT_HULL);
if (!(contents & MASK_SHOT_HULL))
continue;
float mult = 1.0;
if (i > (len * 0.5f))
mult = 1.25f;
if (i > (len * 0.75f))
mult = 1.5f;
if (i > (len * 0.9f))
mult = 2.0;
it->m_dist += (STEP * mult);
valid = true;
}
}
if (!valid)
return a6;
std::sort(angles.begin(), angles.end(), [](const AdaptiveAngle& a, const AdaptiveAngle& b) { return a.m_dist > b.m_dist; });
return angles[0].m_yaw;
}
float Resolver::away_angle( LagRecord* record ) {
ang_t away;
math::VectorAngles( g_cl.m_local->m_vecOrigin( ) - record->m_pred_origin, away );
return away.y;
}
void Resolver::set_mode( LagRecord* record ) {
if( ( record->m_pred_flags & FL_ONGROUND ) )
record->m_mode = record->m_velocity.length_2d( ) <= 0.0 ? 4 : 1;
else
record->m_mode = 2;
}
void Resolver::resolve(Player* player, LagRecord* record) {
AimPlayer* data = &g_aimbot.m_players[player->index() - 1];
if (data->m_records.size() >= 2)
{
LagRecord* prev = data->m_records[1].get();
float delta = math::anglediff(record->lby, prev->lby);
if (std::abs(delta) > 5.0 && !prev->dormant())
{
data->body_upd = FLT_MIN;
data->didnt_see_upd = 0;
if (data->seen_lby_upd)
{
if (std::abs(delta) <= 60.0)
{
if (std::abs(delta) > 35.0)
{
if (record->m_flags & FL_ONGROUND)
{
if (std::abs(record->m_anim_time - data->last_lby_time) < 1.5f)
++data->lby_change_amt;
data->last_lby_time = record->m_anim_time;
}
}
}
else
{
data->seen_lby_upd = 0;
data->saved = 0;
}
}
else if (std::abs(delta) > 35.0)
if (record->m_flags & FL_ONGROUND)
{
if (std::abs(record->m_anim_time - data->last_lby_time) < 1.5f)
++data->lby_change_amt;
data->last_lby_time = record->m_anim_time;
}
}
}
set_mode(record);
switch (record->m_mode) {
case 1:
resolve_run(data, record);
break;
case 4:
resolve_stand(data, record);
break;
case 2:
resolve_air(data, record);
break;
default:
break;
}
math::NormalizeAngle(record->eyeangle.y);
}
void Resolver::resolve_air(AimPlayer* data, LagRecord* record) {
data->moved = false;
data->m_walk_record.m_anim_time = -1;
record->eyeangle.y = record->lby;
}
void Resolver::resolve_run(AimPlayer* data, LagRecord* record) {
record->eyeangle.y = record->lby;
data->body_index = data->old_stand_index = data->old_stand1_index = data->stand_index = data->stand1_index = 0;
data->body_upd = record->m_anim_time + 0.22;
data->didnt_see_upd = 0;
if (data->lby_change_amt < 3) {
data->lby_change_amt = 0;
data->last_lby_time = FLT_MIN;
}
data->saved = 0;
data->unk1 = 0.0;
data->seen_lby_upd = 0;
data->last_lby = FLT_MIN;
data->m_walk_record.m_body = record->lby;
data->m_walk_record.m_origin = record->m_origin;
data->m_walk_record.m_anim_time = record->m_anim_time;
data->m_walk_record.m_sim_time = record->m_sim_time;
}
void Resolver::fam(AimPlayer* data, LagRecord* record) {
float case0_angle; // [esp+44h] [ebp-448h]
float abs_delta; // [esp+44h] [ebp-448h]
float abs_delta_3test__; // [esp+CCh] [ebp-3C0h]
float abs_delta_test3_; // [esp+D0h] [ebp-3BCh]
float last_body_delta_abs; // [esp+D4h] [ebp-3B8h]
float abs_test3_diff; // [esp+D8h] [ebp-3B4h]
float abs_forward_lby_delta; // [esp+E4h] [ebp-3A8h]
float abs_forward_lby_delta2; // [esp+E8h] [ebp-3A4h]
float abs_delta_last_body; // [esp+ECh] [ebp-3A0h]
float delta_3__; // [esp+2ACh] [ebp-1E0h]
float test3__1; // [esp+2B0h] [ebp-1DCh]
float last_body_delta2; // [esp+2B4h] [ebp-1D8h] BYREF
float test3_1; // [esp+2B8h] [ebp-1D4h]
float body_back_diff_pos; // [esp+2BCh] [ebp-1D0h] BYREF
float body_back_diff_neg; // [esp+2C0h] [ebp-1CCh] BYREF
float forward_lby_delta; // [esp+2C4h] [ebp-1C8h] BYREF
float test2; // [esp+2C8h] [ebp-1C4h]
float test3; // [esp+2CCh] [ebp-1C0h]
float last_body_delta; // [esp+2D0h] [ebp-1BCh] BYREF
float delta_3; // [esp+2D4h] [ebp-1B8h]
float last_body_delta_; // [esp+40Ch] [ebp-80h]
float abs_body_back_diff_pos; // [esp+410h] [ebp-7Ch]
float abs_body_back_diff_neg; // [esp+414h] [ebp-78h]
float body_delta_diff_pos; // [esp+418h] [ebp-74h]
float body_delta_diff_neg; // [esp+41Ch] [ebp-70h]
float back_1; // [esp+420h] [ebp-6Ch]
float forward_lby_delta2; // [esp+424h] [ebp-68h]
float abs_delta1; // [esp+428h] [ebp-64h]
float last_body_delta3; // [esp+42Ch] [ebp-60h]
float abs_delta_3;
float away = away_angle(record);
auto move = &data->m_walk_record;
vec3_t start = record->m_origin + record->m_player->m_vecViewOffset();
vec3_t end = g_cl.m_shoot_pos;
float ovr_back = g_menu.main.aimbot.override_backwards.get();
if (data->stand_index > 3)
data->stand_index = 0;
record->m_mode = 4;
switch (data->stand_index)
{
case 0:
delta_3 = data->delta2;
abs_delta_3 = std::abs(delta_3);
if (abs_delta_3 > 35.0) {
if (data->last_lby == FLT_MIN)
goto OVERRIDE_BACKWARDS;
last_body_delta = math::anglediff(data->last_lby, record->lby);
last_body_delta3 = last_body_delta;
abs_delta_last_body = std::abs(last_body_delta);
if (abs_delta_last_body >= 5.0)
goto OVERRIDE_BACKWARDS;
record->eyeangle.y = move->m_body + last_body_delta3;
record->skipped_case = 1;
}
else {
if (data->seen_lby_upd && data->lby_change_amt <= 1)
case0_angle = record->lby;
else
case0_angle = move->m_body;
record->eyeangle.y = case0_angle;
}
break;
case 1:
test3_1 = data->delta2;
abs_test3_diff = std::abs(test3_1);
if (abs_test3_diff > 35.0) {
if (data->last_lby == FLT_MIN
|| (last_body_delta2 = math::anglediff(data->last_lby, record->lby),
last_body_delta_ = last_body_delta2,
last_body_delta_abs = std::abs(last_body_delta2),
last_body_delta_abs >= 5.0)) {
record->eyeangle.y = move->m_body;
}
else
{
OVERRIDE_BACKWARDS:
if (data->lby_change_amt < 3) {
if (data->saved) {
test3 = data->delta2;
abs_delta = std::abs(test3);
}
else {
test2 = data->delta1;
abs_delta = std::abs(test2);
}
abs_delta1 = abs_delta;
forward_lby_delta = math::anglediff(away, record->lby);
forward_lby_delta2 = forward_lby_delta;
if (data->saved && abs_delta1 > 150.0) {
record->eyeangle.y = record->lby + data->delta2;
record->skipped_case = data->stand_index == 0;
}
else {
abs_forward_lby_delta2 = std::abs(forward_lby_delta2);
if (ovr_back < abs_forward_lby_delta2
&& (abs_forward_lby_delta = std::abs(forward_lby_delta2),
abs_forward_lby_delta < (float)(180.0 - ovr_back))) {
back_1 = away + 180.0;
body_delta_diff_neg = record->lby - abs_delta1;
body_delta_diff_pos = record->lby + abs_delta1;
body_back_diff_neg = math::anglediff((float)(away + 180.0), body_delta_diff_neg);
abs_body_back_diff_neg = std::abs(body_back_diff_neg);
body_back_diff_pos = math::anglediff(back_1, body_delta_diff_pos);
abs_body_back_diff_pos = std::abs(body_back_diff_pos);
record->eyeangle.y = (abs_body_back_diff_pos <= abs_body_back_diff_neg) ? body_delta_diff_pos : body_delta_diff_neg;
}
else {
record->eyeangle.y = freestand(record->m_player, record, end, start, record->lby, false, abs_delta1);
record->skipped_case = data->stand_index == 0;
}
}
}
else
{
record->eyeangle.y = freestand(record->m_player, record, end, start,away + 180.0, true, 90.0);
}
}
}
else {
record->eyeangle.y = (data->saved) ? move->m_body : record->lby;
}
break;
case 2:
test3__1 = data->delta2;
abs_delta_test3_ = std::abs(test3__1);
if (abs_delta_test3_ > 35.0) {
if (data->seen_lby_upd
&& (delta_3__ = data->delta2,
abs_delta_3test__ = std::abs(delta_3__),
abs_delta_3test__ <= 150.0)) {
record->eyeangle.y = record->lby + data->delta2;
}
else
{
record->eyeangle.y = freestand(record->m_player, record, end, start, away + 180.0, true, 22.5f);
}
}
else
{
record->eyeangle.y = freestand(record->m_player, record, end, start, record->lby, true, 90.0);
}
break;
case 3:
record->eyeangle.y = freestand(record->m_player, record, end, start, away + 180.0, true, 22.5f);
break;
default:
return;
}
}
void Resolver::resolve_stand(AimPlayer* data, LagRecord* record) {
data->moved = false;
if (data->m_walk_record.m_sim_time > 0.0)
{
vec3_t delta = data->m_walk_record.m_origin - record->m_origin;
if (delta.length() <= 32.0)
data->moved = true;
}
float away = away_angle(record);
vec3_t start = record->m_origin + record->m_player->m_vecViewOffset();
vec3_t end = g_cl.m_shoot_pos;
float diff1 = math::anglediff(data->m_walk_record.m_body, record->lby);
float diff = record->m_anim_time - data->m_walk_record.m_anim_time;
float back = g_menu.main.aimbot.override_backwards.get();
if (record->m_anim_time > data->body_upd) {
if (data->m_player->m_fFlags() & FL_ONGROUND) {
bool applytoeye = 1;
if (!data->saved && data->body_upd != FLT_MIN) {
data->seen_lby_upd = 1;
applytoeye = 0;
}
if (record->shot == 1) {
if (!data->saved) {
data->saved = 1;
data->delta2 = 0.0;
}
}
else if (applytoeye)
record->eyeangle.y = record->lby;
if (data->saved) {
if (!data->moved || data->seen_lby_upd || std::abs(data->delta2) > 35.0 || std::abs(diff1) <= 60.0) {
if (data->m_player->GetSequenceActivity(record->m_layers[3].m_sequence) == 979 && record->m_layers[3].m_cycle == 0.0 && record->m_layers[3].m_weight == 0.0) {
data->delta2 = std::abs(data->delta2);
data->delta1 = std::abs(data->delta1);
}
else {
data->delta2 = -std::abs(data->delta2);
data->delta1 = -std::abs(data->delta1);
}
}
else {
data->delta2 = data->delta1 = diff1;
}
}
else {
if (data->m_walk_record.m_sim_time <= 0.0 || data->m_walk_record.m_anim_time <= 0.0) {
data->delta2 = data->delta1;
data->last_lby = FLT_MIN;
}
else {
data->delta2 = data->delta1 = diff1;
data->last_lby = std::abs(diff1 - 90.0) <= 10.0 ? FLT_MIN : record->lby;
}
data->saved = 1;
}
if (applytoeye && data->body_index <= 0) {
data->body_upd = record->m_anim_time + 1.1f;
return;
}
}
}
if (record->shot != 1) {
if (!data->moved) {
record->m_mode = 3;
if (data->stand1_index > 3)
data->stand1_index = 0;
if (data->stand1_index > 0) {
if (data->stand1_index <= 1) {
if (std::abs(data->delta1) > 35.0) {
record->eyeangle.y = away + 180.0 + data->unk1;
}
else {
if (data->seen_lby_upd)
record->eyeangle.y = freestand(record->m_player, record, end, start, record->lby, true, 90.0);
else
record->eyeangle.y = record->lby;
}
return;
}
if (data->stand1_index != 2)
return;
if (std::abs(data->delta1) <= 35.0) {
record->eyeangle.y = away + 180.0 + data->unk1;
return;
}
if (back >= std::abs(math::anglediff(record->lby, away))
|| (std::abs(math::anglediff(record->lby, away)) >= (180.0 - back))) {
record->eyeangle.y = record->lby + data->delta1;
return;
}
}
else {
if (std::abs(data->delta1) <= 35.0) {
if (data->seen_lby_upd && data->lby_change_amt <= 1)
record->eyeangle.y = record->lby;
else
freestand(record->m_player, record, end, start, record->lby, true, 90.0);
return;
}
if (data->lby_change_amt <= 2) {
if (back < std::abs(math::anglediff(record->lby, away))
&& (std::abs(math::anglediff(record->lby, away)) < (180.0 - back))) {
float absdelta1 = std::abs(data->delta1);
float lbydelta1 = record->lby - absdelta1;
float lbydelta2 = record->lby + absdelta1;
float dist1 = math::anglediff(away + 180.0, lbydelta2);
float dist1abs = std::abs(dist1);
float dist2 = math::anglediff(away + 180.0, lbydelta1);
float dist2abs = std::abs(dist2);
record->eyeangle.y = dist1abs < dist2abs ? lbydelta2 : lbydelta1;
return;
}
record->eyeangle.y = freestand(record->m_player, record, end, start, record->lby, true, std::abs(data->delta1));
return;
}
}
record->eyeangle.y = freestand(record->m_player, record, end, start, away + 180.0, true, 90.0);
return;
}
fam(data, record);
}
}
Код:
float lby;
float body_upd;
float unk;
float delta1;
float delta2;
float unk1;
bool saved;
bool seen_lby_upd;
float last_lby;
int old_stand_index;
int old_stand1_index;
int stand1_index;
int stand_index;
int body_index;
int air_index;
int didnt_see_upd;
int lby_change_amt;
float last_lby_time;