-
Автор темы
- #1
Сразу говорю что резик не мой!
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
Ошибки фиксите уже сами.
------------------------------------------------------------------------
#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);
}
float NormalizeYaw(float yaw)
{
if (yaw > 180)
yaw -= (round(yaw / 360) * 360.f);
else if (yaw < -180)
yaw += (round(yaw / 360) * -360.f);
return yaw;
}
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;
}
int resolver::GetChokedPackets(player_t* entity)
{
int last_ticks[65];
auto ticks = TIME_TO_TICKS(entity->m_flSimulationTime() - entity->m_flOldSimulationTime());
if (ticks == 0 && last_ticks[entity->EntIndex()] > 0)
{
return last_ticks[entity->EntIndex()] - 1;
}
else
{
last_ticks[entity->EntIndex()] = ticks;
return ticks;
}
}
float flAngleMod(float flAngle)
{
return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65530));
}
float ApproachAngle(float target, float value, float speed)
{
target = flAngleMod(target);
value = flAngleMod(value);
float delta = target - value;
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 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;
}
float GetChokedPackets(player_t* e)
{
float simtime = e->m_flSimulationTime();
float oldsimtime = e->m_flOldSimulationTime();
float simdiff = simtime - oldsimtime;
auto chokedpackets = TIME_TO_TICKS(max(0, simdiff));
if (chokedpackets >= 1)
return chokedpackets;
return 0;
}
bool resolver::IsLBYdesync(player_t* record) {
if (GetChokedPackets(record) >= 1 && record->m_vecVelocity().Length2D() <= 1.f)
return true;
else //íàõóÿ ýòî ???
return false;
}
void resolver::resolve_yaw()
{
// lets be real this is the most p thing we ever seen
float m_flResolveValue;
int m_flResolveSide;
AnimationLayer layers[15];
AnimationLayer moveLayers[3][15];
int m_flSide;
bool m_bAnimatePlayer;
bool m_bAnimsUpdated;
bool m_bResolve;
bool m_flPreviousDelta;
// yee jarvis nanotechnology please.
// ok sir...
// fly mode activated
if (player->is_alive() && !player->is_player())
{
if (!(player->m_fFlags() & FL_ONGROUND))
{
m_flResolveSide = 0;
}
auto standing = layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f;
auto animating = layers[12].m_flWeight * 1000.f;
auto moving = !animating && (layers[6].m_flWeight * 1000.f) == (layers[6].m_flWeight * 1000.f);
float m_flSpeed = player->m_vecVelocity().Length2D();
if (m_flSpeed > 1.1f)
{
if (moving)
{
float EyeYaw = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate);
float Negative = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate);
float Positive = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate);
if (Positive > EyeYaw || Positive >= Negative || (Positive * 1000.0))
{
if (EyeYaw >= Negative && Positive > Negative && !(Negative * 1000.0))
{
m_bAnimsUpdated = true;
m_bResolve = true;
m_flSide = 1;
}
}
else
{
m_bAnimsUpdated = true;
m_bResolve = true;
m_flSide = -1;
}
}
}
else if (standing)
{
auto m_flEyeDelta = std::remainderf((player->m_angEyeAngles().y - player->m_flLowerBodyYawTarget()), 360.f) <= 0.f;
if (2 * m_flEyeDelta)
{
if (2 * m_flEyeDelta == 2)
{
m_flSide = -1;
}
}
else
{
m_flSide = 1;
}
m_bResolve = true;
m_flPreviousDelta = m_flEyeDelta;
}
m_flResolveValue = 58.f;
player->get_animation_state()->m_flGoalFeetYaw = (player->m_angEyeAngles().y + m_flResolveValue * m_flSide);
}
}
void resolver::goal_feet_yaw_bruteforce(player_t* player) {
bool side;
switch (g_ctx.globals.missed_shots[player->EntIndex()]) {
case 0:
side -= 58;
break;
case 1:
side += 58;
break;
case 2:
side -= 28;
break;
case 3:
side += 28;
break;
}
}
void update_walk_data(player_t* e)
{
float previous, m_previous;
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 = e->get_animlayers();
if (anim_layers.m_nSequence == 26 && anim_layers.m_flWeight < 0.4f)
s_1 = true;
if (anim_layers.m_nSequence == 7 && anim_layers.m_flWeight > 0.001f)
s_2 = true;
if (anim_layers.m_nSequence == 2 && anim_layers.m_flWeight == 0)
s_3 = true;
}
float m_fakewalking;
if (s_1 && s_2)
if (s_3)
m_fakewalking = true;
else
m_fakewalking = false;
else
m_fakewalking = false;
}
float layermove()
{
AnimationLayer m_Layer[15][2];
float C_BaseAnimatingOverlay;
(C_BaseAnimatingOverlay, m_Layer[0][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[0][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[0][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[0][2].m_flWeight, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_flWeight, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_flWeight, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_flWeight, FIELD_FLOAT);
}
void resolver::resolve_logic(player_t* player) {
player_info_t player_info;
auto animstate = player->get_animation_state();
if (math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y + 58.f)) {
RightSide = true;
LeftSide = false;
}
else if (math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y - 58.f)) {
RightSide = false;
LeftSide = true;
}
if (RightSide) {
switch (g_cfg.ragebot.enable && player->is_alive()) {
case 1:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y + 58.f);
break;
case 2:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y + 60.f);
break;
}
}
else if (LeftSide) {
switch (g_cfg.ragebot.enable && player->is_alive()) {
case 1:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y - 60.f);
break;
case 2:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y - 58.f);
break;
}
}
}
bool ent_use_lowdelta(player_t* player)
{
if (!player->is_alive())
return false;
if (!player->valid(false, false))
return false;
if (player->IsDormant())
return false;
int m_side;
float m_lby = player->m_flLowerBodyYawTarget();
auto delta = math::normalize_yaw(player->m_angEyeAngles().y - 0.f);
m_side = (delta > 0.f) ? -1 : 1;
auto speed = player->m_vecVelocity().Length2D();
auto choked = abs(TIME_TO_TICKS(player->m_flSimulationTime() - player->m_flOldSimulationTime()) - 1);
m_lby = (delta > 0.f) ? -1 : 1;
auto m_flGoalFeetYaw = player->get_animation_state()->m_flGoalFeetYaw;
auto m_flEyeYaw = player->get_animation_state()->m_flEyeYaw;
auto animstate = player->get_animation_state();
if (speed < 0.1f && !choked && m_lby < 30.f && fabs(delta < 15.f)) // low delta resolve > 10.f delta
{
int i = player->EntIndex();
if (m_side <= 1 && !choked) // if mside <= 1 && player->not_choke
{
int i = player->EntIndex();
if (fabs(delta < 15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * m_side); // not m_flgoalfeetyaw cuz lowdelta not choked and not desync'ing
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2) //missedshots case
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
}
}
else if (m_side >= -1 && !choked)
{
if (fabs(delta > -15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * m_side);
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
}
}
}
else if (speed < 0.1f && !choked && m_lby > -30.f && fabs(delta > -15.f)) // low delta resolve < -10 delta
{
int i = player->EntIndex();
if (m_side >= -1 && !choked)
{
if (fabs(delta > -15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * m_side);
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
}
}
else if (m_side <= 1 && !choked)
{
int i = player->EntIndex();
if (fabs(delta < 15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * m_side);
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
}
}
}
}
bool CanSeeHitbox(player_t* entity, int HITBOX)
{
return g_ctx.local()->CanSeePlayer(entity, entity->hitbox_position(HITBOX));
}
bool resolver::desync_detect()
{
if (!player->is_alive())
return false;
if (~player->m_fFlags() & FL_ONGROUND)
return false;
if (~player->m_iTeamNum() == g_ctx.local()->m_iTeamNum())
return false;
return true;
}
bool resolver::Saw(player_t* entity)
{
if (!(CanSeeHitbox(entity, HITBOX_HEAD) && CanSeeHitbox(entity, HITBOX_LEFT_FOOT) && CanSeeHitbox(entity, HITBOX_RIGHT_FOOT))
|| (CanSeeHitbox(entity, HITBOX_HEAD) && CanSeeHitbox(entity, HITBOX_LEFT_FOOT) && CanSeeHitbox(entity, HITBOX_RIGHT_FOOT)))
return false;
return true;
}
resolver_side resolver::TraceSide(player_t* entity)
{
auto first_visible = util::visible(g_ctx.globals.eye_pos, entity->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first), player, g_ctx.local());
auto second_visible = util::visible(g_ctx.globals.eye_pos, entity->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second), player, g_ctx.local());
auto main_visible = util::visible(g_ctx.globals.eye_pos, entity->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.main), player, g_ctx.local());
if (main_visible)
{
if (first_visible)
return RESOLVER_SECOND;
else if (second_visible)
return RESOLVER_FIRST;
}
else
{
if (first_visible)
return RESOLVER_FIRST;
else if (second_visible)
return RESOLVER_SECOND;
}
return RESOLVER_ORIGINAL;
}
void resolver::antifreestand()
{
player_info_t player_info;
auto animstate = player->get_animation_state();
if (!m_engine()->GetPlayerInfo(player->EntIndex(), &player_info) || !animstate)
return;
float angToLocal = math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y;
Vector ViewPoint = g_ctx.local()->m_vecOrigin() + Vector(0, 0, 90);
Vector2D Side1 = { (45 * sin(DEG2RAD(angToLocal))),(45 * cos(DEG2RAD(angToLocal))) };
Vector2D Side2 = { (45 * sin(DEG2RAD(angToLocal + 180))) ,(45 * cos(DEG2RAD(angToLocal + 180))) };
Vector2D Side3 = { (50 * sin(DEG2RAD(angToLocal))),(50 * cos(DEG2RAD(angToLocal))) };
Vector2D Side4 = { (50 * sin(DEG2RAD(angToLocal + 180))) ,(50 * cos(DEG2RAD(angToLocal + 180))) };
Vector Origin = player->m_vecOrigin();
Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
for (int side = 0; side < 2; side++)
{
Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
Vector ViewPointAutowall = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
if (autowall::get().can_hit_floating_point(OriginAutowall, ViewPoint))
{
if (side == 0)
{
freestand_side = true;
}
else if (side == 1)
{
freestand_side = false;
}
}
else
{
for (int sidealternative = 0; sidealternative < 2; sidealternative++)
{
Vector ViewPointAutowallalternative = { Origin.x + OriginLeftRight[sidealternative].x, Origin.y - OriginLeftRight[sidealternative].y , Origin.z + 90 };
if (autowall::get().can_hit_floating_point(ViewPointAutowallalternative, ViewPointAutowall))
{
if (sidealternative == 0)
{
freestand_side = true;
}
else if (sidealternative == 1)
{
freestand_side = false;
}
}
}
}
}
// fix
}
void resolver_()
{
int animstate;
animstate = 128;
if (animstate)
{
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 45.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 45.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 35.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 35.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 60.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 60.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 30.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 30.0;
}
float max_yaw = 180;
int yaw;
if (yaw = 180)
{
max_yaw;
}
if (yaw < 180)
{
max_yaw < 180;
}
}
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;
}
#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);
}
float NormalizeYaw(float yaw)
{
if (yaw > 180)
yaw -= (round(yaw / 360) * 360.f);
else if (yaw < -180)
yaw += (round(yaw / 360) * -360.f);
return yaw;
}
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;
}
int resolver::GetChokedPackets(player_t* entity)
{
int last_ticks[65];
auto ticks = TIME_TO_TICKS(entity->m_flSimulationTime() - entity->m_flOldSimulationTime());
if (ticks == 0 && last_ticks[entity->EntIndex()] > 0)
{
return last_ticks[entity->EntIndex()] - 1;
}
else
{
last_ticks[entity->EntIndex()] = ticks;
return ticks;
}
}
float flAngleMod(float flAngle)
{
return((360.0f / 65536.0f) * ((int32_t)(flAngle * (65536.0f / 360.0f)) & 65530));
}
float ApproachAngle(float target, float value, float speed)
{
target = flAngleMod(target);
value = flAngleMod(value);
float delta = target - value;
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 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;
}
float GetChokedPackets(player_t* e)
{
float simtime = e->m_flSimulationTime();
float oldsimtime = e->m_flOldSimulationTime();
float simdiff = simtime - oldsimtime;
auto chokedpackets = TIME_TO_TICKS(max(0, simdiff));
if (chokedpackets >= 1)
return chokedpackets;
return 0;
}
bool resolver::IsLBYdesync(player_t* record) {
if (GetChokedPackets(record) >= 1 && record->m_vecVelocity().Length2D() <= 1.f)
return true;
else //íàõóÿ ýòî ???
return false;
}
void resolver::resolve_yaw()
{
// lets be real this is the most p thing we ever seen
float m_flResolveValue;
int m_flResolveSide;
AnimationLayer layers[15];
AnimationLayer moveLayers[3][15];
int m_flSide;
bool m_bAnimatePlayer;
bool m_bAnimsUpdated;
bool m_bResolve;
bool m_flPreviousDelta;
// yee jarvis nanotechnology please.
// ok sir...
// fly mode activated
if (player->is_alive() && !player->is_player())
{
if (!(player->m_fFlags() & FL_ONGROUND))
{
m_flResolveSide = 0;
}
auto standing = layers[3].m_flWeight == 0.0f && layers[3].m_flCycle == 0.0f;
auto animating = layers[12].m_flWeight * 1000.f;
auto moving = !animating && (layers[6].m_flWeight * 1000.f) == (layers[6].m_flWeight * 1000.f);
float m_flSpeed = player->m_vecVelocity().Length2D();
if (m_flSpeed > 1.1f)
{
if (moving)
{
float EyeYaw = fabs(layers[6].m_flPlaybackRate - moveLayers[0][6].m_flPlaybackRate);
float Negative = fabs(layers[6].m_flPlaybackRate - moveLayers[2][6].m_flPlaybackRate);
float Positive = fabs(layers[6].m_flPlaybackRate - moveLayers[1][6].m_flPlaybackRate);
if (Positive > EyeYaw || Positive >= Negative || (Positive * 1000.0))
{
if (EyeYaw >= Negative && Positive > Negative && !(Negative * 1000.0))
{
m_bAnimsUpdated = true;
m_bResolve = true;
m_flSide = 1;
}
}
else
{
m_bAnimsUpdated = true;
m_bResolve = true;
m_flSide = -1;
}
}
}
else if (standing)
{
auto m_flEyeDelta = std::remainderf((player->m_angEyeAngles().y - player->m_flLowerBodyYawTarget()), 360.f) <= 0.f;
if (2 * m_flEyeDelta)
{
if (2 * m_flEyeDelta == 2)
{
m_flSide = -1;
}
}
else
{
m_flSide = 1;
}
m_bResolve = true;
m_flPreviousDelta = m_flEyeDelta;
}
m_flResolveValue = 58.f;
player->get_animation_state()->m_flGoalFeetYaw = (player->m_angEyeAngles().y + m_flResolveValue * m_flSide);
}
}
void resolver::goal_feet_yaw_bruteforce(player_t* player) {
bool side;
switch (g_ctx.globals.missed_shots[player->EntIndex()]) {
case 0:
side -= 58;
break;
case 1:
side += 58;
break;
case 2:
side -= 28;
break;
case 3:
side += 28;
break;
}
}
void update_walk_data(player_t* e)
{
float previous, m_previous;
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 = e->get_animlayers();
if (anim_layers.m_nSequence == 26 && anim_layers.m_flWeight < 0.4f)
s_1 = true;
if (anim_layers.m_nSequence == 7 && anim_layers.m_flWeight > 0.001f)
s_2 = true;
if (anim_layers.m_nSequence == 2 && anim_layers.m_flWeight == 0)
s_3 = true;
}
float m_fakewalking;
if (s_1 && s_2)
if (s_3)
m_fakewalking = true;
else
m_fakewalking = false;
else
m_fakewalking = false;
}
float layermove()
{
AnimationLayer m_Layer[15][2];
float C_BaseAnimatingOverlay;
(C_BaseAnimatingOverlay, m_Layer[0][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[0][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[0][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[0][2].m_flWeight, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[1][2].m_flWeight, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[2][2].m_flWeight, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_nSequence, FIELD_INTEGER),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_flCycle, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_flPlaybackRate, FIELD_FLOAT),
(C_BaseAnimatingOverlay, m_Layer[3][2].m_flWeight, FIELD_FLOAT);
}
void resolver::resolve_logic(player_t* player) {
player_info_t player_info;
auto animstate = player->get_animation_state();
if (math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y + 58.f)) {
RightSide = true;
LeftSide = false;
}
else if (math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y - 58.f)) {
RightSide = false;
LeftSide = true;
}
if (RightSide) {
switch (g_cfg.ragebot.enable && player->is_alive()) {
case 1:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y + 58.f);
break;
case 2:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y + 60.f);
break;
}
}
else if (LeftSide) {
switch (g_cfg.ragebot.enable && player->is_alive()) {
case 1:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y - 60.f);
break;
case 2:
math::normalize_yaw(math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y - 58.f);
break;
}
}
}
bool ent_use_lowdelta(player_t* player)
{
if (!player->is_alive())
return false;
if (!player->valid(false, false))
return false;
if (player->IsDormant())
return false;
int m_side;
float m_lby = player->m_flLowerBodyYawTarget();
auto delta = math::normalize_yaw(player->m_angEyeAngles().y - 0.f);
m_side = (delta > 0.f) ? -1 : 1;
auto speed = player->m_vecVelocity().Length2D();
auto choked = abs(TIME_TO_TICKS(player->m_flSimulationTime() - player->m_flOldSimulationTime()) - 1);
m_lby = (delta > 0.f) ? -1 : 1;
auto m_flGoalFeetYaw = player->get_animation_state()->m_flGoalFeetYaw;
auto m_flEyeYaw = player->get_animation_state()->m_flEyeYaw;
auto animstate = player->get_animation_state();
if (speed < 0.1f && !choked && m_lby < 30.f && fabs(delta < 15.f)) // low delta resolve > 10.f delta
{
int i = player->EntIndex();
if (m_side <= 1 && !choked) // if mside <= 1 && player->not_choke
{
int i = player->EntIndex();
if (fabs(delta < 15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * m_side); // not m_flgoalfeetyaw cuz lowdelta not choked and not desync'ing
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2) //missedshots case
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
}
}
else if (m_side >= -1 && !choked)
{
if (fabs(delta > -15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * m_side);
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
}
}
}
else if (speed < 0.1f && !choked && m_lby > -30.f && fabs(delta > -15.f)) // low delta resolve < -10 delta
{
int i = player->EntIndex();
if (m_side >= -1 && !choked)
{
if (fabs(delta > -15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * m_side);
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
}
}
else if (m_side <= 1 && !choked)
{
int i = player->EntIndex();
if (fabs(delta < 15.f) && !choked || !choked && g_ctx.globals.missed_shots < 1)
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta - 11.f * m_side);
}
else
{
AngleDiff(m_flEyeYaw - m_flGoalFeetYaw, 360.f);
delta = math::normalize_yaw(delta + 11.f * -m_side);
}
switch (g_ctx.globals.missed_shots[player->EntIndex()] % 2)
{
case 0:
delta = math::normalize_yaw(player->m_angEyeAngles().y + 11.f);
break;
case 1:
delta = math::normalize_yaw(player->m_angEyeAngles().y - 11.f);
break;
}
}
}
}
bool CanSeeHitbox(player_t* entity, int HITBOX)
{
return g_ctx.local()->CanSeePlayer(entity, entity->hitbox_position(HITBOX));
}
bool resolver::desync_detect()
{
if (!player->is_alive())
return false;
if (~player->m_fFlags() & FL_ONGROUND)
return false;
if (~player->m_iTeamNum() == g_ctx.local()->m_iTeamNum())
return false;
return true;
}
bool resolver::Saw(player_t* entity)
{
if (!(CanSeeHitbox(entity, HITBOX_HEAD) && CanSeeHitbox(entity, HITBOX_LEFT_FOOT) && CanSeeHitbox(entity, HITBOX_RIGHT_FOOT))
|| (CanSeeHitbox(entity, HITBOX_HEAD) && CanSeeHitbox(entity, HITBOX_LEFT_FOOT) && CanSeeHitbox(entity, HITBOX_RIGHT_FOOT)))
return false;
return true;
}
resolver_side resolver::TraceSide(player_t* entity)
{
auto first_visible = util::visible(g_ctx.globals.eye_pos, entity->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.first), player, g_ctx.local());
auto second_visible = util::visible(g_ctx.globals.eye_pos, entity->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.second), player, g_ctx.local());
auto main_visible = util::visible(g_ctx.globals.eye_pos, entity->hitbox_position_matrix(HITBOX_HEAD, player_record->matrixes_data.main), player, g_ctx.local());
if (main_visible)
{
if (first_visible)
return RESOLVER_SECOND;
else if (second_visible)
return RESOLVER_FIRST;
}
else
{
if (first_visible)
return RESOLVER_FIRST;
else if (second_visible)
return RESOLVER_SECOND;
}
return RESOLVER_ORIGINAL;
}
void resolver::antifreestand()
{
player_info_t player_info;
auto animstate = player->get_animation_state();
if (!m_engine()->GetPlayerInfo(player->EntIndex(), &player_info) || !animstate)
return;
float angToLocal = math::calculate_angle(g_ctx.local()->m_vecOrigin(), player->m_vecOrigin()).y;
Vector ViewPoint = g_ctx.local()->m_vecOrigin() + Vector(0, 0, 90);
Vector2D Side1 = { (45 * sin(DEG2RAD(angToLocal))),(45 * cos(DEG2RAD(angToLocal))) };
Vector2D Side2 = { (45 * sin(DEG2RAD(angToLocal + 180))) ,(45 * cos(DEG2RAD(angToLocal + 180))) };
Vector2D Side3 = { (50 * sin(DEG2RAD(angToLocal))),(50 * cos(DEG2RAD(angToLocal))) };
Vector2D Side4 = { (50 * sin(DEG2RAD(angToLocal + 180))) ,(50 * cos(DEG2RAD(angToLocal + 180))) };
Vector Origin = player->m_vecOrigin();
Vector2D OriginLeftRight[] = { Vector2D(Side1.x, Side1.y), Vector2D(Side2.x, Side2.y) };
Vector2D OriginLeftRightLocal[] = { Vector2D(Side3.x, Side3.y), Vector2D(Side4.x, Side4.y) };
for (int side = 0; side < 2; side++)
{
Vector OriginAutowall = { Origin.x + OriginLeftRight[side].x, Origin.y - OriginLeftRight[side].y , Origin.z + 90 };
Vector ViewPointAutowall = { ViewPoint.x + OriginLeftRightLocal[side].x, ViewPoint.y - OriginLeftRightLocal[side].y , ViewPoint.z };
if (autowall::get().can_hit_floating_point(OriginAutowall, ViewPoint))
{
if (side == 0)
{
freestand_side = true;
}
else if (side == 1)
{
freestand_side = false;
}
}
else
{
for (int sidealternative = 0; sidealternative < 2; sidealternative++)
{
Vector ViewPointAutowallalternative = { Origin.x + OriginLeftRight[sidealternative].x, Origin.y - OriginLeftRight[sidealternative].y , Origin.z + 90 };
if (autowall::get().can_hit_floating_point(ViewPointAutowallalternative, ViewPointAutowall))
{
if (sidealternative == 0)
{
freestand_side = true;
}
else if (sidealternative == 1)
{
freestand_side = false;
}
}
}
}
}
// fix
}
void resolver_()
{
int animstate;
animstate = 128;
if (animstate)
{
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 45.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 45.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 35.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 35.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 60.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 60.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) + 30.0;
*(float*)(animstate + 0x80) = *(float*)(animstate + 128) - 30.0;
}
float max_yaw = 180;
int yaw;
if (yaw = 180)
{
max_yaw;
}
if (yaw < 180)
{
max_yaw < 180;
}
}
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;
}
------------------------------------------------------------------------
#pragma once
#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"
enum
{
MAIN,
NONE,
FIRST,
SECOND,
LOW_FIRST,
LOW_SECOND
};
enum resolver_type
{
ORIGINAL,
BRUTEFORCE,
LBY,
TRACE,
DIRECTIONAL,
DELTA,
LAYERS,
DEFAULT
};
enum resolver_side
{
RESOLVER_ORIGINAL,
RESOLVER_ZERO,
RESOLVER_FIRST,
RESOLVER_SECOND,
RESOLVER_LOW_FIRST,
RESOLVER_LOW_SECOND,
RESOLVER_DEFAULT
};
struct matrixes
{
matrix3x4_t main[MAXSTUDIOBONES];
matrix3x4_t zero[MAXSTUDIOBONES];
matrix3x4_t first[MAXSTUDIOBONES];
matrix3x4_t second[MAXSTUDIOBONES];
matrix3x4_t low_first[MAXSTUDIOBONES];
matrix3x4_t low_second[MAXSTUDIOBONES];
};
class adjust_data;
class resolver
{
player_t* player = nullptr;
adjust_data* player_record = nullptr;
bool freestand_side = false;
bool side = false;
bool fake = false;
bool was_first_bruteforce = false;
bool was_second_bruteforce = false;
int CalculatedSide;
bool IsLbyDesync = false;
float lock_side = 0.0f;
float original_goal_feet_yaw = 0.0f;
float original_pitch = 0.0f;
int RightSide;
int LeftSide;
public:
void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
void reset();
void resolve_yaw();
float resolve_pitch();
int GetChokedPackets(player_t* entity);
bool IsLBYdesync(player_t* record);
void resolve_logic(player_t* player);
void goal_feet_yaw_bruteforce(player_t* player);
bool desync_detect();
void antifreestand();
bool Saw(player_t* entity);
resolver_side TraceSide(player_t* e);
AnimationLayer resolver_layers[3][15];
AnimationLayer previous_layers[15];
bool safe_matrix_shot = false;
resolver_side last_side = RESOLVER_ORIGINAL;
};
class adjust_data
{
public:
player_t* player;
int i;
AnimationLayer layers[15];
AnimationLayer resolver_layers[3][13];
AnimationLayer right_layers[13];
AnimationLayer left_layers[13];
AnimationLayer center_layers[13];
matrixes matrixes_data;
resolver_type type;
resolver_side side;
bool invalid;
bool immune;
bool dormant;
bool bot;
bool shot;
bool m_flLowDelta;
bool m_flHighDelta;
int flags;
int bone_count;
float simulation_time;
float duck_amount;
float lby;
Vector angles;
Vector abs_angles;
Vector velocity;
Vector origin;
Vector mins;
Vector maxs;
adjust_data() //-V730
{
reset();
}
void reset()
{
player = nullptr;
i = -1;
type = ORIGINAL;
side = RESOLVER_ORIGINAL;
invalid = false;
immune = false;
dormant = false;
bot = false;
flags = 0;
bone_count = 0;
simulation_time = 0.0f;
duck_amount = 0.0f;
lby = 0.0f;
angles.Zero();
abs_angles.Zero();
velocity.Zero();
origin.Zero();
mins.Zero();
maxs.Zero();
}
adjust_data(player_t* e, bool store = true)
{
type = ORIGINAL;
side = RESOLVER_ORIGINAL;
invalid = false;
store_data(e, store);
}
void store_data(player_t* e, bool store = true)
{
if (!e->is_alive())
return;
player = e;
i = player->EntIndex();
if (store)
{
memcpy(layers, e->get_animlayers(), 13 * sizeof(AnimationLayer));
memcpy(matrixes_data.main, player->m_CachedBoneData().Base(), player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));
}
immune = player->m_bGunGameImmunity() || player->m_fFlags() & FL_FROZEN;
dormant = player->IsDormant();
player_info_t player_info;
m_engine()->GetPlayerInfo(i, &player_info);
bot = player_info.fakeplayer;
flags = player->m_fFlags();
bone_count = player->m_CachedBoneData().Count();
simulation_time = player->m_flSimulationTime();
duck_amount = player->m_flDuckAmount();
lby = player->m_flLowerBodyYawTarget();
angles = player->m_angEyeAngles();
abs_angles = player->GetAbsAngles();
velocity = player->m_vecVelocity();
origin = player->m_vecOrigin();
mins = player->GetCollideable()->OBBMins();
maxs = player->GetCollideable()->OBBMaxs();
}
void adjust_player()
{
if (!valid(false))
return;
memcpy(player->get_animlayers(), layers, 13 * sizeof(AnimationLayer));
memcpy(player->m_CachedBoneData().Base(), matrixes_data.main, player->m_CachedBoneData().Count() * sizeof(matrix3x4_t)); //-V807
player->m_fFlags() = flags;
player->m_CachedBoneData().m_Size = bone_count;
player->m_flSimulationTime() = simulation_time;
player->m_flDuckAmount() = duck_amount;
player->m_flLowerBodyYawTarget() = lby;
player->m_angEyeAngles() = angles;
player->set_abs_angles(abs_angles);
player->m_vecVelocity() = velocity;
player->m_vecOrigin() = origin;
player->set_abs_origin(origin);
player->GetCollideable()->OBBMins() = mins;
player->GetCollideable()->OBBMaxs() = maxs;
}
bool valid(bool extra_checks = true)
{
if (!this) //-V704
return false;
if (i > 0)
player = (player_t*)m_entitylist()->GetClientEntity(i);
if (!player)
return false;
if (player->m_lifeState() != LIFE_ALIVE)
return false;
if (immune)
return false;
if (dormant)
return false;
if (!extra_checks)
return true;
if (invalid)
return false;
auto net_channel_info = m_engine()->GetNetChannelInfo();
if (!net_channel_info)
return false;
static auto sv_maxunlag = m_cvar()->FindVar(crypt_str("sv_maxunlag"));
auto outgoing = net_channel_info->GetLatency(FLOW_OUTGOING);
auto incoming = net_channel_info->GetLatency(FLOW_INCOMING);
auto correct = math::clamp(outgoing + incoming + util::get_interpolation(), 0.0f, sv_maxunlag->GetFloat());
auto curtime = g_ctx.local()->is_alive() ? TICKS_TO_TIME(g_ctx.globals.fixed_tickbase) : m_globals()->m_curtime; //-V807
auto delta_time = correct - (curtime - simulation_time);
if (fabs(delta_time) > 0.2f)
return false;
auto extra_choke = 0;
if (g_ctx.globals.fakeducking)
extra_choke = 14 - m_clientstate()->iChokedCommands;
auto server_tickcount = extra_choke + m_globals()->m_tickcount + TIME_TO_TICKS(outgoing + incoming);
auto dead_time = (int)(TICKS_TO_TIME(server_tickcount) - sv_maxunlag->GetFloat());
if (simulation_time < (float)dead_time)
return false;
return true;
}
};
class optimized_adjust_data
{
public:
int i;
player_t* player;
float simulation_time;
float duck_amount;
Vector angles;
Vector origin;
optimized_adjust_data() //-V730
{
reset();
}
void reset()
{
i = 0;
player = nullptr;
simulation_time = 0.0f;
duck_amount = 0.0f;
angles.Zero();
origin.Zero();
}
};
extern std::deque <adjust_data> player_records[65];
class lagcompensation : public singleton <lagcompensation>
{
public:
void fsn(ClientFrameStage_t stage);
bool valid(int i, player_t* e);
void update_player_animations(player_t* e);
resolver player_resolver[65];
bool is_dormant[65];
float previous_goal_feet_yaw[65];
};
#include "..\..\includes.hpp"
#include "..\..\sdk\structs.hpp"
enum
{
MAIN,
NONE,
FIRST,
SECOND,
LOW_FIRST,
LOW_SECOND
};
enum resolver_type
{
ORIGINAL,
BRUTEFORCE,
LBY,
TRACE,
DIRECTIONAL,
DELTA,
LAYERS,
DEFAULT
};
enum resolver_side
{
RESOLVER_ORIGINAL,
RESOLVER_ZERO,
RESOLVER_FIRST,
RESOLVER_SECOND,
RESOLVER_LOW_FIRST,
RESOLVER_LOW_SECOND,
RESOLVER_DEFAULT
};
struct matrixes
{
matrix3x4_t main[MAXSTUDIOBONES];
matrix3x4_t zero[MAXSTUDIOBONES];
matrix3x4_t first[MAXSTUDIOBONES];
matrix3x4_t second[MAXSTUDIOBONES];
matrix3x4_t low_first[MAXSTUDIOBONES];
matrix3x4_t low_second[MAXSTUDIOBONES];
};
class adjust_data;
class resolver
{
player_t* player = nullptr;
adjust_data* player_record = nullptr;
bool freestand_side = false;
bool side = false;
bool fake = false;
bool was_first_bruteforce = false;
bool was_second_bruteforce = false;
int CalculatedSide;
bool IsLbyDesync = false;
float lock_side = 0.0f;
float original_goal_feet_yaw = 0.0f;
float original_pitch = 0.0f;
int RightSide;
int LeftSide;
public:
void initialize(player_t* e, adjust_data* record, const float& goal_feet_yaw, const float& pitch);
void reset();
void resolve_yaw();
float resolve_pitch();
int GetChokedPackets(player_t* entity);
bool IsLBYdesync(player_t* record);
void resolve_logic(player_t* player);
void goal_feet_yaw_bruteforce(player_t* player);
bool desync_detect();
void antifreestand();
bool Saw(player_t* entity);
resolver_side TraceSide(player_t* e);
AnimationLayer resolver_layers[3][15];
AnimationLayer previous_layers[15];
bool safe_matrix_shot = false;
resolver_side last_side = RESOLVER_ORIGINAL;
};
class adjust_data
{
public:
player_t* player;
int i;
AnimationLayer layers[15];
AnimationLayer resolver_layers[3][13];
AnimationLayer right_layers[13];
AnimationLayer left_layers[13];
AnimationLayer center_layers[13];
matrixes matrixes_data;
resolver_type type;
resolver_side side;
bool invalid;
bool immune;
bool dormant;
bool bot;
bool shot;
bool m_flLowDelta;
bool m_flHighDelta;
int flags;
int bone_count;
float simulation_time;
float duck_amount;
float lby;
Vector angles;
Vector abs_angles;
Vector velocity;
Vector origin;
Vector mins;
Vector maxs;
adjust_data() //-V730
{
reset();
}
void reset()
{
player = nullptr;
i = -1;
type = ORIGINAL;
side = RESOLVER_ORIGINAL;
invalid = false;
immune = false;
dormant = false;
bot = false;
flags = 0;
bone_count = 0;
simulation_time = 0.0f;
duck_amount = 0.0f;
lby = 0.0f;
angles.Zero();
abs_angles.Zero();
velocity.Zero();
origin.Zero();
mins.Zero();
maxs.Zero();
}
adjust_data(player_t* e, bool store = true)
{
type = ORIGINAL;
side = RESOLVER_ORIGINAL;
invalid = false;
store_data(e, store);
}
void store_data(player_t* e, bool store = true)
{
if (!e->is_alive())
return;
player = e;
i = player->EntIndex();
if (store)
{
memcpy(layers, e->get_animlayers(), 13 * sizeof(AnimationLayer));
memcpy(matrixes_data.main, player->m_CachedBoneData().Base(), player->m_CachedBoneData().Count() * sizeof(matrix3x4_t));
}
immune = player->m_bGunGameImmunity() || player->m_fFlags() & FL_FROZEN;
dormant = player->IsDormant();
player_info_t player_info;
m_engine()->GetPlayerInfo(i, &player_info);
bot = player_info.fakeplayer;
flags = player->m_fFlags();
bone_count = player->m_CachedBoneData().Count();
simulation_time = player->m_flSimulationTime();
duck_amount = player->m_flDuckAmount();
lby = player->m_flLowerBodyYawTarget();
angles = player->m_angEyeAngles();
abs_angles = player->GetAbsAngles();
velocity = player->m_vecVelocity();
origin = player->m_vecOrigin();
mins = player->GetCollideable()->OBBMins();
maxs = player->GetCollideable()->OBBMaxs();
}
void adjust_player()
{
if (!valid(false))
return;
memcpy(player->get_animlayers(), layers, 13 * sizeof(AnimationLayer));
memcpy(player->m_CachedBoneData().Base(), matrixes_data.main, player->m_CachedBoneData().Count() * sizeof(matrix3x4_t)); //-V807
player->m_fFlags() = flags;
player->m_CachedBoneData().m_Size = bone_count;
player->m_flSimulationTime() = simulation_time;
player->m_flDuckAmount() = duck_amount;
player->m_flLowerBodyYawTarget() = lby;
player->m_angEyeAngles() = angles;
player->set_abs_angles(abs_angles);
player->m_vecVelocity() = velocity;
player->m_vecOrigin() = origin;
player->set_abs_origin(origin);
player->GetCollideable()->OBBMins() = mins;
player->GetCollideable()->OBBMaxs() = maxs;
}
bool valid(bool extra_checks = true)
{
if (!this) //-V704
return false;
if (i > 0)
player = (player_t*)m_entitylist()->GetClientEntity(i);
if (!player)
return false;
if (player->m_lifeState() != LIFE_ALIVE)
return false;
if (immune)
return false;
if (dormant)
return false;
if (!extra_checks)
return true;
if (invalid)
return false;
auto net_channel_info = m_engine()->GetNetChannelInfo();
if (!net_channel_info)
return false;
static auto sv_maxunlag = m_cvar()->FindVar(crypt_str("sv_maxunlag"));
auto outgoing = net_channel_info->GetLatency(FLOW_OUTGOING);
auto incoming = net_channel_info->GetLatency(FLOW_INCOMING);
auto correct = math::clamp(outgoing + incoming + util::get_interpolation(), 0.0f, sv_maxunlag->GetFloat());
auto curtime = g_ctx.local()->is_alive() ? TICKS_TO_TIME(g_ctx.globals.fixed_tickbase) : m_globals()->m_curtime; //-V807
auto delta_time = correct - (curtime - simulation_time);
if (fabs(delta_time) > 0.2f)
return false;
auto extra_choke = 0;
if (g_ctx.globals.fakeducking)
extra_choke = 14 - m_clientstate()->iChokedCommands;
auto server_tickcount = extra_choke + m_globals()->m_tickcount + TIME_TO_TICKS(outgoing + incoming);
auto dead_time = (int)(TICKS_TO_TIME(server_tickcount) - sv_maxunlag->GetFloat());
if (simulation_time < (float)dead_time)
return false;
return true;
}
};
class optimized_adjust_data
{
public:
int i;
player_t* player;
float simulation_time;
float duck_amount;
Vector angles;
Vector origin;
optimized_adjust_data() //-V730
{
reset();
}
void reset()
{
i = 0;
player = nullptr;
simulation_time = 0.0f;
duck_amount = 0.0f;
angles.Zero();
origin.Zero();
}
};
extern std::deque <adjust_data> player_records[65];
class lagcompensation : public singleton <lagcompensation>
{
public:
void fsn(ClientFrameStage_t stage);
bool valid(int i, player_t* e);
void update_player_animations(player_t* e);
resolver player_resolver[65];
bool is_dormant[65];
float previous_goal_feet_yaw[65];
};
Ошибки фиксите уже сами.