-
Автор темы
- #1
1.
2.
3.
Код:
// 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"
#include "..\autowall\autowall.h"
void resolver::initialize(player_t* e, adjust_data* record, const float& pitch)
{
player = e;
player_record = record;
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;
}
float AngleDiff(float destAngle, float srcAngle) {
float delta;
delta = fmodf(destAngle - srcAngle, 360.0f);
if (destAngle > srcAngle) {
if (delta >= 180)
delta -= 360;
}
else {
if (delta <= -180)
delta += 360;
}
return delta;
}
void resolver::ResolveAngles()
{
auto animstate = player->get_animation_state();
float EyeDelta = player->m_angEyeAngles().y - animstate->m_flGoalFeetYaw;
bool LowDelta = EyeDelta <= 35.f;
int Side = (EyeDelta > 0.f) ? -1 : 1;
float desync_delta = LowDelta ? player->get_max_desync_delta() / 2 : player->get_max_desync_delta();
int LbySide = 0;
if (player->get_animlayers()->m_nSequence == 979 && player->m_vecVelocity().Length2D() == 0.f)
{
float LbyAngle = player->m_flLowerBodyYawTarget();
LbySide = (LbyAngle > 0.f) ? -1 : 1;
}
float last_side = 0.0f;
int last_detect_side = 0;
if (last_side)
{
if (last_side != last_detect_side)
{
last_side = player->m_flLowerBodyYawTarget() * 0.574f;
}
else
{
last_side == player->m_flOldSimulationTime();
}
}
else if (last_side)
{
last_detect_side = last_side;
}
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() || player->IsDormant() || !player || !player->m_iHealth() > 0)
{
player_record->type = RESOLVER_NONE;
return;
}
bool is_player_zero = false;
bool is_player_faking = false;
int positives = 0;
int negatives = 0;
fake = false;
resolver_history res_history = HISTORY_UNKNOWN;
for (auto it = lagcompensation::get().player_sets.begin(); it != lagcompensation::get().player_sets.end(); ++it)
if (it->id == player_info.steamID64)
{
res_history = it->res_type;
is_player_faking = it->faking;
positives = it->pos;
negatives = it->neg;
break;
}
if (res_history == HISTORY_ZERO)
is_player_zero = true;
resolver_type type = resolver_type(-1);
auto valid_move = true;
auto choked = abs(TIME_TO_TICKS(player->m_flSimulationTime() - player->m_flOldSimulationTime()) - 1);
if (fabs(original_pitch) > 65.f || choked >= 1 || is_player_faking)
fake = true;
else if (fake && !g_ctx.globals.missed_shots[player->EntIndex()])
{
player_record->type = type;
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + player->get_max_desync_delta());
return;
}
else
{
player_record->type = type;
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - player->get_max_desync_delta());
}
auto m_nChoked = player->m_flSimulationTime() - player->m_flOldSimulationTime();
auto delta = math::normalize_yaw(player->m_angEyeAngles().y - resolver_goal_feet_yaw[0]);
auto valid_lby = true;
if (player->get_animation_state()->m_velocity > 0.1f || fabs(player->get_animation_state()->flUpVelocity) > 100.f)
valid_lby = player->get_animation_state()->m_flTimeSinceStartedMoving < 0.22f;
if (player->m_fFlags() & FL_ONGROUND)
{
if (m_nChoked == 1)
{
if (player->m_vecVelocity().Length2D() && !valid_lby)
{
if (!valid_lby && record->anim_layers[3].m_flWeight == 0.0f && record->anim_layers[3].m_flCycle == 0.0f && record->anim_layers[6].m_flWeight == 0.0f && record->anim_layers[6].m_flWeight == 1.0f && record->anim_layers[6].m_flWeightDeltaRate == 0.0f && player->m_fFlags() & FL_ONGROUND)
{
auto m_delta = math::angle_difference(player->m_angEyeAngles().y, resolver_goal_feet_yaw[0]);
player_record->side = (int)(m_delta <= 0.0f) > 0.0f ? RESOLVED_RIGHT : RESOLVED_LEFT;
player_record->type = RESOLVER_LOGIC;
}
}
else if (!(int(record->anim_layers[12].m_flWeight * 1000.f)) && int(record->anim_layers[6].m_flWeight * 1000.f) == int(record->anim_layers[6].m_flWeight * 1000.f))
{
const auto delta_first = fabsf(record->anim_layers[6].m_flPlaybackRate - record->resolver_anim_layer[0][6].m_flPlaybackRate);
const auto delta_second = fabsf(record->anim_layers[6].m_flPlaybackRate - record->resolver_anim_layer[2][6].m_flPlaybackRate);
const auto delta_third = fabsf(record->anim_layers[6].m_flPlaybackRate - record->resolver_anim_layer[1][6].m_flPlaybackRate);
if (delta_first < delta_second || delta_second <= delta_third || (delta_second * 1000.0f))
{
if (delta_first >= delta_third && delta_second > delta_third && !(delta_third * 1000.0f))
{
player_record->side = RESOLVED_RIGHT;
}
}
else
{
player_record->side = RESOLVED_LEFT;
}
}
}
}
}
float resolver::resolve_pitch()
{
return original_pitch;
}
Код:
// 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::low_delta()
{
if (!g_ctx.local()->is_alive() && !g_ctx.local()->m_iTeamNum() == player->m_iTeamNum())
return false;
float angle_diff = math::AngleDiff(player->m_angEyeAngles().y, player->get_animation_state()->m_flGoalFeetYaw);
Vector firsttwo = ZERO, secondtwo = ZERO, thirdtwo = ZERO;
firsttwo = Vector(player->m_angEyeAngles().x, player->m_angEyeAngles().y + min(angle_diff, 23), player->m_angEyeAngles().z);
secondtwo = Vector(player->m_angEyeAngles().x, 180, player->m_angEyeAngles().z);
thirdtwo = Vector(player->m_angEyeAngles().x, player->m_angEyeAngles().y - min(angle_diff, 23), player->m_angEyeAngles().z);
if ((aim::get().hitbox_intersection(player, player_record->matrixes_data.first, 0, g_ctx.local()->get_eye_pos(), firsttwo) && aim::get().hitbox_intersection(player, player_record->matrixes_data.zero, 0, g_ctx.local()->get_eye_pos(), secondtwo))
|| (aim::get().hitbox_intersection(player, player_record->matrixes_data.zero, 0, g_ctx.local()->get_eye_pos(), secondtwo) && aim::get().hitbox_intersection(player, player_record->matrixes_data.second, 0, g_ctx.local()->get_eye_pos(), thirdtwo)))
return true;
float lby = math::normalize_yaw(player->m_flLowerBodyYawTarget());
if (lby < 25 && lby > -25)
return true;
return false;
}
float fast_float_normalize(float srcAngle, float distAngle) {
float difference;
for (; srcAngle > 180.0; srcAngle = srcAngle - 360.0)
;
for (; srcAngle < -180.0; srcAngle = srcAngle + 360.0)
;
for (; distAngle > 180.0; distAngle = distAngle - 360.0)
;
for (; distAngle < -180.0; distAngle = distAngle + 360.0)
;
for (difference = distAngle - srcAngle; difference > 180.0; difference = difference - 360.0)
;
for (; difference < -180.0; difference = difference + 360.0)
;
return difference;
}
void resolver::resolve_yaw()
{
float no_side = FLT_MAX;
auto animstate = player->get_animation_state();
AnimationLayer layers[15];
AnimationLayer moveLayers[3][15];
memcpy(moveLayers, player->get_animlayers(), sizeof(AnimationLayer) * 15);
auto speed = player->m_vecVelocity().Length2D();
int m_side;
if (speed <= 0.1f)
{
auto delta = fast_float_normalize(player->m_angEyeAngles().y, player->get_animation_state()->m_flGoalFeetYaw);
if (layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f)
{
resolving_way = (fast_float_normalize(player->get_animation_state()->m_flEyeYaw, player->get_animation_state()->m_flGoalFeetYaw) <= 0.0) - 1;
}
}
if (int(layers[12].m_flWeight * 1000.0f) == int(layers[6].m_flWeight * 1000.0f))
{
float firstDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate);
float secondDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate);
float thirdDelta = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate);
if (firstDelta < secondDelta || thirdDelta <= secondDelta || (secondDelta * 1000.0))
{
if (firstDelta >= thirdDelta && secondDelta > thirdDelta && !(thirdDelta * 1000.0))
{
m_side = 1;
}
}
else
{
m_side = -1;
}
}
if (m_side = -1)
{
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
break;
case 1:
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 30.f);
break;
}
}
else if (m_side = 1)
{
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 60.f);
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y - 60.f);
break;
case 1:
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + 30.f);
break;
}
}
}
float resolver::resolve_pitch()
{
return original_pitch;
}
Код:
// 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::low_delta()
{
if (!g_ctx.local()->is_alive() && !g_ctx.local()->m_iTeamNum() == player->m_iTeamNum())
return false;
float angle_diff = math::AngleDiff(player->m_angEyeAngles().y, player->get_animation_state()->m_flGoalFeetYaw);
Vector firsttwo = ZERO, secondtwo = ZERO, thirdtwo = ZERO;
firsttwo = Vector(player->m_angEyeAngles().x, player->m_angEyeAngles().y + min(angle_diff, 23), player->m_angEyeAngles().z);
secondtwo = Vector(player->m_angEyeAngles().x, 180, player->m_angEyeAngles().z);
thirdtwo = Vector(player->m_angEyeAngles().x, player->m_angEyeAngles().y - min(angle_diff, 23), player->m_angEyeAngles().z);
if ((aim::get().hitbox_intersection(player, player_record->matrixes_data.first, 0, g_ctx.local()->get_eye_pos(), firsttwo) && aim::get().hitbox_intersection(player, player_record->matrixes_data.zero, 0, g_ctx.local()->get_eye_pos(), secondtwo))
|| (aim::get().hitbox_intersection(player, player_record->matrixes_data.zero, 0, g_ctx.local()->get_eye_pos(), secondtwo) && aim::get().hitbox_intersection(player, player_record->matrixes_data.second, 0, g_ctx.local()->get_eye_pos(), thirdtwo)))
return true;
float lby = math::normalize_yaw(player->m_flLowerBodyYawTarget());
if (lby < 25 && lby > -25)
return true;
return false;
}
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())
{
player_record->side = RESOLVER_ORIGINAL;
return;
}
auto animstate = player->get_animation_state();
if (!animstate)
{
player_record->side = RESOLVER_ORIGINAL;
return;
}
bool is_player_zero = false;
bool is_player_faking = false;
int positives = 0;
int negatives = 0;
fake = true;
resolver_history res_history = HISTORY_UNKNOWN;
for (auto it = lagcompensation::get().player_sets.begin(); it != lagcompensation::get().player_sets.end(); ++it)
if (it->id == player_info.steamID64)
{
res_history = it->res_type;
is_player_faking = it->faking;
positives = it->pos;
negatives = it->neg;
break;
}
if (res_history == HISTORY_ZERO)
is_player_zero = true;
resolver_type type = resolver_type(-1);
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());
auto lby_delta = math::normalize_yaw(player->m_angEyeAngles().y - original_goal_feet_yaw);
auto freestand_yaw = 0.f;
{
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)
{
type = resolver_type::TRACE;
side = first_visible < second_visible;
lock_side = m_globals()->m_curtime;
}
else
{
type = resolver_type::DIRECTIONAL;
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 (abs(positives - negatives) > 3)
side = positives < negatives;
if (fabs(first_position - second_position) > 1.0f)
side = first_position < second_position;
}
}
else
type = resolver_type::LOCKED_SIDE;
}
if (g_ctx.globals.missed_shots[player->EntIndex()])
{
switch (last_side)
{
case RESOLVER_ORIGINAL:
g_ctx.globals.missed_shots[player->EntIndex()] = 0;
fake = true;
break;
case RESOLVER_ZERO:
player_record->type = BRUTEFORCE;
if (!is_player_zero)
player_record->side = side ? RESOLVER_LOW_FIRST : RESOLVER_LOW_SECOND;
else
player_record->side = side ? RESOLVER_FIRST : RESOLVER_SECOND;
was_first_bruteforce = false;
was_second_bruteforce = false;
return;
case RESOLVER_FIRST:
player_record->type = BRUTEFORCE;
player_record->side = was_second_bruteforce ? RESOLVER_ZERO : RESOLVER_SECOND;
was_first_bruteforce = true;
was_first_low_bruteforce = false;
was_second_low_bruteforce = false;
return;
case RESOLVER_SECOND:
player_record->type = BRUTEFORCE;
player_record->side = was_first_bruteforce ? RESOLVER_ZERO : RESOLVER_FIRST;
was_second_bruteforce = true;
was_first_low_bruteforce = false;
was_second_low_bruteforce = false;
return;
case RESOLVER_LOW_FIRST:
player_record->type = BRUTEFORCE;
player_record->side = was_second_low_bruteforce ? (side ? RESOLVER_FIRST : RESOLVER_SECOND) : RESOLVER_LOW_SECOND;
was_first_low_bruteforce = true;
return;
case RESOLVER_LOW_SECOND:
player_record->type = BRUTEFORCE;
player_record->side = was_first_low_bruteforce ? (side ? RESOLVER_FIRST : RESOLVER_SECOND) : RESOLVER_LOW_FIRST;
was_second_low_bruteforce = true;
return;
}
}
auto choked = abs(TIME_TO_TICKS(player->m_flSimulationTime() - player->m_flOldSimulationTime()) - 1);
if (fabs(original_pitch) > 65.f || choked >= 1 || is_player_faking)
fake = true;
else if (!fake && !g_ctx.globals.missed_shots[player->EntIndex()])
{
player_record->side = RESOLVER_ORIGINAL;
return;
}
if (low_delta()) {
if (side)
{
player_record->type = type;
player_record->side = RESOLVER_LOW_FIRST;
}
else
{
player_record->type = type;
player_record->side = RESOLVER_LOW_SECOND;
}
}
else {
if (side)
{
player_record->type = type;
player_record->side = RESOLVER_FIRST;
}
else
{
player_record->type = type;
player_record->side = RESOLVER_SECOND;
}
}
}
float resolver::resolve_pitch()
{
return original_pitch;
}