Начинающий
-
Автор темы
- #1
in legendware, antiaim doesnt do what its supposed to do
theres sometimes random jitters and desync jitter completely fucks up animations
can anyone help me with it?
theres sometimes random jitters and desync jitter completely fucks up animations
can anyone help me with it?
get_yaw:
float antiaim::GetYaw(CUserCmd* m_pcmd)
{
auto yaw = 0.0f;
auto lby_type = 0;
bool can_jitter = true;
static auto sway_counter = 0;
static auto force_choke = false;
static auto invert_jitter = false;
static auto should_invert = false;
auto max_desync_delta = g_ctx.local()->get_max_desync_delta();
final_manual_side = manual_side;
if (g_ctx.send_packet)
should_invert = true;
else if (!g_ctx.send_packet && should_invert) {
should_invert = false;
invert_jitter = !invert_jitter;
}
auto yaw_add_angle = flip ? cfg::g_cfg.antiaim.yaw_add_left : cfg::g_cfg.antiaim.yaw_add_right;
auto base_angle = m_pcmd->m_viewangles.y + GetYawDirection(m_pcmd) + yaw_add_angle;
if (manual_side == SIDE_NONE && cfg::g_cfg.antiaim.freestand && key_binds::get().get_key_bind_state(24))
Freestanding(m_pcmd);
if (final_manual_side == SIDE_LEFT)
base_angle -= 90.0f;
if (final_manual_side == SIDE_RIGHT)
base_angle += 90.0f;
//At targets.
if (cfg::g_cfg.antiaim.base_angle && manual_side == SIDE_NONE)
base_angle = GetAtTargetAngles();
if (cfg::g_cfg.antiaim.desync == 1)
flip = key_binds::get().get_key_bind_state(16);
auto yaw_angle = 0.0f;
switch (cfg::g_cfg.antiaim.yaw)
{
case 1:
base_angle += (invert_jitter ? -0.5f : 0.5f) * (float)cfg::g_cfg.antiaim.range;
break;
case 2:
if (flip)
{
auto start_angle = (float)cfg::g_cfg.antiaim.range * 0.5f;
auto end_angle = (float)cfg::g_cfg.antiaim.range * -0.5f;
static auto angle = start_angle;
auto angle_add_amount = (float)cfg::g_cfg.antiaim.speed * 0.5f;
if (angle - angle_add_amount >= end_angle)
angle -= angle_add_amount;
else
angle = start_angle;
yaw_angle = angle;
}
else
{
auto start_angle = (float)cfg::g_cfg.antiaim.range * -0.5f;
auto end_angle = (float)cfg::g_cfg.antiaim.range * 0.5f;
static auto angle = start_angle;
auto angle_add_amount = (float)cfg::g_cfg.antiaim.speed * 0.5f;
if (angle + angle_add_amount <= end_angle)
angle += angle_add_amount;
else
angle = start_angle;
yaw_angle = angle;
}
base_angle = (base_angle - (float)cfg::g_cfg.antiaim.range / 2.f) + std::fmod(m_globals()->m_curtime * ((float)cfg::g_cfg.antiaim.speed * 20.f), (float)cfg::g_cfg.antiaim.range);
break;
}
desync_angle = 0.0f;
if (cfg::g_cfg.antiaim.desync)
{
if (cfg::g_cfg.antiaim.desync == 2)
flip = !flip;
auto desync_delta = max_desync_delta;
if (cfg::g_cfg.antiaim.desync)
desync_delta *= 3.0f;
else
desync_delta = min(desync_delta, (float)cfg::g_cfg.antiaim.desync_range);
if (!flip)
{
desync_delta = -desync_delta;
max_desync_delta = -max_desync_delta;
}
base_angle -= desync_delta;
if (!cfg::g_cfg.antiaim.desync)
{
if (!flip)
base_angle += desync_delta * (float)cfg::g_cfg.antiaim.yaw_add_left * 0.01f;
else
base_angle += desync_delta * (float)cfg::g_cfg.antiaim.yaw_add_right * 0.01f;
}
desync_angle = desync_delta;
}
yaw = base_angle + yaw_angle;
if (!desync_angle)
return yaw;
if (ShouldBreakLowerBody(m_pcmd, 1))
{
auto speed = 1.01f;
if (m_pcmd->m_buttons & IN_DUCK || g_ctx.globals.fakeducking)
speed *= 2.94117647f;
static auto switch_move = false;
if (switch_move)
m_pcmd->m_sidemove += speed;
else
m_pcmd->m_sidemove -= speed;
switch_move = !switch_move;
if (lby_type != 2 || sway_counter > 3)
{
if (desync_angle > 0.0f)
yaw -= 179.0f;
else
yaw += 179.0f;
}
if (sway_counter < 8)
++sway_counter;
else
sway_counter = 0;
breaking_lby = true;
force_choke = true;
g_ctx.send_packet = false;
return yaw;
}
else if (force_choke)
{
force_choke = false;
g_ctx.send_packet = false;
return yaw;
}
else if (g_ctx.send_packet)
yaw += desync_angle;
return yaw;
}
should_break_lby:
bool antiaim::ShouldBreakLowerBody(CUserCmd* m_pcmd, int lby_type) {
if (g_ctx.globals.tochargeamount > 0)
return false;
if (!lby_type)
return false;
if (g_ctx.globals.fakeducking && m_clientstate()->iChokedCommands > 12)
return false;
if (!g_ctx.globals.fakeducking && m_clientstate()->iChokedCommands > 14)
{
g_ctx.send_packet = true;
fakelag::get().started_peeking = false;
}
auto animstate = g_ctx.local()->get_animation_state(); //-V807
if (!animstate)
return false;
if (animstate->m_velocity > 0.1f || fabs(animstate->flUpVelocity) > 100.0f)
g_ctx.globals.next_lby_update = TICKS_TO_TIME(g_ctx.globals.fixed_tickbase + 14);
else
{
if (TICKS_TO_TIME(g_ctx.globals.fixed_tickbase) > g_ctx.globals.next_lby_update)
{
g_ctx.globals.next_lby_update = 0.0f;
return true;
}
}
return false;
}